commit 9824885fabea53f8c4461d038f4c1edad1b8f591 (HEAD, refs/remotes/origin/master) Author: tino calancha Date: Sun Jan 28 13:05:54 2018 +0900 Code refactoring assoc-delete-all assq-delete-all * lisp/subr.el (assoc-delete-all): Add optional arg TEST. (assq-delete-all): Use assoc-delete-all. * test/lisp/subr-tests.el (subr-tests--assoc-delete-all) (subr-tests--assq-delete-all): New tests. * doc/lispref/lists.texi (Association Lists): Document assoc-delete-all in the manual. ; * etc/NEWS: Announce assoc-delete-all. diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 3e2dd13c70..761750eb20 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1733,6 +1733,14 @@ alist @end example @end defun +@defun assoc-delete-all key alist &optional test +This function is like @code{assq-delete-all} except that it accepts +an optional argument @var{test}, a predicate function to compare the +keys in @var{alist}. If omitted or @code{nil}, @var{test} defaults to +@code{equal}. As @code{assq-delete-all}, this function often modifies +the original list structure of @var{alist}. +@end defun + @defun rassq-delete-all value alist This function deletes from @var{alist} all the elements whose @sc{cdr} is @code{eq} to @var{value}. It returns the shortened alist, and diff --git a/etc/NEWS b/etc/NEWS index 27bde2d147..2888acd4dc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -223,6 +223,9 @@ as new-style, bind the new variable 'force-new-style-backquotes' to t. * Lisp Changes in Emacs 27.1 ++++ +** New function assoc-delete-all. + ** 'print-quoted' now defaults to t, so if you want to see (quote x) instead of 'x you will have to bind it to nil where applicable. diff --git a/lisp/subr.el b/lisp/subr.el index 092850a44d..e7a0ffc5be 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -705,17 +705,19 @@ Non-strings in LIST are ignored." (setq list (cdr list))) list) -(defun assoc-delete-all (key alist) - "Delete from ALIST all elements whose car is `equal' to KEY. +(defun assoc-delete-all (key alist &optional test) + "Delete from ALIST all elements whose car is KEY. +Compare keys with TEST. Defaults to `equal'. Return the modified alist. Elements of ALIST that are not conses are ignored." + (unless test (setq test #'equal)) (while (and (consp (car alist)) - (equal (car (car alist)) key)) + (funcall test (caar alist) key)) (setq alist (cdr alist))) (let ((tail alist) tail-cdr) (while (setq tail-cdr (cdr tail)) (if (and (consp (car tail-cdr)) - (equal (car (car tail-cdr)) key)) + (funcall test (caar tail-cdr) key)) (setcdr tail (cdr tail-cdr)) (setq tail tail-cdr)))) alist) @@ -724,16 +726,7 @@ Elements of ALIST that are not conses are ignored." "Delete from ALIST all elements whose car is `eq' to KEY. Return the modified alist. Elements of ALIST that are not conses are ignored." - (while (and (consp (car alist)) - (eq (car (car alist)) key)) - (setq alist (cdr alist))) - (let ((tail alist) tail-cdr) - (while (setq tail-cdr (cdr tail)) - (if (and (consp (car tail-cdr)) - (eq (car (car tail-cdr)) key)) - (setcdr tail (cdr tail-cdr)) - (setq tail tail-cdr)))) - alist) + (assoc-delete-all key alist #'eq)) (defun rassq-delete-all (value alist) "Delete from ALIST all elements whose cdr is `eq' to VALUE. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index efafdcf832..d0b3127f71 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -26,7 +26,6 @@ ;; ;;; Code: - (require 'ert) (eval-when-compile (require 'cl-lib)) @@ -307,5 +306,24 @@ cf. Bug#25477." (should (eq (string-to-char (symbol-name (gensym))) ?g)) (should (eq (string-to-char (symbol-name (gensym "X"))) ?X))) +(ert-deftest subr-tests--assq-delete-all () + "Test `assq-delete-all' behavior." + (cl-flet ((new-list-fn + () + (list (cons 'a 1) (cons 'b 2) (cons 'c 3) 'd (cons "foo" "bar")))) + (should (equal (cdr (new-list-fn)) (assq-delete-all 'a (new-list-fn)))) + (should (equal (new-list-fn) (assq-delete-all 'd (new-list-fn)))) + (should (equal (new-list-fn) (assq-delete-all "foo" (new-list-fn)))))) + +(ert-deftest subr-tests--assoc-delete-all () + "Test `assoc-delete-all' behavior." + (cl-flet ((new-list-fn + () + (list (cons 'a 1) (cons 'b 2) (cons 'c 3) 'd (cons "foo" "bar")))) + (should (equal (cdr (new-list-fn)) (assoc-delete-all 'a (new-list-fn)))) + (should (equal (new-list-fn) (assoc-delete-all 'd (new-list-fn)))) + (should (equal (butlast (new-list-fn)) + (assoc-delete-all "foo" (new-list-fn)))))) + (provide 'subr-tests) ;;; subr-tests.el ends here commit 26ee371d6dc7bd650db003a3bb62c11474373036 Author: Simen Heggestøyl Date: Sat Jan 27 18:03:49 2018 +0100 Fix indentation bug with multi-line CSS values * lisp/textmodes/css-mode.el (css-smie-rules): Fix indentation of multi-line CSS values that are separated by spaces. * test/manual/indent/css-mode.css: Add a test case for the fix. diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 7e997ac2c0..6bd08f5919 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1215,7 +1215,8 @@ for determining whether point is within a selector." (pcase (cons kind token) (`(:elem . basic) css-indent-offset) (`(:elem . arg) 0) - (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). + ;; "" stands for BOB (bug#15467). + (`(:list-intro . ,(or `";" `"" `":-property")) t) (`(:before . "{") (when (or (smie-rule-hanging-p) (smie-rule-bolp)) (smie-backward-sexp ";") diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css index 640418b022..ecf6c3c0ca 100644 --- a/test/manual/indent/css-mode.css +++ b/test/manual/indent/css-mode.css @@ -56,6 +56,8 @@ div::before { sans-serif; font: 15px "Helvetica Neue", Helvetica, Arial, "Nimbus Sans L", sans-serif; + background: no-repeat right + 5px center; transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); commit 848797ada4bc885e145bcace6a4b2cf4ed324216 Author: Alan Third Date: Tue Jan 9 23:47:56 2018 +0000 Allow configure to find Homebrew installed imagemagick * configure.ac: Add the imagemagick pkgconfig dir to pkg-config's search path. diff --git a/configure.ac b/configure.ac index eb7e5ee260..a09ae6a592 100644 --- a/configure.ac +++ b/configure.ac @@ -1269,10 +1269,10 @@ AC_SUBST([PAXCTL_notdumped]) # Makeinfo on macOS is ancient, check whether there is a more recent # version installed by Homebrew. -AC_CHECK_PROG(HAVE_BREW, [brew], [yes]) -if test -n "$HAVE_BREW"; then +AC_CHECK_PROGS(BREW, [brew]) +if test -n "$BREW"; then AC_PATH_PROG([MAKEINFO], [makeinfo], [], - [`brew --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH]) + [`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH]) fi ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals. @@ -2535,6 +2535,12 @@ fi HAVE_IMAGEMAGICK=no if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_imagemagick}" != "no"; then + if test -n "$BREW"; then + # Homebrew doesn't link ImageMagick 6 by default, so make sure + # pkgconfig can find it. + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH$PATH_SEPARATOR`$BREW --prefix imagemagick@6 2>/dev/null`/lib/pkgconfig" + fi + ## 6.3.5 is the earliest version known to work; see Bug#17339. ## 6.8.2 makes Emacs crash; see Bug#13867. ## 7 and later have not been ported to; See Bug#25967.