commit 65990f47ccd6f1a3558910d71701a6f029c35433 (HEAD, refs/remotes/origin/master) Author: Simen Heggestøyl Date: Sun Apr 19 08:03:21 2020 +0200 Use lexical-binding in elide-head.el and add tests * lisp/elide-head.el: Use lexical-binding. (elide-head-headers-to-hide): Remove redundant :group arg. (elide-head-overlay): Use `defvar-local'. (elide-head-show): Fix docstring. * test/lisp/elide-head-tests.el: New file with tests for elide-head.el. diff --git a/lisp/elide-head.el b/lisp/elide-head.el index 2c42a191e0..a892754d72 100644 --- a/lisp/elide-head.el +++ b/lisp/elide-head.el @@ -1,4 +1,4 @@ -;;; elide-head.el --- hide headers in files +;;; elide-head.el --- hide headers in files -*- lexical-binding: t; -*- ;; Copyright (C) 1999, 2001-2020 Free Software Foundation, Inc. @@ -63,12 +63,10 @@ The cars of elements of the list are searched for in order. Text is elided with an invisible overlay from the end of the line where the first match is found to the end of the match for the corresponding cdr." - :group 'elide-head :type '(alist :key-type (regexp :tag "Start regexp") :value-type (regexp :tag "End regexp"))) -(defvar elide-head-overlay nil) -(make-variable-buffer-local 'elide-head-overlay) +(defvar-local elide-head-overlay nil) ;;;###autoload (defun elide-head (&optional arg) @@ -108,7 +106,7 @@ This is suitable as an entry on `find-file-hook' or appropriate mode hooks." (overlay-put elide-head-overlay 'after-string "..."))))))) (defun elide-head-show () - "Show a header elided current buffer by \\[elide-head]." + "Show a header in the current buffer elided by \\[elide-head]." (interactive) (if (and (overlayp elide-head-overlay) (overlay-buffer elide-head-overlay)) diff --git a/test/lisp/elide-head-tests.el b/test/lisp/elide-head-tests.el new file mode 100644 index 0000000000..c9ef26a818 --- /dev/null +++ b/test/lisp/elide-head-tests.el @@ -0,0 +1,62 @@ +;;; elide-head-tests.el --- Tests for elide-head.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl +;; Keywords: + +;; 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 'elide-head) +(require 'ert) + +(ert-deftest elide-head-tests-elide-head () + (let ((elide-head-headers-to-hide '(("START" . "END")))) + (with-temp-buffer + (insert "foo\nSTART\nHIDDEN\nEND\nbar") + (elide-head) + (let ((o (car (overlays-at 14)))) + (should (= (overlay-start o) 10)) + (should (= (overlay-end o) 21)) + (should (overlay-get o 'invisible)) + (should (overlay-get o 'evaporate)))))) + +(ert-deftest elide-head-tests-elide-head-with-prefix-arg () + (let ((elide-head-headers-to-hide '(("START" . "END")))) + (with-temp-buffer + (insert "foo\nSTART\nHIDDEN\nEND\nbar") + (elide-head) + (should (overlays-at 14)) + (elide-head t) + (should-not (overlays-at 14))))) + +(ert-deftest elide-head-tests-show () + (let ((elide-head-headers-to-hide '(("START" . "END")))) + (with-temp-buffer + (insert "foo\nSTART\nHIDDEN\nEND\nbar") + (elide-head) + (should (overlays-at 14)) + (elide-head-show) + (should-not (overlays-at 14))))) + +(provide 'elide-head-tests) +;;; elide-head-tests.el ends here commit 8f0f8516501e64348994334cdab8b211f1cfd731 Author: Stefan Kangas Date: Sun Apr 19 02:32:36 2020 +0200 * lisp/autoarg.el: Use lexical binding. diff --git a/lisp/autoarg.el b/lisp/autoarg.el index c0307aa92b..eba7a187fa 100644 --- a/lisp/autoarg.el +++ b/lisp/autoarg.el @@ -1,4 +1,4 @@ -;;; autoarg.el --- make digit keys supply prefix args +;;; autoarg.el --- make digit keys supply prefix args -*- lexical-binding: t -*- ;; Copyright (C) 1998, 2000-2020 Free Software Foundation, Inc. commit d890e5b73a06decd4d60eea82a5a7a2554013cbc Author: Ahmed Khanzada Date: Sat Apr 18 12:15:17 2020 -0700 Fix misnamed variable breaking GNUstep * src/nsterm.m (ns_set_offset): Use correct variable. diff --git a/src/nsterm.m b/src/nsterm.m index 9cd1c9d860..5eb44639f5 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1875,7 +1875,7 @@ Hide the window (X11 semantics) FIXME: Surely there's a better way than just hardcoding 100 in here? */ - boundsRect.origin.x = 100; + topLeft.x = 100; #endif } commit 45d42f81621743a96f209102464432ef2f230b0f Author: Simen Heggestøyl Date: Sat Apr 18 18:36:49 2020 +0200 Use lexical-binding in apropos.el and add tests * lisp/apropos.el: Use lexical-binding and remove redundant :group args. (apropos-words-to-regexp, apropos): Tweak docstrings. (apropos-value-internal): Replace '(if x (progn y))' with '(when x y)'. (apropos-format-plist): Add docstring and replace '(if x (progn y))' with '(when x y)'. * test/lisp/apropos-tests.el: New file with tests for apropos.el. diff --git a/lisp/apropos.el b/lisp/apropos.el index 7277319cd8..e40f94ccb8 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -1,4 +1,4 @@ -;;; apropos.el --- apropos commands for users and programmers +;;; apropos.el --- apropos commands for users and programmers -*- lexical-binding: t -*- ;; Copyright (C) 1989, 1994-1995, 2001-2020 Free Software Foundation, ;; Inc. @@ -82,49 +82,41 @@ commands also has an optional argument to request a more extensive search. Additionally, this option makes the function `apropos-library' include key-binding information in its output." - :group 'apropos :type 'boolean) (defface apropos-symbol '((t (:inherit bold))) "Face for the symbol name in Apropos output." - :group 'apropos :version "24.3") (defface apropos-keybinding '((t (:inherit underline))) "Face for lists of keybinding in Apropos output." - :group 'apropos :version "24.3") (defface apropos-property '((t (:inherit font-lock-builtin-face))) "Face for property name in Apropos output, or nil for none." - :group 'apropos :version "24.3") (defface apropos-function-button '((t (:inherit (font-lock-function-name-face button)))) "Button face indicating a function, macro, or command in Apropos." - :group 'apropos :version "24.3") (defface apropos-variable-button '((t (:inherit (font-lock-variable-name-face button)))) "Button face indicating a variable in Apropos." - :group 'apropos :version "24.3") (defface apropos-user-option-button '((t (:inherit (font-lock-variable-name-face button)))) "Button face indicating a user option in Apropos." - :group 'apropos :version "24.4") (defface apropos-misc-button '((t (:inherit (font-lock-constant-face button)))) "Button face indicating a miscellaneous object type in Apropos." - :group 'apropos :version "24.3") (defcustom apropos-match-face 'match @@ -132,14 +124,12 @@ include key-binding information in its output." This applies when you look for matches in the documentation or variable value for the pattern; the part that matches gets displayed in this font." :type '(choice (const nil) face) - :group 'apropos :version "24.3") (defcustom apropos-sort-by-scores nil "Non-nil means sort matches by scores; best match is shown first. This applies to all `apropos' commands except `apropos-documentation'. If value is `verbose', the computed score is shown for each match." - :group 'apropos :type '(choice (const :tag "off" nil) (const :tag "on" t) (const :tag "show scores" verbose))) @@ -148,7 +138,6 @@ If value is `verbose', the computed score is shown for each match." "Non-nil means sort matches by scores; best match is shown first. This applies to `apropos-documentation' only. If value is `verbose', the computed score is shown for each match." - :group 'apropos :type '(choice (const :tag "off" nil) (const :tag "on" t) (const :tag "show scores" verbose))) @@ -352,7 +341,7 @@ before finding a label." (defun apropos-words-to-regexp (words wild) - "Make regexp matching any two of the words in WORDS. + "Return a regexp matching any two of the words in WORDS. WILD should be a subexpression matching wildcards between matches." (setq words (delete-dups (copy-sequence words))) (if (null (cdr words)) @@ -644,7 +633,7 @@ search for matches for any two (or more) of those words. With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, consider all symbols (if they match PATTERN). -Returns list of symbols and documentation found." +Return list of symbols and documentation found." (interactive (list (apropos-read-pattern "symbol") current-prefix-arg)) (setq apropos--current (list #'apropos pattern do-all)) @@ -921,16 +910,14 @@ Returns list of symbols and documentation found." (defun apropos-value-internal (predicate symbol function) - (if (funcall predicate symbol) - (progn - (setq symbol (prin1-to-string (funcall function symbol))) - (if (string-match apropos-regexp symbol) - (progn - (if apropos-match-face - (put-text-property (match-beginning 0) (match-end 0) - 'face apropos-match-face - symbol)) - symbol))))) + (when (funcall predicate symbol) + (setq symbol (prin1-to-string (funcall function symbol))) + (when (string-match apropos-regexp symbol) + (if apropos-match-face + (put-text-property (match-beginning 0) (match-end 0) + 'face apropos-match-face + symbol)) + symbol))) (defun apropos-documentation-internal (doc) (cond @@ -952,6 +939,10 @@ Returns list of symbols and documentation found." doc)))) (defun apropos-format-plist (pl sep &optional compare) + "Return a string representation of the plist PL. +Paired elements are separated by the string SEP. Only include +properties matching the current `apropos-regexp' when COMPARE is +non-nil." (setq pl (symbol-plist pl)) (let (p p-out) (while pl @@ -960,13 +951,12 @@ Returns list of symbols and documentation found." (put-text-property 0 (length (symbol-name (car pl))) 'face 'apropos-property p) (setq p nil)) - (if p - (progn - (and compare apropos-match-face - (put-text-property (match-beginning 0) (match-end 0) - 'face apropos-match-face - p)) - (setq p-out (concat p-out (if p-out sep) p)))) + (when p + (and compare apropos-match-face + (put-text-property (match-beginning 0) (match-end 0) + 'face apropos-match-face + p)) + (setq p-out (concat p-out (if p-out sep) p))) (setq pl (nthcdr 2 pl))) p-out)) diff --git a/test/lisp/apropos-tests.el b/test/lisp/apropos-tests.el new file mode 100644 index 0000000000..4c5522d14c --- /dev/null +++ b/test/lisp/apropos-tests.el @@ -0,0 +1,133 @@ +;;; apropos-tests.el --- Tests for apropos.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl +;; Keywords: + +;; 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 'apropos) +(require 'ert) + +(ert-deftest apropos-tests-words-to-regexp-1 () + (let ((re (apropos-words-to-regexp '("foo" "bar") "baz"))) + (should (string-match-p re "foobazbar")) + (should (string-match-p re "barbazfoo")) + (should-not (string-match-p re "foo-bar")) + (should-not (string-match-p re "foobazbazbar")))) + +(ert-deftest apropos-tests-words-to-regexp-2 () + (let ((re (apropos-words-to-regexp '("foo" "bar" "baz") "-"))) + (should-not (string-match-p re "foo")) + (should-not (string-match-p re "foobar")) + (should (string-match-p re "foo-bar")) + (should (string-match-p re "foo-baz")))) + +(ert-deftest apropos-tests-parse-pattern-1 () + (apropos-parse-pattern '("foo")) + (should (string-match-p apropos-regexp "foo")) + (should (string-match-p apropos-regexp "foo-bar")) + (should (string-match-p apropos-regexp "bar-foo")) + (should (string-match-p apropos-regexp "foo-foo")) + (should-not (string-match-p apropos-regexp "bar"))) + +(ert-deftest apropos-tests-parse-pattern-2 () + (apropos-parse-pattern '("foo" "bar")) + (should (string-match-p apropos-regexp "foo-bar")) + (should (string-match-p apropos-regexp "bar-foo")) + (should-not (string-match-p apropos-regexp "foo")) + (should-not (string-match-p apropos-regexp "bar")) + (should-not (string-match-p apropos-regexp "baz")) + (should-not (string-match-p apropos-regexp "foo-foo")) + (should-not (string-match-p apropos-regexp "bar-bar"))) + +(ert-deftest apropos-tests-parse-pattern-3 () + (apropos-parse-pattern '("foo" "bar" "baz")) + (should (string-match-p apropos-regexp "foo-bar")) + (should (string-match-p apropos-regexp "foo-baz")) + (should (string-match-p apropos-regexp "bar-foo")) + (should (string-match-p apropos-regexp "bar-baz")) + (should (string-match-p apropos-regexp "baz-foo")) + (should (string-match-p apropos-regexp "baz-bar")) + (should-not (string-match-p apropos-regexp "foo")) + (should-not (string-match-p apropos-regexp "bar")) + (should-not (string-match-p apropos-regexp "baz")) + (should-not (string-match-p apropos-regexp "foo-foo")) + (should-not (string-match-p apropos-regexp "bar-bar")) + (should-not (string-match-p apropos-regexp "baz-baz"))) + +(ert-deftest apropos-tests-parse-pattern-single-regexp () + (apropos-parse-pattern "foo+bar") + (should-not (string-match-p apropos-regexp "fobar")) + (should (string-match-p apropos-regexp "foobar")) + (should (string-match-p apropos-regexp "fooobar"))) + +(ert-deftest apropos-tests-parse-pattern-synonyms () + (let ((apropos-synonyms '(("find" "open" "edit")))) + (apropos-parse-pattern '("open")) + (should (string-match-p apropos-regexp "find-file")) + (should (string-match-p apropos-regexp "open-file")) + (should (string-match-p apropos-regexp "edit-file")))) + +(ert-deftest apropos-tests-calc-scores () + (let ((str "Return apropos score for string STR.")) + (should (equal (apropos-calc-scores str '("apr")) '(7))) + (should (equal (apropos-calc-scores str '("apr" "str")) '(25 7))) + (should (equal (apropos-calc-scores str '("appr" "str")) '(25))) + (should-not (apropos-calc-scores str '("appr" "strr"))))) + +(ert-deftest apropos-tests-score-str () + (apropos-parse-pattern '("foo" "bar")) + (should (< (apropos-score-str "baz") + (apropos-score-str "foo baz") + (apropos-score-str "foo bar baz")))) + +(ert-deftest apropos-tests-score-doc () + (apropos-parse-pattern '("foo" "bar")) + (should (< (apropos-score-doc "baz") + (apropos-score-doc "foo baz") + (apropos-score-doc "foo bar baz")))) + +(ert-deftest apropos-tests-score-symbol () + (apropos-parse-pattern '("foo" "bar")) + (should (< (apropos-score-symbol 'baz) + (apropos-score-symbol 'foo-baz) + (apropos-score-symbol 'foo-bar-baz)))) + +(ert-deftest apropos-tests-true-hit () + (should-not (apropos-true-hit "foo" '("foo" "bar"))) + (should (apropos-true-hit "foo bar" '("foo" "bar"))) + (should (apropos-true-hit "foo bar baz" '("foo" "bar")))) + +(ert-deftest apropos-tests-format-plist () + (setplist 'foo '(a 1 b (2 3) c nil)) + (apropos-parse-pattern '("b")) + (should (equal (apropos-format-plist 'foo ", ") + "a 1, b (2 3), c nil")) + (should (equal (apropos-format-plist 'foo ", " t) + "b (2 3)")) + (apropos-parse-pattern '("d")) + (should-not (apropos-format-plist 'foo ", " t))) + +(provide 'apropos-tests) +;;; apropos-tests.el ends here commit 4819bea6900348f923e0de58995ec41760993b6c Merge: 9dac60b1bf f3b62b6c62 Author: Glenn Morris Date: Sat Apr 18 07:50:22 2020 -0700 Merge from origin/emacs-27 f3b62b6c62 (origin/emacs-27) Avoid crashes in regex-emacs.c due to GC 175c61c18b Fix "C-u M-!" when 'shell-command-dont-erase-buffer' is no... 6b297519b5 Fix cl-most-positive-float doc typo c36c5a3ded ; lisp/ldefs-boot.el: Update. 3876a60569 Fix a typo in calculator.el 9e832ba91b * lisp/erc/erc.el: Add URL to the new ERC page on the Emac... # Conflicts: # etc/NEWS commit 9dac60b1bf449cc42fe77bc4f3a85bad55afa00f Merge: 2a4cb2459b 399c20d2e0 Author: Glenn Morris Date: Sat Apr 18 07:50:18 2020 -0700 ; Merge from origin/emacs-27 The following commit was skipped: 399c20d2e0 Bump Emacs version to 27.0.91 commit 2a4cb2459b7c72ea66762a4f62ae8f0a31dec8e3 Merge: a6c391080b 145a151d62 Author: Glenn Morris Date: Sat Apr 18 07:50:18 2020 -0700 Merge from origin/emacs-27 145a151d62 Correct Fido-mode's backspacing of directories with spaces 660b9b8cfb Default completion-flex-nospace to nil fb5f616ae8 Improve an example in w32 FAQ commit a6c391080b04d21386136f1a36011284f41ae6ea Merge: d345c718ce 0ed7177696 Author: Glenn Morris Date: Sat Apr 18 07:50:18 2020 -0700 ; Merge from origin/emacs-27 The following commit was skipped: 0ed7177696 * lisp/htmlfontify.el (hfy-force-fontification): Fix bug#4... commit d345c718cef69bf32deecc7bf790c6595e8aae8c Author: Eli Zaretskii Date: Sat Apr 18 16:29:33 2020 +0300 Safeguard the fix of bug#40632 * src/xdisp.c (move_it_to): Restrict the recent fix to iteration through buffer text. diff --git a/src/xdisp.c b/src/xdisp.c index abbe882649..01f272033e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9898,9 +9898,13 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos This could happen when the first display element is wider than the window, or if we have a wrap-prefix that doesn't leave enough space after it to display - even a single character. */ + even a single character. We only do this for moving + through buffer text, as with display/overlay strings + we'd need to also compare it->object's, and this is + unlikely to happen in that case anyway. */ if (IT_CHARPOS (*it) == orig_charpos - && it->method == orig_method) + && it->method == orig_method + && orig_method == GET_FROM_BUFFER) set_iterator_to_next (it, false); it->continuation_lines_width += it->current_x; } commit f3b62b6c62c41d2e5d15418ea940bce6b11bdf7d Author: Eli Zaretskii Date: Sat Apr 18 14:53:13 2020 +0300 Avoid crashes in regex-emacs.c due to GC * src/regex-emacs.c (re_match_2_internal): Prevent GC from invalidating C pointers to buffer text. (Bug#40661) diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 694431c95e..f456b49539 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -3853,6 +3853,12 @@ re_match_2 (struct re_pattern_buffer *bufp, return result; } +static void +unwind_re_match (void *ptr) +{ + struct buffer *b = (struct buffer *) ptr; + b->text->inhibit_shrinking = 0; +} /* This is a separate function so that we can force an alloca cleanup afterwards. */ @@ -3949,6 +3955,19 @@ re_match_2_internal (struct re_pattern_buffer *bufp, INIT_FAIL_STACK (); + ptrdiff_t count = SPECPDL_INDEX (); + + /* Prevent shrinking and relocation of buffer text if GC happens + while we are inside this function. The calls to + UPDATE_SYNTAX_TABLE_* macros can trigger GC if they call Lisp, + and we have C pointers to buffer text that must not become + invalid as result of GC. */ + if (!current_buffer->text->inhibit_shrinking) + { + record_unwind_protect_ptr (unwind_re_match, current_buffer); + current_buffer->text->inhibit_shrinking = 1; + } + /* Do not bother to initialize all the register variables if there are no groups in the pattern, as it takes a fair amount of time. If there are groups, we include space for register 0 (the whole @@ -3965,6 +3984,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, /* The starting position is bogus. */ if (pos < 0 || pos > size1 + size2) { + unbind_to (count, Qnil); SAFE_FREE (); return -1; } @@ -4179,6 +4199,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, DEBUG_PRINT ("Returning %td from re_match_2.\n", dcnt); + unbind_to (count, Qnil); SAFE_FREE (); return dcnt; } @@ -5025,6 +5046,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, if (best_regs_set) goto restore_best_regs; + unbind_to (count, Qnil); SAFE_FREE (); return -1; /* Failure to match. */ commit 13210712a06a53031cfb82ec5dc0ab5f8e720668 Author: Eli Zaretskii Date: Sat Apr 18 12:57:08 2020 +0300 Don't abort when using GDI+ for images * src/w32image.c (decode_delay): Instead of aborting when the type of delay value is unrecognized, return an invalid negative value. diff --git a/src/w32image.c b/src/w32image.c index 95d8ddfe11..31c9b852ac 100644 --- a/src/w32image.c +++ b/src/w32image.c @@ -214,30 +214,37 @@ enum PropertyItem_type { PI_LONG_PAIR = 10 }; -static unsigned long +static double decode_delay (PropertyItem *propertyItem, int frame) { enum PropertyItem_type type = propertyItem[0].type; - unsigned long delay; + unsigned long udelay; + double retval; switch (type) { case PI_BYTE: case PI_BYTE_ANY: - delay = ((unsigned char *)propertyItem[0].value)[frame]; + udelay = ((unsigned char *)propertyItem[0].value)[frame]; + retval = udelay; break; case PI_USHORT: - delay = ((unsigned short *)propertyItem[0].value)[frame]; + udelay = ((unsigned short *)propertyItem[0].value)[frame]; + retval = udelay; break; case PI_ULONG: case PI_LONG: /* delay should always be positive */ - delay = ((unsigned long *)propertyItem[0].value)[frame]; + udelay = ((unsigned long *)propertyItem[0].value)[frame]; + retval = udelay; break; default: - emacs_abort (); + /* This negative value will cause the caller to disregard the + delay if we cannot determine it reliably. */ + add_to_log ("Invalid or unknown propertyItem type in w32image.c"); + retval = -1.0; } - return delay; + return retval; } static double commit a0c8c274d354f3901f076d163d3828ae55d13a2d Author: Juan José García-Ripoll Date: Sat Apr 18 10:41:42 2020 +0200 Fix loading multi-frame TIFF images via GDI+ * src/w32image.c (w32_frame_delay): Don't try to compute frame delay if GdipGetPropertyItemSize fails for PropertyTagFrameDelay. (w32_load_image): Don't add 'delay' member to metadata if the delay could not be determined. diff --git a/src/w32image.c b/src/w32image.c index 0a2a55d3f6..95d8ddfe11 100644 --- a/src/w32image.c +++ b/src/w32image.c @@ -245,27 +245,33 @@ w32_frame_delay (GpBitmap *pBitmap, int frame) { UINT size; PropertyItem *propertyItem; - double delay = 0.0; + double delay = -1.0; /* Assume that the image has a property item of type PropertyItemEquipMake. - Get the size of that property item. */ - GdipGetPropertyItemSize (pBitmap, PropertyTagFrameDelay, &size); + Get the size of that property item. This can fail for multi-frame TIFF + images. */ + GpStatus status = GdipGetPropertyItemSize (pBitmap, PropertyTagFrameDelay, + &size); - /* Allocate a buffer to receive the property item. */ - propertyItem = malloc (size); - if (propertyItem != NULL) + if (status == Ok) { - /* Get the property item. */ - GdipGetPropertyItem (pBitmap, PropertyTagFrameDelay, size, propertyItem); - delay = decode_delay (propertyItem, frame); - if (delay <= 0) - { - /* In GIF files, unfortunately, delay is only specified for the first - frame. */ - delay = decode_delay (propertyItem, 0); - } - delay /= 100.0; - free (propertyItem); + /* Allocate a buffer to receive the property item. */ + propertyItem = malloc (size); + if (propertyItem != NULL) + { + /* Get the property item. */ + GdipGetPropertyItem (pBitmap, PropertyTagFrameDelay, size, + propertyItem); + delay = decode_delay (propertyItem, frame); + if (delay <= 0) + { + /* In GIF files, unfortunately, delay is only specified + for the first frame. */ + delay = decode_delay (propertyItem, 0); + } + delay /= 100.0; + free (propertyItem); + } } return delay; } @@ -372,7 +378,7 @@ w32_load_image (struct frame *f, struct image *img, { if (nframes > 1) metadata = Fcons (Qcount, Fcons (make_fixnum (nframes), metadata)); - if (delay) + if (delay >= 0) metadata = Fcons (Qdelay, Fcons (make_float (delay), metadata)); } else if (status == Win32Error) /* FIXME! */ commit 175c61c18bfaa1d75aa087ba4bd4de3ebfe1a1d6 Author: Eli Zaretskii Date: Sat Apr 18 12:01:26 2020 +0300 Fix "C-u M-!" when 'shell-command-dont-erase-buffer' is non-nil * lisp/simple.el (shell-command-dont-erase-buffer): Clarify the effect of the various values in the doc string. (shell-command-save-pos-or-erase, shell-command): Don't move or push point if the output will go to the current buffer. (Bug#40690) (shell-command): Mention 'shell-command-dont-erase-buffer' in the doc string. * test/lisp/simple-tests.el (with-shell-command-dont-erase-buffer): Don't is shell quoting 'like this', as it doesn't work on MS-Windows; quote "like this" instead. (simple-tests-shell-command-dont-erase-buffer): Adapt the test to the new modus operandi. * doc/emacs/misc.texi (Single Shell): Document the effect of the various values of 'shell-command-dont-erase-buffer'. * etc/NEWS: Expand and reword the entry regarding changes in 'shell-command-dont-erase-buffer'. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index d097f4ee7d..294430aa18 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -740,10 +740,11 @@ creates the file @file{foo} and produces no terminal output. A numeric argument to @code{shell-command}, e.g., @kbd{M-1 M-!}, causes it to insert terminal output into the current buffer instead of -a separate buffer. It puts point before the output, and sets the mark -after the output. For instance, @kbd{M-1 M-! gunzip < foo.gz -@key{RET}} would insert the uncompressed form of the file -@file{foo.gz} into the current buffer. +a separate buffer. By default, it puts point before the output, and +sets the mark after the output (but a non-default value of +@code{shell-command-dont-erase-buffer} can change that, see below). +For instance, @kbd{M-1 M-! gunzip < foo.gz @key{RET}} would insert the +uncompressed form of the file @file{foo.gz} into the current buffer. Provided the specified shell command does not end with @samp{&}, it runs @dfn{synchronously}, and you must wait for it to exit before @@ -829,11 +830,21 @@ inserted into a buffer of that name. By default, the output buffer is erased between shell commands, except when the output goes to the current buffer. If you change the value of the option @code{shell-command-dont-erase-buffer} to @code{erase}, -then the output buffer is always erased. Any other non-@code{nil} -value prevents to erase the output buffer. +then the output buffer is always erased. Other non-@code{nil} values +prevent erasing of the output buffer, and---if the output buffer is +not the current buffer---also control where to put point after +inserting the output of the shell command: -This option also controls where to set the point in the output buffer -after the command completes; see the documentation of the option for details. +@table @code +@item beg-last-out +Puts point at the beginning of the last shell-command output. +@item end-last-out +Puts point at the end of the last shell-command output, i.e.@: at the +end of the output buffer. +@item save-point +Restores the position of point as it was before inserting the +shell-command output. +@end table @node Interactive Shell @subsection Interactive Subshell diff --git a/etc/NEWS b/etc/NEWS index aba3028184..4485bf9165 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2084,12 +2084,17 @@ variable for remote shells. It still defaults to "/bin/sh". ** Single shell commands +++ -*** 'shell-command-dont-erase-buffer' accepts the value 'erase' to -force to erase the output buffer before execution of the command. +*** New values of 'shell-command-dont-erase-buffer'. +This option can now have the value 'erase' to force to erase the +output buffer before execution of the command, even if the output goes +to the current buffer. Additional values 'beg-last-out', +'end-last-out', and 'save-point' control where to put point in the +output buffer after inserting the shell-command output. +--- *** The new functions 'shell-command-save-pos-or-erase' and 'shell-command-set-point-after-cmd' control how point is handled -between two consecutive shell commands in the same buffer. +between two consecutive shell commands in the same output buffer. +++ *** 'async-shell-command-width' defines the number of display columns diff --git a/lisp/simple.el b/lisp/simple.el index ea16d1400c..e3169e523b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3437,20 +3437,22 @@ This affects `shell-command' and `async-shell-command'." :version "27.1") (defcustom shell-command-dont-erase-buffer nil - "Control if the output buffer is erased before the command. + "Whether to erase the output buffer before executing shell command. A nil value erases the output buffer before execution of the shell command, except when the output buffer is the current one. The value `erase' ensures the output buffer is erased before -execution of the shell command. +execution of the shell command even if it is the current buffer. -Other non-nil values prevent the output buffer from being erased and -set the point after execution of the shell command. +Other non-nil values prevent the output buffer from being erased; they +also reposition point in the shell output buffer after execution of the +shell command, except when the output buffer is the current buffer. -The value `beg-last-out' sets point at the beginning of the output, -`end-last-out' sets point at the end of the buffer, `save-point' -restores the buffer position before the command." +The value `beg-last-out' sets point at the beginning of the last +output, `end-last-out' sets point at the end of the last output, +and `save-point' restores the buffer position as it was before the +shell command." :type '(choice (const :tag "Erase output buffer if not the current one" nil) (const :tag "Always erase output buffer" erase) @@ -3480,9 +3482,12 @@ See `shell-command-dont-erase-buffer'." ;; if some text has a non-nil read-only property, ;; which comint sometimes adds for prompts. (setq pos - (cond ((eq sym 'save-point) (point)) - ((eq sym 'beg-last-out) (point-max)) - ;;((not sym) + (cond ((eq sym 'save-point) + (if (not output-to-current-buffer) + (point))) + ((eq sym 'beg-last-out) + (if (not output-to-current-buffer) + (point-max))) ((or (eq sym 'erase) (and (null sym) (not output-to-current-buffer))) (let ((inhibit-read-only t)) @@ -3597,10 +3602,15 @@ says to put the output in some other buffer. If OUTPUT-BUFFER is a buffer or buffer name, erase that buffer and insert the output there; a non-nil value of `shell-command-dont-erase-buffer' prevents the buffer from being -erased. If OUTPUT-BUFFER is not a buffer and not nil, insert the +erased. If OUTPUT-BUFFER is not a buffer and not nil (which happens +interactively when the prefix argument is given), insert the output in current buffer after point leaving mark after it. This cannot be done asynchronously. +The user option `shell-command-dont-erase-buffer', which see, controls +whether the output buffer is erased and where to put point after +the shell command. + If the command terminates without error, but generates output, and you did not specify \"insert it in the current buffer\", the output can be displayed in the echo area or in its buffer. @@ -3688,8 +3698,7 @@ impose the use of a shell (with its need to quote arguments)." ;; because we inserted text. (goto-char (prog1 (mark t) (set-marker (mark-marker) (point) - (current-buffer)))) - (shell-command-set-point-after-cmd)) + (current-buffer))))) ;; Output goes in a separate buffer. ;; Preserve the match data in case called from a program. ;; FIXME: It'd be ridiculous for an Elisp function to call diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 276df795fc..8c477165a4 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -724,7 +724,7 @@ See Bug#21722." (,output-buf (if ,output-buffer-is-current ,caller-buf (generate-new-buffer "output-buf"))) (emacs (expand-file-name invocation-name invocation-directory)) - (,command (format "%s -Q --batch --eval '(princ \"%s\")'" + (,command (format "%s -Q --batch --eval \"(princ \\\"%s\\\")\"" emacs ,str)) (inhibit-message t)) (unwind-protect @@ -761,7 +761,7 @@ See Bug#21722." (expected-point `((beg-last-out . ,(1+ (length str))) (end-last-out . ,(1+ (* 2 (length str)))) (save-point . 1)))) - (dolist (output-buffer-is-current '(t ni)) + (dolist (output-buffer-is-current '(nil)) (with-shell-command-dont-erase-buffer str output-buffer-is-current (when (memq shell-command-dont-erase-buffer '(beg-last-out end-last-out save-point)) (should (= (point) (alist-get shell-command-dont-erase-buffer expected-point)))))))) commit 6b297519b580df27d8721943f55629689b4c83e0 Author: Paul Eggert Date: Fri Apr 17 09:38:04 2020 -0700 Fix cl-most-positive-float doc typo * doc/misc/cl.texi (Implementation Parameters): Fix typo in documentation of cl-most-positive-float. diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index a2cfe61db7..b5f26e004b 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -3128,7 +3128,7 @@ floating-point number, namely the IEEE binary64 floating-point format. @defvar cl-most-positive-float This constant equals the largest finite value a Lisp float can hold. -For IEEE binary64 format, this equals @code{(- (expt 2 1024) (- 2 +For IEEE binary64 format, this equals @code{(- (expt 2 1024) (expt 2 971))}, which equals @code{1.7976931348623157e+308}. @end defvar commit c36c5a3dedbb2e0349be1b6c3b7567ea7b594f1c (tag: refs/tags/emacs-27.0.91) Author: Nicolas Petton Date: Fri Apr 17 12:21:36 2020 +0200 ; lisp/ldefs-boot.el: Update. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index f607f6cd06..8b4d21b3ce 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -27854,7 +27854,7 @@ Directory for additional secondary Rmail files.") (custom-autoload 'rmail-secondary-file-directory "rmail" t) -(defvar rmail-secondary-file-regexp (purecopy "\\.xmail$") "\ +(defvar rmail-secondary-file-regexp (purecopy "\\.xmail\\'") "\ Regexp for which files are secondary Rmail files.") (custom-autoload 'rmail-secondary-file-regexp "rmail" t) @@ -38850,10 +38850,19 @@ Zone out, completely." t nil) ;;;;;; "eshell/em-unix.el" "eshell/em-xtra.el" "facemenu.el" "faces.el" ;;;;;; "files.el" "font-core.el" "font-lock.el" "format.el" "frame.el" ;;;;;; "help.el" "hfy-cmap.el" "ibuf-ext.el" "indent.el" "international/characters.el" -;;;;;; "international/charscript.el" "international/cp51932.el" -;;;;;; "international/eucjp-ms.el" "international/mule-cmds.el" -;;;;;; "international/mule-conf.el" "international/mule.el" "isearch.el" -;;;;;; "jit-lock.el" "jka-cmpr-hook.el" "language/burmese.el" "language/cham.el" +;;;;;; "international/charprop.el" "international/charscript.el" +;;;;;; "international/cp51932.el" "international/eucjp-ms.el" "international/mule-cmds.el" +;;;;;; "international/mule-conf.el" "international/mule.el" "international/uni-bidi.el" +;;;;;; "international/uni-brackets.el" "international/uni-category.el" +;;;;;; "international/uni-combining.el" "international/uni-comment.el" +;;;;;; "international/uni-decimal.el" "international/uni-decomposition.el" +;;;;;; "international/uni-digit.el" "international/uni-lowercase.el" +;;;;;; "international/uni-mirrored.el" "international/uni-name.el" +;;;;;; "international/uni-numeric.el" "international/uni-old-name.el" +;;;;;; "international/uni-special-lowercase.el" "international/uni-special-titlecase.el" +;;;;;; "international/uni-special-uppercase.el" "international/uni-titlecase.el" +;;;;;; "international/uni-uppercase.el" "isearch.el" "jit-lock.el" +;;;;;; "jka-cmpr-hook.el" "language/burmese.el" "language/cham.el" ;;;;;; "language/chinese.el" "language/cyrillic.el" "language/czech.el" ;;;;;; "language/english.el" "language/ethiopic.el" "language/european.el" ;;;;;; "language/georgian.el" "language/greek.el" "language/hebrew.el" commit 3876a605694b7f3053268e1760b3052f5ac451f4 Author: jakub-w Date: Thu Apr 16 13:48:03 2020 -0700 Fix a typo in calculator.el * lisp/calculator.el (calculator-expt): Overflowing exponentiation caused the function to return -1.0e+INF if the base was an odd, negative number, no matter what the exponent was. Copyright-paperwork-exempt: yes diff --git a/lisp/calculator.el b/lisp/calculator.el index c1af26ffcc..6996990814 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -1622,7 +1622,7 @@ To use this, apply a binary operator (evaluate it), then call this." (overflow-error ;; X and Y must be integers, as expt silently returns floating-point ;; infinity on floating-point overflow. - (if (or (natnump x) (zerop (logand x 1))) + (if (or (natnump x) (zerop (logand y 1))) 1.0e+INF -1.0e+INF)))) commit 9e832ba91be19071c12bcb6301920b656a919618 Author: Amin Bandali Date: Thu Apr 16 15:11:11 2020 -0400 * lisp/erc/erc.el: Add URL to the new ERC page on the Emacs site diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index cc5226bf6e..cfde84e19a 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -33,17 +33,8 @@ ;;; Commentary: ;; ERC is a powerful, modular, and extensible IRC client for Emacs. - -;; For more information, see the following URLs: -;; * https://sv.gnu.org/projects/erc/ -;; * https://www.emacswiki.org/emacs/ERC - - - -;; As of 2006-06-13, ERC development is now hosted on Savannah -;; (https://sv.gnu.org/projects/erc). I invite everyone who wants to -;; hack on it to contact me in order to get write -;; access to the shared Arch archive. +;; For more information, visit the ERC page at +;; . ;; Configuration: @@ -75,12 +66,12 @@ (eval-when-compile (require 'subr-x)) (defvar erc-official-location - "https://www.emacswiki.org/emacs/ERC (mailing list: emacs-erc@gnu.org)" + "https://www.gnu.org/software/emacs/erc.html (mailing list: emacs-erc@gnu.org)" "Location of the ERC client on the Internet.") (defgroup erc nil "Emacs Internet Relay Chat client." - :link '(url-link "https://www.emacswiki.org/emacs/ERC") + :link '(url-link "https://www.gnu.org/software/emacs/erc.html") :link '(custom-manual "(erc) Top") :prefix "erc-" :group 'applications) commit 399c20d2e00f5cbb7611bd30567998f6b2cfb5cb Author: Nicolas Petton Date: Thu Apr 16 11:06:14 2020 +0200 Bump Emacs version to 27.0.91 * README: * configure.ac: * msdos/sed2v2.inp: * nt/README.W32: Bump Emacs version. diff --git a/README b/README index 787413df8f..9e4906c734 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Copyright (C) 2001-2020 Free Software Foundation, Inc. See the end of the file for license conditions. -This directory tree holds version 27.0.90 of GNU Emacs, the extensible, +This directory tree holds version 27.0.91 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure.ac b/configure.ac index 73243001ba..76f42ae9e2 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl along with GNU Emacs. If not, see . AC_PREREQ(2.65) dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el. -AC_INIT(GNU Emacs, 27.0.90, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/) +AC_INIT(GNU Emacs, 27.0.91, bug-gnu-emacs@gnu.org, , https://www.gnu.org/software/emacs/) dnl Set emacs_config_options to the options of 'configure', quoted for the shell, dnl and then quoted again for a C string. Separate options with spaces. diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 67b00112dd..3fbfe942e7 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -66,7 +66,7 @@ /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ -/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "27.0.90"/ +/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "27.0.91"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ diff --git a/nt/README.W32 b/nt/README.W32 index 7b4dee08fd..53b3c6b762 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -1,7 +1,7 @@ Copyright (C) 2001-2020 Free Software Foundation, Inc. See the end of the file for license conditions. - Emacs version 27.0.90 for MS-Windows + Emacs version 27.0.91 for MS-Windows This README file describes how to set up and run a precompiled distribution of the latest version of GNU Emacs for MS-Windows. You commit 145a151d62681bb8dda2515652b936c7b3a33877 Author: João Távora Date: Thu Apr 16 09:33:37 2020 +0100 Correct Fido-mode's backspacing of directories with spaces Fixes: bug#40625 * lisp/icomplete.el (icomplete-fido-backward-updir): Use zap-up-to-char. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index ac14a850d4..c12f3901f0 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -300,7 +300,7 @@ if that doesn't produce a completion match." (interactive) (if (and (eq (char-before) ?/) (eq (icomplete--category) 'file)) - (backward-kill-sexp 1) + (zap-up-to-char -1 ?/) (call-interactively 'backward-delete-char))) (defvar icomplete-fido-mode-map commit 660b9b8cfbfff8f94d1e9e0a701d5f94d05d4221 Author: João Távora Date: Wed Apr 15 18:41:53 2020 +0100 Default completion-flex-nospace to nil By default, the flex completion style _does_ match spaces. Fixes: bug#40625 * lisp/icomplete.el (icomplete--fido-mode-setup): Force completion-flex-nospace to nil. * lisp/minibuffer.el (completion-flex-nospace): Default to nil. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 66bc731f67..ac14a850d4 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -329,6 +329,7 @@ if that doesn't produce a completion match." icomplete-show-matches-on-no-input t icomplete-hide-common-prefix nil completion-styles '(flex) + completion-flex-nospace nil completion-category-defaults nil))) ;;;###autoload diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7f5b597542..b81f778eb4 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3607,7 +3607,7 @@ that is non-nil." ;;; "flex" completion, also known as flx/fuzzy/scatter completion ;; Completes "foo" to "frodo" and "farfromsober" -(defcustom completion-flex-nospace t +(defcustom completion-flex-nospace nil "Non-nil if `flex' completion rejects spaces in search pattern." :version "27.1" :type 'boolean) commit fb5f616ae869d1d1ad231f84d1aad4574fd32df4 Author: Eli Zaretskii Date: Wed Apr 15 20:27:12 2020 +0300 Improve an example in w32 FAQ * doc/misc/efaq-w32.texi (Font names): Modify the expression to insert a lits of all installed fonts so as to avoid producing too long lines. Suggested by ndame . diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi index 02e63c7e46..83dd176f98 100644 --- a/doc/misc/efaq-w32.texi +++ b/doc/misc/efaq-w32.texi @@ -942,10 +942,13 @@ To find the XFLD name for a font, you can execute the following in the (x-select-font nil t) @end example -To see a complete list of fonts, execute the following in the -@file{*scratch*} buffer by pressing C-x C-e at the end of the line: +To see a complete list of fonts, execute the following Lisp snippet by +typing it into the @file{*scratch*} buffer and pressing @w{@kbd{C-x +C-e}} at the end of the second line: + @example -(insert (prin1-to-string (x-list-fonts "*"))) +(dolist (font (x-list-fonts "*")) + (insert (format "%s\n" font))) @end example The command line options and frame-parameters for changing the default font commit 0ed7177696c8357f0b50d4c81a1f87e43db27e7c Author: Stefan Monnier Date: Wed Apr 15 12:17:14 2020 -0400 * lisp/htmlfontify.el (hfy-force-fontification): Fix bug#40642 Don't presume that `jit-lock-mode` is enabled. Do not merge to `master`. diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index c0012427ae..08e52d63a2 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -1837,7 +1837,8 @@ fontified. This is a simple convenience wrapper around (when font-lock-defaults ; Silence "interactive use only" warning on Emacs >= 25.1. (with-no-warnings (font-lock-fontify-buffer))))) - ((fboundp #'jit-lock-fontify-now) + ((and (fboundp #'jit-lock-fontify-now) + (bound-and-true-p jit-lock-mode)) (message "hfy jit-lock mode (%S %S)" window-system major-mode) (jit-lock-fontify-now)) (t