From 1bc0e0a5b7184cf78ae94bb7d46f25f1c2a02654 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 22 Feb 2016 22:05:00 +0100 Subject: [PATCH 1/5] Minor fixes in filenotify.el * lisp/filenotify.el (top): Require 'cl-lib. (file-notify--rm-descriptor) (file-notify--event-watched-file): Use cl-caadr. (file-notify-callback): Handle also `ignore' events from inotify. --- lisp/filenotify.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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 From e72a26e00981a508569a0856125061310a3f64ac Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 23 Feb 2016 00:56:51 +0200 Subject: [PATCH 2/5] Make find-tag-default-bounds more strict * lisp/subr.el (find-tag-default-bounds): Delegate to bounds-of-thing-at-point (bug#22692). --- lisp/subr.el | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index cf26fe384ba..dde76916230 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2626,29 +2626,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. From c1ec7434c38a8ee59e7ce895fbfd317e133ad40e Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 23 Feb 2016 02:27:49 +0200 Subject: [PATCH 3/5] Make $, : and @ "prefix characters" in ruby-mode * lisp/progmodes/ruby-mode.el (ruby-mode-syntax-table): Change the syntax classes of $, : and @ to "prefix character" (http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00272.html). (ruby-syntax-propertize): Undo that specifically for colons followed by an opening paren or bracket. (ruby-font-lock-keyword-beg-re): Include colon character. (ruby-font-lock-keywords): Adjust the constants matcher for `:' not being a symbol constituent anymore. --- lisp/progmodes/ruby-mode.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 9fbebebe594..cebc1dc9823 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) @@ -1859,6 +1860,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))))) @@ -2024,7 +2029,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. @@ -2197,7 +2202,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\\|_\\)+:\\)[^:]" From 17dd3fb4a52e78c57308b795e41e8c9f50a9c5cc Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 23 Feb 2016 13:31:25 +1100 Subject: [PATCH 4/5] Add `isearch' to `basic-faces' * doc/lispref/display.texi (Basic Faces): Mention the isearch and lazy-highlight faces. * lisp/replace.el (match): Add `isearch' to the `basic-faces' group, too (bug#22760). --- doc/lispref/display.texi | 6 +++++- lisp/replace.el | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 323895927a9..e4aff43ccba 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/replace.el b/lisp/replace.el index 488eff7928a..2c3aa9b0885 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 From 6620944f8325101d6a0e01690aea7901a66f0461 Mon Sep 17 00:00:00 2001 From: Nicolas Richard Date: Tue, 23 Feb 2016 14:38:30 +1100 Subject: [PATCH 5/5] (cl-union): Do not ignore :test argument when lists are equal. * cl-seq.el (cl-union): Do not ignore :test argument when lists are equal. * test/automated/cl-seq-tests.el: New file (bug#22729). --- lisp/emacs-lisp/cl-seq.el | 2 +- test/automated/cl-seq-tests.el | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/automated/cl-seq-tests.el 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/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