commit e37b96432b89521871e947f322545f154547dd1b (HEAD, refs/remotes/origin/master) Author: Andrew G Cohen Date: Tue Jun 27 21:11:35 2023 +0800 Fix parsing of mail address headers (bug#64296) RFC5322 specifies that an address header may be a list of both individual mailboxes and mailbox groups. This patch introduces support for parsing headers that include groups. * lisp/mail/ietf-drums.el (ietf-drums-parse-addresses): Allow message address headers to include both mailboxes and groups. diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index f60a3a3da28..aa714292bcc 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el @@ -272,6 +272,21 @@ ietf-drums-parse-addresses (while (not (eobp)) (setq c (char-after)) (cond + ((eq c ?:) + (setq beg (1+ (point))) + (skip-chars-forward "^;") + (when-let ((address + (condition-case nil + (ietf-drums-parse-addresses + (buffer-substring beg (point)) rawp) + (error nil)))) + (if (listp address) + (setq pairs (append address pairs)) + (push address pairs))) + (condition-case nil + (forward-char 1) + (error nil)) + (setq beg (point))) ((memq c '(?\" ?< ?\()) (condition-case nil (forward-sexp 1) @@ -285,10 +300,12 @@ ietf-drums-parse-addresses (ietf-drums-parse-address (buffer-substring beg (point))) (error nil)))) - (if address (push address pairs)) + (when (or (consp address) + (and (stringp address) (< 0 (length address)))) + (push address pairs)) (forward-char 1) (setq beg (point))) - (t + ((not (eobp)) (forward-char 1)))) (setq address (if rawp @@ -297,7 +314,9 @@ ietf-drums-parse-addresses (ietf-drums-parse-address (buffer-substring beg (point))) (error nil)))) - (if address (push address pairs)) + (when (or (consp address) + (and (stringp address) (< 0 (length address)))) + (push address pairs)) (nreverse pairs))))) (defun ietf-drums-unfold-fws () commit cb674ab40ce8bffe566c6851cf2ac5261152f004 Author: Eliza Velasquez Date: Fri Jun 30 17:35:44 2023 -0700 Fix `async-shell-command-display-buffer' display * lisp/simple.el (shell-command): If `async-shell-command-display-buffer' was nil, it did not respect `display-buffer-alist' entries with `display-buffer-no-window'. This behavior has been fixed (bug#64394). diff --git a/lisp/simple.el b/lisp/simple.el index 321734a5026..7da2bf0fae2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4734,7 +4734,7 @@ shell-command (when (buffer-live-p buf) (remove-function (process-filter proc) nonce) - (display-buffer buf)))) + (display-buffer buf '(nil (allow-no-window . t)))))) `((name . ,nonce))))))) ;; Otherwise, command is executed synchronously. (shell-command-on-region (point) (point) command commit 393958ea63a945c3be0e81d96822eed5e0208874 Author: Robert Pluim Date: Tue Jul 4 19:01:59 2023 +0200 Grammar fixes in 'remote-file-name-access-timeout' descriptions * doc/emacs/files.texi (File Conveniences): Grammar fix. * doc/emacs/misc.texi (Saving Emacs Sessions): Grammar fix. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 43140f5da0f..9734223b95e 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2256,10 +2256,10 @@ File Conveniences edits it. @vindex remote-file-name-access-timeout - If you use remote files, you might also consider to customize -@code{remote-file-name-access-timeout} to a proper value (number of -seconds), after which time a check whether a remote file shall be used -in Recentf is stopped. This prevents Emacs to be blocked. + If you use remote files, you might also consider customizing +@code{remote-file-name-access-timeout}, which is the number of +seconds after which the check whether a remote file shall be used +in Recentf is stopped. This prevents Emacs being blocked. @c FIXME partial-completion-mode (complete.el) is obsolete. The @kbd{M-x ffap} command generalizes @code{find-file} with more diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 042829002db..7a88b7ef5e0 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2815,10 +2815,10 @@ Saving Emacs Sessions @vindex remote-file-name-access-timeout Information about buffers visiting remote files is not saved by default. Customize the variable @code{desktop-files-not-to-save} to -change this. In this case, you might also consider to customize -@code{remote-file-name-access-timeout} to a proper value (number of -seconds), after which time a buffer restoration of a remote file is -stopped. This prevents Emacs to be blocked. +change this. In this case, you might also consider customizing +@code{remote-file-name-access-timeout}, which is the number of +seconds after which buffer restoration of a remote file is +stopped. This prevents Emacs being blocked. @vindex desktop-restore-eager By default, all the buffers in the desktop are restored in one go. commit f2f1fef072a4e42593cc4cb5a4775893078248e7 Author: Robert Pluim Date: Tue Jul 4 18:58:22 2023 +0200 ; Minor grammar fixes to tramp manual * doc/misc/tramp.texi (Frequently Asked Questions): Grammar fixes. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 890d4c0c07a..4973ab2c9b1 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -5158,10 +5158,10 @@ Frequently Asked Questions @vindex remote-file-name-access-timeout Some packages, like @file{desktop.el} or @file{recentf.el}, access -remote files when loaded. If the respective file is not accessible, +remote files when loaded. If the requested file is not accessible, @value{tramp} could block. In order to check whether this could happen, add a test via @code{access-file} with a proper timeout prior -loading these packages: +to loading these packages: @lisp @group @@ -5182,9 +5182,10 @@ Frequently Asked Questions properly. @c Since Emacs 30. -@strong{Note}: In recent versions of Emacs, both packages apply -already this check. You just need to customize -@code{remote-file-name-access-timeout}. +@strong{Note}: In recent versions of Emacs, both packages already +apply this check. You just need to customize +@code{remote-file-name-access-timeout} to the desired timeout (in +seconds). @item commit a2db9b426bcca6207dafa5672417165996072d76 Author: Robert Pluim Date: Tue Jul 4 18:56:15 2023 +0200 Improve remote-file-name-access-timeout NEWS entries * etc/NEWS: Improve recentf and desktop mode entries. diff --git a/etc/NEWS b/etc/NEWS index 510aa8104bb..5318add7a82 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -457,7 +457,7 @@ object oriented syntax which were added in Perl 5.36 and 5.38. ** Emacs Sessions (Desktop) +++ -*** Restoring buffers visiting remote files should not block. +*** Restoring buffers visiting remote files can now time out. When a buffer is restored which visits a remote file, the restoration of the session could hang if the remote host is off-line or slow to respond. Setting the user option 'remote-file-name-access-timeout' to @@ -468,11 +468,10 @@ desktop restoration to continue. ** Recentf +++ -*** Checking recent remote files should not block. -When a a remote file is checked in 'recentf-list', the user option -'remote-file-name-access-timeout' could be set to a positive number. -This value will be used as timeout (in seconds) for checking, whether -the remote file is accessible. +*** Checking recent remote files can now time out. +Similarly to buffer restoration by "desktop", 'recentf-mode' checking +of the accessibility of remote files can now time out if +`remote-file-name-access-timeout' is set to a positive number. * New Modes and Packages in Emacs 30.1 commit 85ac3b84af3f6623fa04cc7cf483522db17f69a4 Author: Eli Zaretskii Date: Tue Jul 4 19:35:28 2023 +0300 ; * etc/NEWS: Fix recently added entry. diff --git a/etc/NEWS b/etc/NEWS index be2327c5a8d..510aa8104bb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -457,11 +457,13 @@ object oriented syntax which were added in Perl 5.36 and 5.38. ** Emacs Sessions (Desktop) +++ -*** Restoring buffers with remote files should not block. -When a buffer is restored which uses a remote file, the user option -'remote-file-name-access-timeout' could be set to a positive number. -This value will be used as timeout (in seconds) for checking, whether -the remote file is accessible. +*** Restoring buffers visiting remote files should not block. +When a buffer is restored which visits a remote file, the restoration +of the session could hang if the remote host is off-line or slow to +respond. Setting the user option 'remote-file-name-access-timeout' to +a positive number will abandon the attempt to restore such buffers +after a timeout of that many seconds, thus allowing the rest of +desktop restoration to continue. ** Recentf commit 6d1e6f7f111ee2442e9a20c9a0585120198b706f Author: Eli Zaretskii Date: Tue Jul 4 19:28:09 2023 +0300 Improve documentation of 'remote-file-name-access-timeout' * lisp/desktop.el (desktop-files-not-to-save): Mention 'remote-file-name-access-timeout' in the doc string. (Bug#64401) diff --git a/lisp/desktop.el b/lisp/desktop.el index cb5cbbd1ef2..59298699914 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -397,7 +397,12 @@ desktop-buffers-not-to-save (defcustom desktop-files-not-to-save "\\(\\`/[^/:]*:\\|(ftp)\\'\\)" "Regexp identifying files whose buffers are to be excluded from saving. -The default value excludes buffers visiting remote files." +The default value excludes buffers visiting remote files. + +If you modify this such that buffers visiting remote files are not excluded, +you may wish customizing `remote-file-name-access-timeout' to a non-nil +value, to avoid hanging the desktop restoration because some remote +host is off-line." :type '(choice (const :tag "None" nil) regexp) :group 'desktop) commit 0e6ac3ffd403d811244760f7ba6dd1997dd18bcb Author: Harald Jörg Date: Tue Jul 4 17:42:05 2023 +0200 ; cperl-mode: Avoid excessive regexp backtracking (Bug#8077) * lisp/progmodes/cperl-mode.el (defconst): Add a word-start assertion to cperl--single-attribute-rx (cperl-after-sub-regexp): Dito (cperl-init-faces): shorten matches of incomplete sub declarations diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 54547c4668a..809a7274a25 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1305,7 +1305,8 @@ cperl-menu "A sequence for recommended version number schemes in Perl.") (defconst cperl--single-attribute-rx - `(sequence ,cperl--basic-identifier-rx + `(sequence word-start + ,cperl--basic-identifier-rx (optional (sequence "(" (0+ (not (in ")"))) ")"))) @@ -1552,7 +1553,7 @@ cperl-after-sub-regexp (if attr (concat "\\(" cperl-maybe-white-and-comment-rex ; whitespace-comments - "\\(\\sw\\|_\\)+" ; attr-name + "\\(\\<\\sw\\|_\\)+" ; attr-name ;; attr-arg (1 level of internal parens allowed!) "\\((\\(\\\\.\\|[^\\()]\\|([^\\()]*)\\)*)\\)?" "\\(" ; optional : (XXX allows trailing???) @@ -6003,7 +6004,11 @@ cperl-init-faces ;; ... or the start of a "sloppy" signature (sequence (eval cperl--sloppy-signature-rx) ;; arbtrarily continue "a few lines" - (repeat 0 200 (not (in "{")))))))) + (repeat 0 200 (not (in "{")))) + ;; make sure we have a reasonably + ;; short match for an incomplete sub + (not (in ";{(")) + buffer-end)))) '(1 (if (match-beginning 3) 'font-lock-variable-name-face 'font-lock-function-name-face) commit 753aaeb99c7eaa87e40c058235e31ef773babc8a Author: Alan Mackenzie Date: Tue Jul 4 15:29:53 2023 +0000 objc-mode: Handle (de)propertization of < and >. * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions) (c-before-font-lock-functions): Separate the C and objc versions, and add (to the first) c-unmark-<>-around-region and c-before-change-check-<>-operators, (to the second) c-unmark-<>-around-region and c-restore-<>-properties into the objc versions of these lang variables. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 2422cf3deb0..4e2ae5d85a6 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -462,12 +462,20 @@ c-get-state-before-change-functions c-before-change-check-unbalanced-strings c-parse-quotes-before-change c-before-change-fix-comment-escapes) - (c objc) '(c-extend-region-for-CPP - c-depropertize-CPP - c-truncate-bs-cache - c-before-change-check-unbalanced-strings - c-parse-quotes-before-change - c-before-change-fix-comment-escapes) + c '(c-extend-region-for-CPP + c-depropertize-CPP + c-truncate-bs-cache + c-before-change-check-unbalanced-strings + c-parse-quotes-before-change + c-before-change-fix-comment-escapes) + objc '(c-extend-region-for-CPP + c-depropertize-CPP + c-truncate-bs-cache + c-before-change-check-unbalanced-strings + c-unmark-<>-around-region + c-before-change-check-<>-operators + c-parse-quotes-before-change + c-before-change-fix-comment-escapes) java '(c-parse-quotes-before-change c-unmark-<>-around-region c-before-change-check-unbalanced-strings @@ -504,14 +512,24 @@ c-before-font-lock-functions c-after-change-escape-NL-in-string c-after-change-mark-abnormal-strings c-change-expand-fl-region) - (c objc) '(c-depropertize-new-text - c-after-change-fix-comment-escapes - c-after-change-escape-NL-in-string - c-parse-quotes-after-change - c-after-change-mark-abnormal-strings - c-extend-font-lock-region-for-macros - c-neutralize-syntax-in-CPP - c-change-expand-fl-region) + c '(c-depropertize-new-text + c-after-change-fix-comment-escapes + c-after-change-escape-NL-in-string + c-parse-quotes-after-change + c-after-change-mark-abnormal-strings + c-extend-font-lock-region-for-macros + c-neutralize-syntax-in-CPP + c-change-expand-fl-region) + objc '(c-depropertize-new-text + c-after-change-fix-comment-escapes + c-after-change-escape-NL-in-string + c-parse-quotes-after-change + c-after-change-mark-abnormal-strings + c-unmark-<>-around-region + c-extend-font-lock-region-for-macros + c-neutralize-syntax-in-CPP + c-restore-<>-properties + c-change-expand-fl-region) c++ '(c-depropertize-new-text c-after-change-fix-comment-escapes c-after-change-escape-NL-in-string commit b34f9a44393a331c866268d93b16ad69567a3cd4 Author: Michael Albinus Date: Tue Jul 4 15:27:03 2023 +0200 Apply remote-file-name-access-timeout in desktop.el and recentf.el * doc/emacs/files.texi (File Conveniences): * doc/emacs/misc.texi (Saving Emacs Sessions): Mention remote-file-name-access-timeout. * doc/misc/tramp.texi (Frequently Asked Questions): Add note. * etc/NEWS: Explain use of 'remote-file-name-access-timeout' in desktop.el and recentf.el. * lisp/desktop.el (desktop-access-file): New defun. (desktop-restore-file-buffer): Use it. * lisp/recentf.el (recentf-access-file): New defun. (recentf-keep-default-predicate): Use it. * lisp/net/tramp.el (tramp-handle-access-file): Improve error handling. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 74315a05bbd..43140f5da0f 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2255,6 +2255,12 @@ File Conveniences current @code{recentf-list} to a file, and @kbd{M-x recentf-edit-list} edits it. +@vindex remote-file-name-access-timeout + If you use remote files, you might also consider to customize +@code{remote-file-name-access-timeout} to a proper value (number of +seconds), after which time a check whether a remote file shall be used +in Recentf is stopped. This prevents Emacs to be blocked. + @c FIXME partial-completion-mode (complete.el) is obsolete. The @kbd{M-x ffap} command generalizes @code{find-file} with more powerful heuristic defaults (@pxref{FFAP}), often based on the text at diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 37da6b5956d..042829002db 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2812,9 +2812,13 @@ Saving Emacs Sessions according to your customizations in the init file. @vindex desktop-files-not-to-save +@vindex remote-file-name-access-timeout Information about buffers visiting remote files is not saved by default. Customize the variable @code{desktop-files-not-to-save} to -change this. +change this. In this case, you might also consider to customize +@code{remote-file-name-access-timeout} to a proper value (number of +seconds), after which time a buffer restoration of a remote file is +stopped. This prevents Emacs to be blocked. @vindex desktop-restore-eager By default, all the buffers in the desktop are restored in one go. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index a965dd89e71..890d4c0c07a 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -5181,6 +5181,11 @@ Frequently Asked Questions this requires an interactive password, the timeout check doesn't work properly. +@c Since Emacs 30. +@strong{Note}: In recent versions of Emacs, both packages apply +already this check. You just need to customize +@code{remote-file-name-access-timeout}. + @item Does @value{tramp} support @acronym{SSH} security keys? diff --git a/etc/NEWS b/etc/NEWS index ad9ce9114c8..be2327c5a8d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -454,6 +454,24 @@ which makes them visually distinct from subroutine prototypes. CPerl mode supports the new keywords for exception handling and the object oriented syntax which were added in Perl 5.36 and 5.38. +** Emacs Sessions (Desktop) + ++++ +*** Restoring buffers with remote files should not block. +When a buffer is restored which uses a remote file, the user option +'remote-file-name-access-timeout' could be set to a positive number. +This value will be used as timeout (in seconds) for checking, whether +the remote file is accessible. + +** Recentf + ++++ +*** Checking recent remote files should not block. +When a a remote file is checked in 'recentf-list', the user option +'remote-file-name-access-timeout' could be set to a positive number. +This value will be used as timeout (in seconds) for checking, whether +the remote file is accessible. + * New Modes and Packages in Emacs 30.1 diff --git a/lisp/desktop.el b/lisp/desktop.el index 6aacb85c12c..cb5cbbd1ef2 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1499,6 +1499,11 @@ desktop-revert (desktop-clear) (desktop-read desktop-dirname)) +;; ---------------------------------------------------------------------------- +(defun desktop-access-file (filename) + "Check whether FILENAME is accessible." + (ignore-errors (not (access-file filename "Restoring desktop buffer")))) + (defvar desktop-buffer-major-mode) (defvar desktop-buffer-locals) (defvar auto-insert) ; from autoinsert.el @@ -1508,8 +1513,8 @@ desktop-restore-file-buffer _buffer-misc) "Restore a file buffer." (when buffer-filename - (if (or (file-exists-p buffer-filename) - (let ((msg (format "Desktop: File \"%s\" no longer exists." + (if (or (desktop-access-file buffer-filename) + (let ((msg (format "Desktop: File \"%s\" no longer accessible." buffer-filename))) (if desktop-missing-file-warning (y-or-n-p (concat msg " Re-create buffer? ")) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 39e70e99fa7..b8345dcff49 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3993,9 +3993,14 @@ tramp-handle-access-file (with-parsed-tramp-file-name filename v (with-tramp-timeout (timeout + (unless (when-let ((p (tramp-get-connection-process v))) + (and (process-live-p p) + (tramp-get-connection-property p "connected"))) + (tramp-cleanup-connection v 'keep-debug 'keep-password)) (tramp-error v 'file-error - (format "%s: Timeout %s second(s) accessing %s" string timeout filename))) + (format + "%s: Timeout %s second(s) accessing %s" string timeout filename))) (setq filename (file-truename filename)) (if (file-exists-p filename) (unless diff --git a/lisp/recentf.el b/lisp/recentf.el index 7816c005358..94ae871763b 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -112,11 +112,15 @@ recentf-exclude :group 'recentf :type '(repeat (choice regexp function))) +(defun recentf-access-file (filename) + "Check whether FILENAME is accessible." + (ignore-errors (not (access-file filename "Checking recentf file")))) + (defun recentf-keep-default-predicate (file) "Return non-nil if FILE should be kept in the recent list. It handles the case of remote files as well." (cond - ((file-remote-p file nil t) (file-readable-p file)) + ((file-remote-p file nil t) (recentf-access-file file)) ((file-remote-p file)) ((file-readable-p file)))) commit 793a416653af0e4be5b6adec9323a1dafd1545eb Author: Alan Mackenzie Date: Tue Jul 4 12:43:31 2023 +0000 objc-mode: Fix exceptions in fontification. These exceptions ("Invalid search bound (wrong side of point)") were observed in test suite file class-24.m when moving point up and down a line at a time. * lisp/progmodes/cc-engine.el (c-forward-declarator): In the c-syntactic-re-search-forward ~30 lines from the end of the function amend the regexp for objc-mode such that "@end" terminates the search, but "<" doesn't. * lisp/progmodes/cc-fonts.el (c-make-font-lock-search-function): supply a non-nil CHECK-POINT argument to c-make-font-lock-search-form. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 721daf9d53f..abcc20fcb82 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10219,7 +10219,11 @@ c-forward-declarator (prog1 (setq found (c-syntactic-re-search-forward - "[;:,]\\|\\(=\\|\\s(\\)" + ;; Consider making the next regexp a + ;; c-lang-defvar (2023-07-04). + (if (c-major-mode-is 'objc-mode) + "\\(?:@end\\)\\|[;:,]\\|\\(=\\|[[(]\\)" + "[;:,]\\|\\(=\\|\\s(\\)") limit 'limit t)) (setq got-init (and found (match-beginning 1)))) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index afbf841bcb1..5d5ada4c99d 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -387,7 +387,7 @@ c-annotation-face (parse-sexp-lookup-properties (cc-eval-when-compile (boundp 'parse-sexp-lookup-properties)))) - ,(c-make-font-lock-search-form regexp highlights)) + ,(c-make-font-lock-search-form regexp highlights t)) nil))) (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights) commit ec89acba5f5652b661f364c5f4e9c43b85a2f433 Author: Mattias Engdegård Date: Tue Jul 4 10:49:48 2023 +0200 ; * test/lisp/progmodes/cperl-mode-tests.el: add missing backslashes diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 0ca985ae86e..211587cabac 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -233,7 +233,7 @@ cperl-test-fontify-class 'font-lock-constant-face))) ;; The signature (goto-char (point-min)) - (search-forward-regexp "\\(\$top\\),\\(\$down\\)") + (search-forward-regexp "\\(\\$top\\),\\(\\$down\\)") (should (equal (get-text-property (match-beginning 1) 'face) 'font-lock-variable-name-face)) (should (equal (get-text-property (match-beginning 1) 'face)