From 0947c44306d59883d5b065f1dc7444a475ecde9b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 15:38:19 +0200 Subject: [PATCH 01/24] Add more quote-end characters to sentence-end-base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/textmodes/paragraphs.el (sentence-end-base): Add › and » (bug#36359). --- lisp/textmodes/paragraphs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 1d12e53c10a..3762010985f 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -165,7 +165,7 @@ to obtain the value of this variable." :type '(choice regexp (const :tag "Use default value" nil))) (put 'sentence-end 'safe-local-variable 'string-or-null-p) -(defcustom sentence-end-base "[.?!…‽][]\"'”’)}]*" +(defcustom sentence-end-base "[.?!…‽][]\"'”’)}»›]*" "Regexp matching the basic end of a sentence, not including following space." :group 'paragraphs :type 'string From d34bfbc09cc90ae59ef303d78cc286dd12918d7c Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Tue, 9 Jul 2019 15:51:50 +0200 Subject: [PATCH 02/24] Fix for lisp tagbody indentation * lisp/emacs-lisp/cl-indent.el (lisp-indent-259): Indent PROG better (bug#36552). --- lisp/emacs-lisp/cl-indent.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el index 10af440008d..ad5f31713af 100644 --- a/lisp/emacs-lisp/cl-indent.el +++ b/lisp/emacs-lisp/cl-indent.el @@ -593,7 +593,7 @@ optional\\|rest\\|key\\|allow-other-keys\\|aux\\|whole\\|body\\|environment\ (null (cdr method))) (lisp-indent-report-bad-format method)) - (cond ((and tail (not (consp tem))) + (cond ((and tail (not (or (consp tem) (symbolp tem)))) ;; indent tail of &rest in same way as first elt of rest (throw 'exit normal-indent)) ((eq tem '&body) From ed133a09706a68b311e090843049fdb93a883866 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 16:34:20 +0200 Subject: [PATCH 03/24] .har files are JSON files * lisp/files.el (auto-mode-alist): Map .har files to javascript-mode (bug#35407). --- lisp/files.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/files.el b/lisp/files.el index 05150ac0214..e8a44af8ea5 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2720,6 +2720,8 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\)\\'" . archive-mo ("\\.dtd\\'" . sgml-mode) ("\\.ds\\(ss\\)?l\\'" . dsssl-mode) ("\\.js[mx]?\\'" . javascript-mode) + ;; https://en.wikipedia.org/wiki/.har + ("\\.har\\'" . javascript-mode) ("\\.json\\'" . javascript-mode) ("\\.[ds]?vh?\\'" . verilog-mode) ("\\.by\\'" . bovine-grammar-mode) From 93bd422ecec2519c5f3d0df73c0ac9cc7b18442b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 9 Jul 2019 18:04:29 +0300 Subject: [PATCH 04/24] Unbreak the MS-Windows build * src/font.c (open): Don't undef on WINDOWSNT, as ms-w32.h redirects it to sys_open. --- src/font.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/font.c b/src/font.c index 457f3f99583..ffd50644930 100644 --- a/src/font.c +++ b/src/font.c @@ -46,7 +46,9 @@ along with GNU Emacs. If not, see . */ /* Avoid macro definition of `open' in generated lib/fcntl.h to mess up use of it as a struct member. */ +#ifndef WINDOWSNT #undef open +#endif #define DEFAULT_ENCODING Qiso8859_1 From c9142f414bfd5fe10977353361e7b2a6330a6260 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 16:28:57 +0200 Subject: [PATCH 05/24] Make the manual say what undo-auto-amalgamate does * doc/lispref/text.texi (Undo): Say what undo-auto-amalgamate does in addition to describing what amalgamation is (bug#35344). --- doc/lispref/text.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index ca0dd6642d9..94b94eaba7e 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1408,6 +1408,10 @@ Where a command affects the contents of several buffers, as may happen, for example, when a function on the @code{post-command-hook} affects a buffer other than the @code{current-buffer}, then @code{undo-boundary} will be called in each of the affected buffers. + +This function can be called before an amalgamating command. It +removes the previous @code{undo-boundary} if a series of such calls +have been made. @end defun @defvar undo-auto-current-boundary-timer From f3bd296a3e00628793d1c2f22f13e81700cbb14d Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 16:43:02 +0200 Subject: [PATCH 06/24] Make two variables for extended command suggestions mention each other * lisp/simple.el (suggest-key-bindings): (extended-command-suggest-shorter): Mention each other, because they are vaguely related (bug#35309). --- lisp/simple.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 5f27b75a4c7..983a3b6973d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1784,14 +1784,18 @@ to get different commands to edit and resubmit." (defcustom suggest-key-bindings t "Non-nil means show the equivalent key-binding when M-x command has one. The value can be a length of time to show the message for. -If the value is non-nil and not a number, we wait 2 seconds." +If the value is non-nil and not a number, we wait 2 seconds. + +Also see `extended-command-suggest-shorter'." :group 'keyboard :type '(choice (const :tag "off" nil) (integer :tag "time" 2) (other :tag "on"))) (defcustom extended-command-suggest-shorter t - "If non-nil, show a shorter M-x invocation when there is one." + "If non-nil, show a shorter M-x invocation when there is one. + +Also see `suggest-key-bindings'." :group 'keyboard :type 'boolean :version "26.1") From 1a1b5f9802577a09317dd036ccefba4222702f4f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 17:13:38 +0200 Subject: [PATCH 07/24] Add a really simple nadvice example * doc/lispref/functions.texi (Advising Functions): Add a really trivial and simple example (bug#35250). --- doc/lispref/functions.texi | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index ab07d389282..6eb1af68de0 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1578,8 +1578,26 @@ primitives being @code{add-function} and @code{remove-function}) and another set layered on top of it for named functions (with the main primitives being @code{advice-add} and @code{advice-remove}). -For example, in order to trace the calls to the process filter of a process -@var{proc}, you could use: +As a trivial example, here's how to add advice that'll modify the +return value of a function every time it's called: + +@example +(defun my-double (x) + (* x 2)) +(defun my-increase (x) + (+ x 1)) +(advice-add 'my-double :filter-return #'my-increase) +@end example + +After adding this advice, if you call @code{my-double} with @samp{3}, +the return value will be @samp{7}. To remove this advice, say + +@example +(advice-remove 'my-double #'my-increase) +@end example + +A more advanced example would be to trace the calls to the process +filter of a process @var{proc}: @example (defun my-tracing-function (proc string) From ec723406476c818ab8f1da926e70668e36206289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Tue, 9 Jul 2019 16:44:24 +0200 Subject: [PATCH 08/24] Rename font_driver member open -> open_font * src/xftfont.c (xftfont_driver): * src/xfont.c (xfont_driver): * src/nsfont.m (nsfont_driver): * src/macfont.m (macfont_driver): * src/ftxfont.c (ftxfont_driver): * src/ftfont.c (ftfont_driver): * src/ftcrfont.c (ftcrfont_driver): * src/font.h (struct font_driver): * src/font.c (font_open_entity): Rename `open' member to `open_font', to avoid clash with preprocessor define of `open' in lib/fcntl.h and nt/inc/ms-w32.h. Remove earlier #undef hack. --- src/font.c | 8 +------- src/font.h | 10 +++++----- src/ftcrfont.c | 2 +- src/ftfont.c | 2 +- src/ftxfont.c | 2 +- src/macfont.m | 2 +- src/nsfont.m | 2 +- src/xfont.c | 2 +- src/xftfont.c | 2 +- 9 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/font.c b/src/font.c index ffd50644930..5b10fb2a158 100644 --- a/src/font.c +++ b/src/font.c @@ -44,12 +44,6 @@ along with GNU Emacs. If not, see . */ #include TERM_HEADER #endif /* HAVE_WINDOW_SYSTEM */ -/* Avoid macro definition of `open' in generated lib/fcntl.h to mess up - use of it as a struct member. */ -#ifndef WINDOWSNT -#undef open -#endif - #define DEFAULT_ENCODING Qiso8859_1 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */ @@ -2908,7 +2902,7 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size) width and height. */ for (psize = pixel_size; ; psize++) { - font_object = driver_list->driver->open (f, entity, psize); + font_object = driver_list->driver->open_font (f, entity, psize); if (NILP (font_object)) return Qnil; font = XFONT_OBJECT (font_object); diff --git a/src/font.h b/src/font.h index 3387878ad30..e59fc1d1b25 100644 --- a/src/font.h +++ b/src/font.h @@ -58,7 +58,7 @@ INLINE_HEADER_BEGIN Lisp object encapsulating "struct font". This corresponds to an opened font. - Note: Only the method `open' of a font-driver can create this + Note: Only the method `open_font' of a font-driver can create this object, and it should never be modified by Lisp. */ @@ -594,9 +594,9 @@ struct font_driver :weight, :slant, :width, :size, :dpi, :spacing, :avgwidth. If the font is scalable, :size and :avgwidth must be 0. - The `open' method of the same font-backend is called with one of + The `open_font' method of the same font-backend is called with one of the returned font-entities. If the backend needs additional - information to be used in `open' method, this method can add any + information to be used in `open_font' method, this method can add any Lispy value using the property :font-entity to the entities. This and the following `match' are the only APIs that allocate @@ -623,8 +623,8 @@ struct font_driver /* Open a font specified by FONT_ENTITY on frame F. If the font is scalable, open it with PIXEL_SIZE. */ - Lisp_Object (*open) (struct frame *f, Lisp_Object font_entity, - int pixel_size); + Lisp_Object (*open_font) (struct frame *f, Lisp_Object font_entity, + int pixel_size); /* Close FONT. NOTE: this can be called by GC. */ void (*close) (struct font *font); diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 93786212160..24a4242c89b 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -576,7 +576,7 @@ struct font_driver const ftcrfont_driver = .list = ftcrfont_list, .match = ftcrfont_match, .list_family = ftfont_list_family, - .open = ftcrfont_open, + .open_font = ftcrfont_open, .close = ftcrfont_close, .has_char = ftcrfont_has_char, .encode_char = ftcrfont_encode_char, diff --git a/src/ftfont.c b/src/ftfont.c index a80e2fb5c4b..52a3b388498 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -3039,7 +3039,7 @@ static struct font_driver const ftfont_driver = .list = ftfont_list, .match = ftfont_match, .list_family = ftfont_list_family, - .open = ftfont_open, + .open_font = ftfont_open, .close = ftfont_close, .has_char = ftfont_has_char, .encode_char = ftfont_encode_char, diff --git a/src/ftxfont.c b/src/ftxfont.c index ae7d1a5a9b5..81b72555908 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c @@ -335,7 +335,7 @@ struct font_driver const ftxfont_driver = .list = ftxfont_list, .match = ftxfont_match, .list_family = ftfont_list_family, - .open = ftxfont_open, + .open_font = ftxfont_open, .close = ftxfont_close, .has_char = ftfont_has_char, .encode_char = ftfont_encode_char, diff --git a/src/macfont.m b/src/macfont.m index 2b7f963fd61..26a4a553503 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -1663,7 +1663,7 @@ static struct font_driver macfont_driver = .match = macfont_match, .list_family = macfont_list_family, .free_entity = macfont_free_entity, - .open = macfont_open, + .open_font = macfont_open, .close = macfont_close, .has_char = macfont_has_char, .encode_char = macfont_encode_char, diff --git a/src/nsfont.m b/src/nsfont.m index e22a954e63f..df582024bdc 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -1491,7 +1491,7 @@ struct font_driver const nsfont_driver = .list = nsfont_list, .match = nsfont_match, .list_family = nsfont_list_family, - .open = nsfont_open, + .open_font = nsfont_open, .close = nsfont_close, .has_char = nsfont_has_char, .encode_char = nsfont_encode_char, diff --git a/src/xfont.c b/src/xfont.c index 9a8417b12d4..f6cd2eda5f5 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -1106,7 +1106,7 @@ struct font_driver const xfont_driver = .list = xfont_list, .match = xfont_match, .list_family = xfont_list_family, - .open = xfont_open, + .open_font = xfont_open, .close = xfont_close, .prepare_face = xfont_prepare_face, .has_char = xfont_has_char, diff --git a/src/xftfont.c b/src/xftfont.c index 74add58007d..3ce4b15da81 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -643,7 +643,7 @@ struct font_driver const xftfont_driver = .list = xftfont_list, .match = xftfont_match, .list_family = ftfont_list_family, - .open = xftfont_open, + .open_font = xftfont_open, .close = xftfont_close, .prepare_face = xftfont_prepare_face, .done_face = xftfont_done_face, From 1ffa65cea5a967cbf5e2c1b80ccb7cacb758e7a8 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 17:59:37 +0200 Subject: [PATCH 09/24] Mention `call-process-region' in the `call-process' doc string * src/callproc.c (Fcall_process): Mention `call-process-region' (bug#35187). --- src/callproc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/callproc.c b/src/callproc.c index 2596f9019e4..3c77238cfb6 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -219,7 +219,10 @@ static mode_t const default_output_mode = 0666; DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0, doc: /* Call PROGRAM synchronously in separate process. The remaining arguments are optional. + The program's input comes from file INFILE (nil means `/dev/null'). +If you want to make the input come from an Emacs buffer, use +`call-process-region' instead. Third argument DESTINATION specifies how to handle program's output. If DESTINATION is a buffer, or t that stands for the current buffer, From a9d6ba49d5cc11fd921c796d2e4ad2d47121d34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Tue, 9 Jul 2019 18:18:44 +0200 Subject: [PATCH 10/24] Rename font_driver member close -> close_font * src/alloc.c (cleanup_vector): * src/xftfont.c (xftfont_driver): * src/xfont.c (xfont_driver): * src/nsfont.m (nsfont_driver): * src/macfont.m (macfont_driver): * src/ftxfont.c (ftxfont_driver): * src/ftfont.c (ftfont_driver): * src/ftcrfont.c (ftcrfont_driver): * src/font.h (struct font_driver): * src/font.c (font_clear_cache, font_close_object): Rename `close' member to `close_font', to avoid clash with preprocessor define of `close' in nt/inc/ms-w32.h and for consistency with `open_font'. --- src/alloc.c | 2 +- src/font.c | 4 ++-- src/font.h | 2 +- src/ftcrfont.c | 2 +- src/ftfont.c | 2 +- src/ftxfont.c | 2 +- src/macfont.m | 2 +- src/nsfont.m | 2 +- src/xfont.c | 2 +- src/xftfont.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 90817da5974..833176d4e90 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3019,7 +3019,7 @@ cleanup_vector (struct Lisp_Vector *vector) { /* Attempt to catch subtle bugs like Bug#16140. */ eassert (valid_font_driver (drv)); - drv->close (font); + drv->close_font (font); } } } diff --git a/src/font.c b/src/font.c index 5b10fb2a158..ce85e0bb4ad 100644 --- a/src/font.c +++ b/src/font.c @@ -2642,7 +2642,7 @@ font_clear_cache (struct frame *f, Lisp_Object cache, if (! NILP (AREF (val, FONT_TYPE_INDEX))) { eassert (font && driver == font->driver); - driver->close (font); + driver->close_font (font); } } if (driver->free_entity) @@ -2962,7 +2962,7 @@ font_close_object (struct frame *f, Lisp_Object font_object) /* Already closed. */ return; FONT_ADD_LOG ("close", font_object, Qnil); - font->driver->close (font); + font->driver->close_font (font); #ifdef HAVE_WINDOW_SYSTEM eassert (FRAME_DISPLAY_INFO (f)->n_fonts); FRAME_DISPLAY_INFO (f)->n_fonts--; diff --git a/src/font.h b/src/font.h index e59fc1d1b25..9d4b2d81c6f 100644 --- a/src/font.h +++ b/src/font.h @@ -627,7 +627,7 @@ struct font_driver int pixel_size); /* Close FONT. NOTE: this can be called by GC. */ - void (*close) (struct font *font); + void (*close_font) (struct font *font); /* Prepare FACE for displaying characters by FONT on frame F by storing some data in FACE->extra. */ diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 24a4242c89b..f0c7cbb8c86 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -577,7 +577,7 @@ struct font_driver const ftcrfont_driver = .match = ftcrfont_match, .list_family = ftfont_list_family, .open_font = ftcrfont_open, - .close = ftcrfont_close, + .close_font = ftcrfont_close, .has_char = ftcrfont_has_char, .encode_char = ftcrfont_encode_char, .text_extents = ftcrfont_text_extents, diff --git a/src/ftfont.c b/src/ftfont.c index 52a3b388498..16b18de6867 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -3040,7 +3040,7 @@ static struct font_driver const ftfont_driver = .match = ftfont_match, .list_family = ftfont_list_family, .open_font = ftfont_open, - .close = ftfont_close, + .close_font = ftfont_close, .has_char = ftfont_has_char, .encode_char = ftfont_encode_char, .text_extents = ftfont_text_extents, diff --git a/src/ftxfont.c b/src/ftxfont.c index 81b72555908..1d1bd2c4581 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c @@ -336,7 +336,7 @@ struct font_driver const ftxfont_driver = .match = ftxfont_match, .list_family = ftfont_list_family, .open_font = ftxfont_open, - .close = ftxfont_close, + .close_font = ftxfont_close, .has_char = ftfont_has_char, .encode_char = ftfont_encode_char, .text_extents = ftfont_text_extents, diff --git a/src/macfont.m b/src/macfont.m index 26a4a553503..301951f34a5 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -1664,7 +1664,7 @@ static struct font_driver macfont_driver = .list_family = macfont_list_family, .free_entity = macfont_free_entity, .open_font = macfont_open, - .close = macfont_close, + .close_font = macfont_close, .has_char = macfont_has_char, .encode_char = macfont_encode_char, .text_extents = macfont_text_extents, diff --git a/src/nsfont.m b/src/nsfont.m index df582024bdc..7a40d672b5d 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -1492,7 +1492,7 @@ struct font_driver const nsfont_driver = .match = nsfont_match, .list_family = nsfont_list_family, .open_font = nsfont_open, - .close = nsfont_close, + .close_font = nsfont_close, .has_char = nsfont_has_char, .encode_char = nsfont_encode_char, .text_extents = nsfont_text_extents, diff --git a/src/xfont.c b/src/xfont.c index f6cd2eda5f5..e7a0cb2277d 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -1107,7 +1107,7 @@ struct font_driver const xfont_driver = .match = xfont_match, .list_family = xfont_list_family, .open_font = xfont_open, - .close = xfont_close, + .close_font = xfont_close, .prepare_face = xfont_prepare_face, .has_char = xfont_has_char, .encode_char = xfont_encode_char, diff --git a/src/xftfont.c b/src/xftfont.c index 3ce4b15da81..e0035808172 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -644,7 +644,7 @@ struct font_driver const xftfont_driver = .match = xftfont_match, .list_family = ftfont_list_family, .open_font = xftfont_open, - .close = xftfont_close, + .close_font = xftfont_close, .prepare_face = xftfont_prepare_face, .done_face = xftfont_done_face, .has_char = xftfont_has_char, From 2e4b885478421ea7512ffa9d51d7892fafaae99d Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 17:30:22 +0200 Subject: [PATCH 11/24] Don't try to save articles in Gnus that have disappeared * lisp/gnus/gnus-sum.el (gnus-summary-save-article): Stop trying to save articles if the articles have disappeared (bug#35188). --- lisp/gnus/gnus-sum.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index acc4132c27b..7f6b936383c 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -12188,11 +12188,15 @@ performed." (save-window-excursion (gnus-summary-select-article decode decode nil article) (gnus-summary-goto-subject article)) - (with-current-buffer save-buffer - (erase-buffer) - (insert-buffer-substring (if decode - gnus-article-buffer - gnus-original-article-buffer))) + ;; The article may have expired. + (let ((art-buf (if decode + gnus-article-buffer + gnus-original-article-buffer))) + (when (zerop (buffer-size (get-buffer art-buf))) + (error "Couldn't select article %s" article)) + (with-current-buffer save-buffer + (erase-buffer) + (insert-buffer-substring art-buf))) (setq file (gnus-article-save save-buffer file num)) (gnus-summary-remove-process-mark article) (unless not-saved From 29fc4622631b8269b9a0f16dc2f9f2c16a138a4f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 18:11:27 +0200 Subject: [PATCH 12/24] Clarify warning about unknown articles in Gnus * lisp/gnus/gnus-sum.el (gnus-summary-mark-article-as-unread) (gnus-mark-article-as-unread): Clarify warning (bug#34990). --- lisp/gnus/gnus-sum.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 7f6b936383c..019b47d67ef 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -11153,7 +11153,7 @@ If NO-EXPIRE, auto-expiry will be inhibited." t (if (<= article 0) (progn - (gnus-error 1 "Can't mark negative article numbers") + (gnus-error 1 "Gnus doesn't know the article number; can't mark") nil) (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) (setq gnus-newsgroup-spam-marked @@ -11326,7 +11326,7 @@ If NO-EXPIRE, auto-expiry will be inhibited." (let ((mark (or mark gnus-ticked-mark))) (if (<= article 0) (progn - (gnus-error 1 "Can't mark negative article numbers") + (gnus-error 1 "Gnus doesn't know the article number; can't mark") nil) (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked) gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked) From 547800dade11a1517c0f9a3007baf9df1bceeb5f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 18:24:26 +0200 Subject: [PATCH 13/24] Checkdoc would bug out on empty files * lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): Don't bug out on malformed Emacs Lisp (bug#34760). (checkdoc-file-comments-engine): Don't bug out on empty buffers. --- lisp/emacs-lisp/checkdoc.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 3e3246352a2..830743f5f89 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -929,7 +929,10 @@ don't move point." (pcase (save-excursion (condition-case nil (read (current-buffer)) ;; Conservatively skip syntax errors. - (invalid-read-syntax))) + (invalid-read-syntax) + ;; Don't bug out if the file is empty (or a + ;; definition ends prematurely. + (end-of-file))) (`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice) ,(pred symbolp) ;; Require an initializer, i.e. ignore single-argument `defvar' @@ -2250,7 +2253,10 @@ Code:, and others referenced in the style guide." (re-search-forward "^(require" nil t) (re-search-forward "^(" nil t)) (beginning-of-line)) - (t (re-search-forward ";;; .* --- .*\n"))) + ((not (re-search-forward ";;; .* --- .*\n" nil t)) + (checkdoc-create-error + "You should have a summary line (\";;; .* --- .*\")" + nil nil t))) (if (checkdoc-y-or-n-p "You should have a \";;; Commentary:\", add one? ") (insert "\n;;; Commentary:\n;; \n\n") From 7c548a29c0ae4fc754d1c3432ea234d148b70313 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 18:52:54 +0200 Subject: [PATCH 14/24] Make gnus-read-ephemeral-emacs-bug-group autoloadable * lisp/gnus/gnus-group.el (gnus-read-ephemeral-emacs-bug-group): Add an autoload cookie, because the command can be used from without Gnus. --- lisp/gnus/gnus-group.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 2668e4fb7cd..050b3898802 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2528,6 +2528,7 @@ The arguments have the same meaning as those of (defvar debbugs-gnu-bug-number) ; debbugs-gnu +;;;###autoload (defun gnus-read-ephemeral-emacs-bug-group (ids &optional window-conf) "Browse Emacs bug reports with IDS in an ephemeral group. The arguments have the same meaning as those of From 75af25cba01adbc7ea98d933a1bc7a8b5ffec7f1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 19:19:56 +0200 Subject: [PATCH 15/24] Fix alternative-email-as-from with empty To headers in Message * lisp/gnus/message.el (message-use-alternative-email-as-from): Don't add a "," at the start of the address if the To header doesn't exist (bug#34293). --- lisp/gnus/message.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index fbe8b451401..727bbabcb24 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8108,7 +8108,13 @@ From headers in the original article." (emails (message-tokenize-header (mail-strip-quoted-names - (mapconcat 'message-fetch-reply-field fields ",")))) + (mapconcat + #'identity + (cl-loop for field in fields + for value = (message-fetch-reply-field field) + when value + collect value) + ",")))) (email (cond ((functionp message-alternative-emails) (car (cl-remove-if-not message-alternative-emails emails))) From 7c317c835ad506ec0e1029836b19fbbca9e0ae3b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 19:41:06 +0200 Subject: [PATCH 16/24] Clarify json-read and json-encode parameters and return values * lisp/json.el (json-read): Try to clarify what's returned (bug#34242). (json-encode): Refer to `json-read' about what the input is and say what error is signalled. --- lisp/json.el | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index 44b3c33df7c..d3655a0f26c 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -691,7 +691,19 @@ become JSON objects." (defun json-read () "Parse and return the JSON object following point. -Advances point just past JSON object." +Advances point just past JSON object. + +If called with the following JSON after point + + {\"a\": [1, 2, {\"c\": false}], + \"b\": \"foo\"} + +you will get the following structure returned: + + ((a . + [1 2 + ((c . :json-false))]) + (b . \"foo\"))" (json-skip-whitespace) (let ((char (json-peek))) (if (zerop char) @@ -719,7 +731,11 @@ Advances point just past JSON object." ;;; JSON encoder (defun json-encode (object) - "Return a JSON representation of OBJECT as a string." + "Return a JSON representation of OBJECT as a string. + +OBJECT should have a structure like one returned by `json-read'. +If an error is detected during encoding, an error based on +`json-error' is signalled." (cond ((memq object (list t json-null json-false)) (json-encode-keyword object)) ((stringp object) (json-encode-string object)) From 8c9fe44cdc6b6d66757e61faa15f69e55ba6658e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 9 Jul 2019 21:41:26 +0300 Subject: [PATCH 17/24] ; * lisp/json.el (json-encode): Doc fix. --- lisp/json.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index d3655a0f26c..a36cff7c67b 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -734,8 +734,8 @@ you will get the following structure returned: "Return a JSON representation of OBJECT as a string. OBJECT should have a structure like one returned by `json-read'. -If an error is detected during encoding, an error based on -`json-error' is signalled." +If an error is detected during encoding, this function signals +an error based on `json-error'." (cond ((memq object (list t json-null json-false)) (json-encode-keyword object)) ((stringp object) (json-encode-string object)) From 1e4e165eaf08329e7e39965334d744189fddde3d Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 9 Jul 2019 20:48:35 +0200 Subject: [PATCH 18/24] * lisp/simple.el (shell-command): Raise a user-error instead of an error. --- lisp/simple.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 983a3b6973d..2768bd4a75e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3628,12 +3628,12 @@ impose the use of a shell (with its need to quote arguments)." ;; If will kill a process, query first. (if (yes-or-no-p "A command is running in the default buffer. Kill it? ") (kill-process proc) - (error "Shell command in progress"))) + (user-error "Shell command in progress"))) ((eq async-shell-command-buffer 'confirm-new-buffer) ;; If will create a new buffer, query first. (if (yes-or-no-p "A command is running in the default buffer. Use a new buffer? ") (setq buffer (generate-new-buffer bname)) - (error "Shell command in progress"))) + (user-error "Shell command in progress"))) ((eq async-shell-command-buffer 'new-buffer) ;; It will create a new buffer. (setq buffer (generate-new-buffer bname))) @@ -3644,7 +3644,7 @@ impose the use of a shell (with its need to quote arguments)." (with-current-buffer buffer (rename-uniquely)) (setq buffer (get-buffer-create bname))) - (error "Shell command in progress"))) + (user-error "Shell command in progress"))) ((eq async-shell-command-buffer 'rename-buffer) ;; It will rename the buffer. (with-current-buffer buffer From 48daf77a9d963c05ee198b3ab108c7f0b3686da6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 20:40:23 +0200 Subject: [PATCH 19/24] Fix pretty-printing of multiple JSON objects * lisp/json.el (json-pretty-print-max-secs): Make obsolete. (json-pretty-print): Pretty-print all JSON objects in the region instead of just the first one (and then deleting all other objects) (bug#34160). --- lisp/json.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index a36cff7c67b..8dd96b08640 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -758,10 +758,8 @@ With prefix argument MINIMIZE, minimize it instead." (json-pretty-print (point-min) (point-max) minimize)) (defvar json-pretty-print-max-secs 2.0 - "Maximum time for `json-pretty-print's comparison. -The function `json-pretty-print' uses `replace-region-contents' -(which see) passing the value of this variable as argument -MAX-SECS.") + "Maximum time for `json-pretty-print's comparison.") +(make-obsolete-variable json-pretty-print-max-secs nil "27.1") (defun json-pretty-print (begin end &optional minimize) "Pretty-print selected region. @@ -771,14 +769,17 @@ With prefix argument MINIMIZE, minimize it instead." ;; Distinguish an empty objects from 'null' (json-null :json-null) ;; Ensure that ordering is maintained - (json-object-type 'alist)) - (replace-region-contents - begin end - (lambda () (json-encode (json-read))) - json-pretty-print-max-secs - ;; FIXME: What's a good value here? Can we use something better, - ;; e.g., by deriving a value from the size of the region? - 64))) + (json-object-type 'alist) + json) + (save-restriction + (narrow-to-region begin end) + (goto-char begin) + (while (setq json (condition-case _ + (json-read) + (json-error nil))) + (delete-region begin (point)) + (insert (json-encode json)) + (setq begin (point)))))) (defun json-pretty-print-buffer-ordered (&optional minimize) "Pretty-print current buffer with object keys ordered. From 864ab2c150583d01e2dbdebde6a024e923512d94 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 21:23:18 +0200 Subject: [PATCH 20/24] Revert "Fix pretty-printing of multiple JSON objects" This reverts commit 48daf77a9d963c05ee198b3ab108c7f0b3686da6. This apparently led to build errors. --- lisp/json.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index 8dd96b08640..a36cff7c67b 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -758,8 +758,10 @@ With prefix argument MINIMIZE, minimize it instead." (json-pretty-print (point-min) (point-max) minimize)) (defvar json-pretty-print-max-secs 2.0 - "Maximum time for `json-pretty-print's comparison.") -(make-obsolete-variable json-pretty-print-max-secs nil "27.1") + "Maximum time for `json-pretty-print's comparison. +The function `json-pretty-print' uses `replace-region-contents' +(which see) passing the value of this variable as argument +MAX-SECS.") (defun json-pretty-print (begin end &optional minimize) "Pretty-print selected region. @@ -769,17 +771,14 @@ With prefix argument MINIMIZE, minimize it instead." ;; Distinguish an empty objects from 'null' (json-null :json-null) ;; Ensure that ordering is maintained - (json-object-type 'alist) - json) - (save-restriction - (narrow-to-region begin end) - (goto-char begin) - (while (setq json (condition-case _ - (json-read) - (json-error nil))) - (delete-region begin (point)) - (insert (json-encode json)) - (setq begin (point)))))) + (json-object-type 'alist)) + (replace-region-contents + begin end + (lambda () (json-encode (json-read))) + json-pretty-print-max-secs + ;; FIXME: What's a good value here? Can we use something better, + ;; e.g., by deriving a value from the size of the region? + 64))) (defun json-pretty-print-buffer-ordered (&optional minimize) "Pretty-print current buffer with object keys ordered. From bff64115a0ad081282e0f99305f41c8dd1917d67 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 9 Jul 2019 21:32:41 +0200 Subject: [PATCH 21/24] Fix pretty-printing of multiple JSON objects * lisp/json.el (json-pretty-print-max-secs): Make obsolete. (json-pretty-print): Pretty-print all JSON objects in the region instead of just the first one (and then deleting all other objects) (bug#34160). --- lisp/json.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index a36cff7c67b..460fdec7256 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -734,8 +734,8 @@ you will get the following structure returned: "Return a JSON representation of OBJECT as a string. OBJECT should have a structure like one returned by `json-read'. -If an error is detected during encoding, this function signals -an error based on `json-error'." +If an error is detected during encoding, an error based on +`json-error' is signalled." (cond ((memq object (list t json-null json-false)) (json-encode-keyword object)) ((stringp object) (json-encode-string object)) @@ -762,6 +762,7 @@ With prefix argument MINIMIZE, minimize it instead." The function `json-pretty-print' uses `replace-region-contents' (which see) passing the value of this variable as argument MAX-SECS.") +(make-obsolete-variable 'json-pretty-print-max-secs nil "27.1") (defun json-pretty-print (begin end &optional minimize) "Pretty-print selected region. @@ -771,14 +772,17 @@ With prefix argument MINIMIZE, minimize it instead." ;; Distinguish an empty objects from 'null' (json-null :json-null) ;; Ensure that ordering is maintained - (json-object-type 'alist)) - (replace-region-contents - begin end - (lambda () (json-encode (json-read))) - json-pretty-print-max-secs - ;; FIXME: What's a good value here? Can we use something better, - ;; e.g., by deriving a value from the size of the region? - 64))) + (json-object-type 'alist) + json) + (save-restriction + (narrow-to-region begin end) + (goto-char begin) + (while (setq json (condition-case _ + (json-read) + (json-error nil))) + (delete-region begin (point)) + (insert (json-encode json)) + (setq begin (point)))))) (defun json-pretty-print-buffer-ordered (&optional minimize) "Pretty-print current buffer with object keys ordered. From fc41b0610e5bb204dd9905f89e235ea801e7a4ea Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 9 Jul 2019 21:12:14 +0200 Subject: [PATCH 22/24] Make fingerprint handling compatible with LTO Tell the compiler that the fingerprint variable is modified unpredictably. * lib/fingerprint.h (fingerprint): Remove const. * lib/fingerprint.c (fingerprint): Likewise. * src/pdumper.c (Fdump_emacs_portable): Cast fingerprint variable. (pdumper_load): Likewise. * lib-src/make-fingerprint.c (main): Likewise. --- lib-src/make-fingerprint.c | 3 ++- lib/fingerprint.c | 2 +- lib/fingerprint.h | 2 +- src/pdumper.c | 8 +++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c index 5779e0d2746..2417548d8ca 100644 --- a/lib-src/make-fingerprint.c +++ b/lib-src/make-fingerprint.c @@ -144,7 +144,8 @@ main (int argc, char **argv) for (char *finger = buf; (finger = memmem (finger, buf + chunksz - finger, - fingerprint, sizeof fingerprint)); + (unsigned char *) fingerprint, + sizeof fingerprint)); finger++) { if (! (fseeko (f, finger - buf, SEEK_SET) == 0 diff --git a/lib/fingerprint.c b/lib/fingerprint.c index e55de9c6da3..2cc1973428f 100644 --- a/lib/fingerprint.c +++ b/lib/fingerprint.c @@ -29,7 +29,7 @@ along with GNU Emacs. If not, see . */ by a fingerprint of the temporary Emacs executable that was built along the way. */ -unsigned char const fingerprint[] = +volatile unsigned char fingerprint[] = { 0xDE, 0x86, diff --git a/lib/fingerprint.h b/lib/fingerprint.h index 0b195fd0ca7..ba2e740cd9e 100644 --- a/lib/fingerprint.h +++ b/lib/fingerprint.h @@ -24,6 +24,6 @@ along with GNU Emacs. If not, see . */ Emacs. This way, we have a unique value that we can use to pair data files (like a portable dump image) with a specific build of Emacs. */ -extern unsigned char const fingerprint[32]; +extern volatile unsigned char fingerprint[32]; #endif diff --git a/src/pdumper.c b/src/pdumper.c index 8b630d221b1..7d29d3c0c83 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4101,7 +4101,8 @@ types. */) ctx->header.magic[0] = '!'; /* Note that dump is incomplete. */ verify (sizeof (fingerprint) == sizeof (ctx->header.fingerprint)); - memcpy (ctx->header.fingerprint, fingerprint, sizeof (fingerprint)); + memcpy (ctx->header.fingerprint, (unsigned char *) fingerprint, + sizeof (fingerprint)); const dump_off header_start = ctx->offset; dump_fingerprint ("dumping fingerprint", ctx->header.fingerprint); @@ -5359,9 +5360,10 @@ pdumper_load (const char *dump_filename) err = PDUMPER_LOAD_VERSION_MISMATCH; verify (sizeof (header->fingerprint) == sizeof (fingerprint)); - if (memcmp (header->fingerprint, fingerprint, sizeof (fingerprint)) != 0) + if (memcmp (header->fingerprint, (unsigned char *) fingerprint, + sizeof (fingerprint)) != 0) { - dump_fingerprint ("desired fingerprint", fingerprint); + dump_fingerprint ("desired fingerprint", (unsigned char *) fingerprint); dump_fingerprint ("found fingerprint", header->fingerprint); goto out; } From ce59b41a28aba629dd126e7af3c6e45909de6a83 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Jul 2019 13:02:51 -0700 Subject: [PATCH 23/24] Port image-type-from-file-header-test to non-SVG Emacs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported privately by Michael Albinus. * test/lisp/image-tests.el (image-type-from-file-header-test): Don’t assume svg is a supported image type. --- test/lisp/image-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lisp/image-tests.el b/test/lisp/image-tests.el index 621646e5750..5a5b8ea1f71 100644 --- a/test/lisp/image-tests.el +++ b/test/lisp/image-tests.el @@ -48,7 +48,7 @@ (ert-deftest image-type-from-file-header-test () "Test image-type-from-file-header." - (should (eq 'svg + (should (eq (if (image-type-available-p 'svg) 'svg) (image-type-from-file-header (expand-file-name "splash.svg" image-tests--emacs-images-directory))))) From 412139f1be7415791a0d964f95f319c86eded426 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Jul 2019 13:10:27 -0700 Subject: [PATCH 24/24] Do not alter match data in Fcapitalize etc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch, (capitalize "x") can alter the match data, which is not what users expect. Problem found by running morse-tests-unnato-region in a stripped-down Emacs. Perhaps ‘load’ should also save and restore the match data? That would be a simpler fix, though arguably incompatible. * src/lread.c (save_match_data_load): New function. * src/chartab.c (uniprop_table): * src/doc.c (reread_doc_file): * src/eval.c (Fautoload_do_load): * src/fns.c (Frequire): Use it. --- src/chartab.c | 2 +- src/doc.c | 2 +- src/eval.c | 5 +---- src/fns.c | 5 +++-- src/lisp.h | 2 ++ src/lread.c | 11 +++++++++++ 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/chartab.c b/src/chartab.c index bf8e34b2529..04205ac1032 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -1288,7 +1288,7 @@ uniprop_table (Lisp_Object prop) if (STRINGP (table)) { AUTO_STRING (intl, "international/"); - result = Fload (concat2 (intl, table), Qt, Qt, Qt, Qt); + result = save_match_data_load (concat2 (intl, table), Qt, Qt, Qt, Qt); if (NILP (result)) return Qnil; table = XCDR (val); diff --git a/src/doc.c b/src/doc.c index 8875360d6e6..8b663f0f249 100644 --- a/src/doc.c +++ b/src/doc.c @@ -302,7 +302,7 @@ reread_doc_file (Lisp_Object file) if (NILP (file)) Fsnarf_documentation (Vdoc_file_name); else - Fload (file, Qt, Qt, Qt, Qnil); + save_match_data_load (file, Qt, Qt, Qt, Qnil); return 1; } diff --git a/src/eval.c b/src/eval.c index 8f569949036..02a6c3555a9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2049,9 +2049,6 @@ it defines a macro. */) CHECK_SYMBOL (funname); - /* Preserve the match data. */ - record_unwind_save_match_data (); - /* If autoloading gets an error (which includes the error of failing to define the function being called), we use Vautoload_queue to undo function definitions and `provide' calls made by @@ -2067,7 +2064,7 @@ it defines a macro. */) so don't signal an error if autoloading fails. */ Lisp_Object ignore_errors = (EQ (kind, Qt) || EQ (kind, Qmacro)) ? Qnil : macro_only; - Fload (Fcar (Fcdr (fundef)), ignore_errors, Qt, Qnil, Qt); + save_match_data_load (Fcar (Fcdr (fundef)), ignore_errors, Qt, Qnil, Qt); /* Once loading finishes, don't undo it. */ Vautoload_queue = Qt; diff --git a/src/fns.c b/src/fns.c index 77c0b15037f..11f5dddc858 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2984,8 +2984,9 @@ suppressed. */) Vautoload_queue = Qt; /* Load the file. */ - tem = Fload (NILP (filename) ? Fsymbol_name (feature) : filename, - noerror, Qt, Qnil, (NILP (filename) ? Qt : Qnil)); + tem = save_match_data_load + (NILP (filename) ? Fsymbol_name (feature) : filename, + noerror, Qt, Qnil, (NILP (filename) ? Qt : Qnil)); /* If load failed entirely, return nil. */ if (NILP (tem)) diff --git a/src/lisp.h b/src/lisp.h index 8acf63fe227..fa57cad8a60 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4019,6 +4019,8 @@ LOADHIST_ATTACH (Lisp_Object x) if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); } +extern Lisp_Object save_match_data_load (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, Lisp_Object, bool); enum { S2N_IGNORE_TRAILING = 1 }; diff --git a/src/lread.c b/src/lread.c index e06eafcf6cf..3152fcf867d 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1508,6 +1508,17 @@ Return t if the file exists and loads successfully. */) return Qt; } + +Lisp_Object +save_match_data_load (Lisp_Object file, Lisp_Object noerror, + Lisp_Object nomessage, Lisp_Object nosuffix, + Lisp_Object must_suffix) +{ + ptrdiff_t count = SPECPDL_INDEX (); + record_unwind_save_match_data (); + Lisp_Object result = Fload (file, noerror, nomessage, nosuffix, must_suffix); + return unbind_to (count, result); +} static bool complete_filename_p (Lisp_Object pathname)