From fcd66d059cffbcfff8325304c2c100b64d28ae29 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 11 Jun 2018 20:00:54 -0400 Subject: [PATCH 1/7] Keep vc-print-log from putting point at buffer end (Bug#31764) * lisp/vc/vc.el (vc-print-log-internal): Use `save-excursion' around `vc-print-log-setup-buttons'. --- lisp/vc/vc.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 93e9c25cbfd..41a76e0007e 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2256,8 +2256,9 @@ earlier revisions. Show up to LIMIT entries (non-nil means unlimited)." (vc-call-backend bk 'print-log files-arg buf shortlog (when is-start-revision working-revision) limit)) (lambda (_bk _files-arg ret) - (vc-print-log-setup-buttons working-revision - is-start-revision limit ret)) + (save-excursion + (vc-print-log-setup-buttons working-revision + is-start-revision limit ret))) ;; When it's nil, point really shouldn't move (bug#15322). (when working-revision (lambda (bk) From 0b1a2ae84afe840997c1444b1dc56909b542b011 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Jun 2018 10:32:45 +0300 Subject: [PATCH 2/7] Delete description of deleted Customize functions * doc/lispref/customize.texi (Variable Definitions): Remove the description of 'custom-initialize-safe-set' and 'custom-initialize-safe-default', which were deleted in Emacs 23.2, and replace with the description of 'custom-initialize-delay'. --- doc/lispref/customize.texi | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 4d88d7c8c98..02fcd80fa33 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi @@ -416,20 +416,14 @@ Use the @code{:set} function to initialize the variable, if it is already set or has been customized; otherwise, just use @code{set-default}. -@item custom-initialize-safe-set -@itemx custom-initialize-safe-default -These functions behave like @code{custom-initialize-set} -(@code{custom-initialize-default}, respectively), but catch errors. -If an error occurs during initialization, they set the variable to -@code{nil} using @code{set-default}, and signal no error. - -These functions are meant for options defined in pre-loaded files, -where the @var{standard} expression may signal an error because some -required variable or function is not yet defined. The value normally -gets updated in @file{startup.el}, ignoring the value computed by -@code{defcustom}. After startup, if one unsets the value and -reevaluates the @code{defcustom}, the @var{standard} expression can be -evaluated without error. +@item custom-initialize-delay +This functions behaves like @code{custom-initialize-set}, but it +delays the actual initialization to the next Emacs start. This should +be used in files that are preloaded (or for autoloaded variables), so +that the initialization is done in the run-time context rather than +the build-time context. This also has the side-effect that the +(delayed) initialization is performed with the @code{:set} function. +@xref{Building Emacs}. @end table @item :risky @var{value} From 63f1dc4f7c33cc7cc738dbfae3d8192ae448b2f6 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Fri, 15 Jun 2018 00:40:53 -0700 Subject: [PATCH 3/7] Improve movemail default * lisp/gnus/mail-source.el (mail-source-movemail-program): Change default to "movemail". (mail-source-movemail): Pass just mail-source-movemail-program to call-process instead of fully specifying it relative to exec-directory. Ensures that we will find Mailutils movemail if it is installed. (Bug#31737) --- lisp/gnus/mail-source.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index d2850f4cee3..abb5e2d1231 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el @@ -301,9 +301,9 @@ number." :group 'mail-source :type 'number) -(defcustom mail-source-movemail-program nil +(defcustom mail-source-movemail-program "movemail" "If non-nil, name of program for fetching new mail." - :version "22.1" + :version "26.2" :group 'mail-source :type '(choice (const nil) string)) @@ -682,12 +682,16 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile) (setq errors (generate-new-buffer " *mail source loss*")) (let ((default-directory "/")) (setq result + ;; call-process looks in exec-path, which + ;; contains exec-directory, so will find + ;; Mailutils movemail if it exists, else it will + ;; find "our" movemail in exec-directory. + ;; Bug#31737 (apply 'call-process (append (list - (or mail-source-movemail-program - (expand-file-name "movemail" exec-directory)) + mail-source-movemail-program nil errors nil from to))))) (when (file-exists-p to) (set-file-modes to mail-source-default-file-modes)) From c79a6275b2f3bc529f9e7e9a65dc56fbd30364d9 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Fri, 15 Jun 2018 10:24:43 +0200 Subject: [PATCH 4/7] Update etc/NEWS for mail-source-movemail-program change * etc/NEWS: Describe change in how we search for mail-source-movemail-program. --- etc/NEWS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 938644215f4..92331108e95 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -46,6 +46,16 @@ often cause crashes. Set it to nil if you really need those fonts. * Changes in Specialized Modes and Packages in Emacs 26.2 +** Gnus + +--- +*** Mailutils movemail will now be used if found at runtime. +The default value of mail-source-movemail-program is now "movemail". +This ensures that the movemail program from GNU Mailutils will be used +if found in 'exec-path', even if it was not found at build time. To +use a different program, customize mail-source-movemail-program to the +absolute file name of the desired executable. + ** Shell mode --- From 0d3c35807d0b0a3aaa4c4ebd2f040bb78013879d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Jun 2018 11:27:56 +0300 Subject: [PATCH 5/7] Fix 'replace-buffer-contents' in multibyte buffers * src/editfns.c (buffer_chars_equal): Pass a byte position to BUF_FETCH_CHAR_AS_MULTIBYTE, not a character position. (Bug#31837) * test/src/editfns-tests.el (replace-buffer-contents-bug31837): New test. --- src/editfns.c | 13 +++++++++++-- test/src/editfns-tests.el | 11 +++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index b553a213e6c..fc5b6c117f5 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3304,8 +3304,17 @@ buffer_chars_equal (struct context *ctx, eassert (pos_b >= BUF_BEGV (ctx->buffer_b)); eassert (pos_b < BUF_ZV (ctx->buffer_b)); - return BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_a, pos_a) - == BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_b, pos_b); + ptrdiff_t bpos_a = + NILP (BVAR (ctx->buffer_a, enable_multibyte_characters)) + ? pos_a + : buf_charpos_to_bytepos (ctx->buffer_a, pos_a); + ptrdiff_t bpos_b = + NILP (BVAR (ctx->buffer_b, enable_multibyte_characters)) + ? pos_b + : buf_charpos_to_bytepos (ctx->buffer_b, pos_b); + + return BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_a, bpos_a) + == BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_b, bpos_b); } diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 714e92e5053..ec411ff773b 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -247,6 +247,17 @@ (buffer-string) "foo bar baz qux")))))) +(ert-deftest replace-buffer-contents-bug31837 () + (switch-to-buffer "a") + (insert-char (char-from-name "SMILE")) + (insert "1234") + (switch-to-buffer "b") + (insert-char (char-from-name "SMILE")) + (insert "5678") + (replace-buffer-contents "a") + (should (equal (buffer-substring-no-properties (point-min) (point-max)) + (concat (string (char-from-name "SMILE")) "1234")))) + (ert-deftest delete-region-undo-markers-1 () "Make sure we don't end up with freed markers reachable from Lisp." ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#40 From 22aa665c9b536775a28ff2e4907afc31b69ccb21 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Jun 2018 17:39:34 +0300 Subject: [PATCH 6/7] Reject invalid 5-byte sequences when detecting UTF-8 encoding * src/coding.c (detect_coding_utf_8): Reject multibyte sequences whose leading byte is greater than MAX_MULTIBYTE_LEADING_CODE. (Bug#31829) * src/character.h (MAX_MULTIBYTE_LEADING_CODE): Add commentary about the connection between the value of this macro and MAX_CHAR. --- src/character.h | 3 ++- src/coding.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/character.h b/src/character.h index 1f21b2ad330..bc65759aa2a 100644 --- a/src/character.h +++ b/src/character.h @@ -57,7 +57,8 @@ INLINE_HEADER_BEGIN /* Minimum leading code of multibyte characters. */ #define MIN_MULTIBYTE_LEADING_CODE 0xC0 -/* Maximum leading code of multibyte characters. */ +/* Maximum leading code of multibyte characters. Note: this must be + updated if we ever increase MAX_CHAR above. */ #define MAX_MULTIBYTE_LEADING_CODE 0xF8 /* Unicode character values. */ diff --git a/src/coding.c b/src/coding.c index e756ba169dd..b1eb2edb497 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1225,7 +1225,10 @@ detect_coding_utf_8 (struct coding_system *coding, ONE_MORE_BYTE (c4); if (c4 < 0 || ! UTF_8_EXTRA_OCTET_P (c4)) break; - if (UTF_8_5_OCTET_LEADING_P (c)) + if (UTF_8_5_OCTET_LEADING_P (c) + /* If we ever need to increase MAX_CHAR, the below may need + to be reviewed. */ + && c < MAX_MULTIBYTE_LEADING_CODE) { nchars++; continue; From 63ba73a9f2bdf75363eea678a8c119ed0ffd9799 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Jun 2018 14:00:47 +0300 Subject: [PATCH 7/7] Fix documentation of ':propertize' in mode-line-format * doc/lispref/modes.texi (Mode Line Data): Make the description of ':propertize' more accurate. (Bug#26291) --- doc/lispref/modes.texi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 8a77745d8f7..d7e217c5287 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1839,10 +1839,13 @@ recursion. @item (:propertize @var{elt} @var{props}@dots{}) A list whose first element is the symbol @code{:propertize} says to -process the mode line construct @var{elt} recursively, then add the text -properties specified by @var{props} to the result. The argument +process the mode line construct @var{elt} recursively, then add the +text properties specified by @var{props} to the result. The argument @var{props} should consist of zero or more pairs @var{text-property} -@var{value}. +@var{value}. If @var{elt} is or produces a string with text +properties, all the characters of that string should have the same +properties, or else some of them might be removed by +@code{:propertize}. @item (@var{symbol} @var{then} @var{else}) A list whose first element is a symbol that is not a keyword specifies