diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 457a53cbe8b..93c927cbe2a 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3034,7 +3034,11 @@ it is commonly assigned to the @code{mouse-face} property for cursor highlighting (@pxref{Special Properties}). @item match -For text matching a search command. +@itemx isearch +@itemx lazy-highlight +For text matching (respectively) permanent search matches, interactive +search matches, and lazy highlighting other matches than the current +interactive one. @item error @itemx warning diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index 61ee5698435..21aec6cdfcd 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -774,7 +774,7 @@ to avoid corrupting the original LIST1 and LIST2. \nKeywords supported: :test :test-not :key \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) - ((equal cl-list1 cl-list2) cl-list1) + ((and (not cl-keys) (equal cl-list1 cl-list2)) cl-list1) (t (or (>= (length cl-list1) (length cl-list2)) (setq cl-list1 (prog1 cl-list2 (setq cl-list2 cl-list1)))) diff --git a/lisp/filenotify.el b/lisp/filenotify.el index 21046a85a7a..f8a53631135 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -27,8 +27,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(require 'cl-lib) (defconst file-notify--library (cond @@ -58,7 +57,7 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'. If it is registered in `file-notify-descriptors', a stopped event is sent." (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) (registered (gethash desc file-notify-descriptors)) - (file (if (consp descriptor) (cdr descriptor) (caadr registered))) + (file (if (consp descriptor) (cdr descriptor) (cl-caadr registered))) (dir (car registered))) (when (consp registered) @@ -104,7 +103,7 @@ It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).") Could be different from the directory watched by the backend library." (let* ((desc (if (consp (car event)) (caar event) (car event))) (registered (gethash desc file-notify-descriptors)) - (file (if (consp (car event)) (cdar event) (caadr registered))) + (file (if (consp (car event)) (cdar event) (cl-caadr registered))) (dir (car registered))) (if file (expand-file-name file dir) dir))) @@ -274,11 +273,13 @@ EVENT is the cadr of the event in `file-notify-handle-event' `(,(file-notify--descriptor desc (car entry)) ,action ,file)))) ;; Send `stopped' event. - (when (and (memq action '(deleted renamed)) - ;; Not, when a file is backed up. - (not (and (stringp file1) (backup-file-name-p file1))) - ;; Watched file or directory is concerned. - (string-equal file (file-notify--event-watched-file event))) + (when (or stopped + (and (memq action '(deleted renamed)) + ;; Not, when a file is backed up. + (not (and (stringp file1) (backup-file-name-p file1))) + ;; Watched file or directory is concerned. + (string-equal + file (file-notify--event-watched-file event)))) (file-notify-rm-watch (file-notify--descriptor desc (car entry)))))))) ;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index e3fe315f3bd..fb942b34ddc 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -32,7 +32,7 @@ ;; file after putting it on your load path: ;; ;; (autoload 'ruby-mode "ruby-mode" "Major mode for ruby files" t) -;; (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode)) +;; (add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode)) ;; (add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode)) ;; ;; Still needs more docstrings; search below for TODO. @@ -188,9 +188,10 @@ This should only be called after matching against `ruby-here-doc-beg-re'." (modify-syntax-entry ?# "<" table) (modify-syntax-entry ?\n ">" table) (modify-syntax-entry ?\\ "\\" table) - (modify-syntax-entry ?$ "." table) + (modify-syntax-entry ?$ "'" table) (modify-syntax-entry ?_ "_" table) - (modify-syntax-entry ?: "_" table) + (modify-syntax-entry ?: "'" table) + (modify-syntax-entry ?@ "'" table) (modify-syntax-entry ?< "." table) (modify-syntax-entry ?> "." table) (modify-syntax-entry ?& "." table) @@ -1858,6 +1859,10 @@ It will be properly highlighted even when the call omits parens.") (string-to-syntax "_")))) ;; Backtick method redefinition. ("^[ \t]*def +\\(`\\)" (1 "_")) + ;; Ternary operator colon followed by opening paren or bracket + ;; (semi-important for indentation). + ("\\(:\\)\\(?:[\({]\\|\\[[^]]\\)" + (1 (string-to-syntax "."))) ;; Regular expressions. Start with matching unescaped slash. ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)" (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1))))) @@ -2023,7 +2028,7 @@ It will be properly highlighted even when the call omits parens.") "The syntax table to use for fontifying Ruby mode buffers. See `font-lock-syntax-table'.") -(defconst ruby-font-lock-keyword-beg-re "\\(?:^\\|[^.@$]\\|\\.\\.\\)") +(defconst ruby-font-lock-keyword-beg-re "\\(?:^\\|[^.@$:]\\|\\.\\.\\)") (defconst ruby-font-lock-keywords `(;; Functions. @@ -2196,7 +2201,7 @@ See `font-lock-syntax-table'.") ("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+" 0 font-lock-variable-name-face) ;; Constants. - ("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)" + ("\\_<\\([A-Z]+\\(\\w\\|_\\)*\\)" 1 (unless (eq ?\( (char-after)) font-lock-type-face)) ;; Ruby 1.9-style symbol hash keys. ("\\(?:^\\s *\\|[[{(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+:\\)[^:]" diff --git a/lisp/replace.el b/lisp/replace.el index b7e26c96fc5..a2ce78a8bb2 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1268,6 +1268,7 @@ Compatibility function for \\[next-error] invocations." (t :background "gray")) "Face used to highlight matches permanently." :group 'matching + :group 'basic-faces :version "22.1") (defcustom list-matching-lines-default-context-lines 0 diff --git a/lisp/subr.el b/lisp/subr.el index 447c3eb1a4f..6eea54f2a32 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2765,29 +2765,7 @@ See also `locate-user-emacs-file'.") "Determine the boundaries of the default tag, based on text at point. Return a cons cell with the beginning and end of the found tag. If there is no plausible default, return nil." - (let (from to bound) - (when (or (progn - ;; Look at text around `point'. - (save-excursion - (skip-syntax-backward "w_") (setq from (point))) - (save-excursion - (skip-syntax-forward "w_") (setq to (point))) - (> to from)) - ;; Look between `line-beginning-position' and `point'. - (save-excursion - (and (setq bound (line-beginning-position)) - (skip-syntax-backward "^w_" bound) - (> (setq to (point)) bound) - (skip-syntax-backward "w_") - (setq from (point)))) - ;; Look between `point' and `line-end-position'. - (save-excursion - (and (setq bound (line-end-position)) - (skip-syntax-forward "^w_" bound) - (< (setq from (point)) bound) - (skip-syntax-forward "w_") - (setq to (point))))) - (cons from to)))) + (bounds-of-thing-at-point 'symbol)) (defun find-tag-default () "Determine default tag to search for, based on text at point. diff --git a/test/automated/cl-seq-tests.el b/test/automated/cl-seq-tests.el new file mode 100644 index 00000000000..d2eb412eee3 --- /dev/null +++ b/test/automated/cl-seq-tests.el @@ -0,0 +1,42 @@ +;;; cl-seq-tests.el --- Tests for cl-seq.el functionality -*- lexical-binding: t; -*- + +;; Copyright (C) 2015-2016 Free Software Foundation, Inc. + +;; Author: Nicolas Richard + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'cl-seq) + +(ert-deftest cl-union-test-00 () + (let ((str1 "foo") + (str2 (make-string 3 ?o))) + ;; Emacs may make two string literals eql when reading. + (aset str2 0 ?f) + (should (not (eql str1 str2))) + (should (equal str1 str2)) + (should (equal (cl-union (list str1) (list str2)) + (list str2))) + (should (equal (cl-union (list str1) (list str2) :test 'eql) + (list str1 str2))))) + +(provide 'cl-seq-tests) +;;; cl-seq-tests.el ends here