aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-07-05 08:45:06 +0800
committerPo Lu2023-07-05 08:45:06 +0800
commit2443f4ec77ffdb2a5b59e243b50ee04cd4f2eb1f (patch)
tree7af7dff4748596e9435d5f744054e335bbf6e02a
parent8ed8f08ed2ff297754d6db83983d3f8f2822c599 (diff)
parentcb674ab40ce8bffe566c6851cf2ac5261152f004 (diff)
downloademacs-2443f4ec77ffdb2a5b59e243b50ee04cd4f2eb1f.tar.gz
emacs-2443f4ec77ffdb2a5b59e243b50ee04cd4f2eb1f.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rw-r--r--doc/emacs/files.texi6
-rw-r--r--doc/emacs/misc.texi6
-rw-r--r--doc/misc/tramp.texi10
-rw-r--r--etc/NEWS19
-rw-r--r--lisp/desktop.el16
-rw-r--r--lisp/net/tramp.el7
-rw-r--r--lisp/progmodes/cc-engine.el6
-rw-r--r--lisp/progmodes/cc-fonts.el2
-rw-r--r--lisp/progmodes/cc-langs.el46
-rw-r--r--lisp/progmodes/cperl-mode.el11
-rw-r--r--lisp/recentf.el6
-rw-r--r--lisp/simple.el2
-rw-r--r--test/lisp/progmodes/cperl-mode-tests.el2
13 files changed, 110 insertions, 29 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 74315a05bbd..9734223b95e 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -2255,6 +2255,12 @@ to visit one of these files. @kbd{M-x recentf-save-list} saves the
2255current @code{recentf-list} to a file, and @kbd{M-x recentf-edit-list} 2255current @code{recentf-list} to a file, and @kbd{M-x recentf-edit-list}
2256edits it. 2256edits it.
2257 2257
2258@vindex remote-file-name-access-timeout
2259 If you use remote files, you might also consider customizing
2260@code{remote-file-name-access-timeout}, which is the number of
2261seconds after which the check whether a remote file shall be used
2262in Recentf is stopped. This prevents Emacs being blocked.
2263
2258@c FIXME partial-completion-mode (complete.el) is obsolete. 2264@c FIXME partial-completion-mode (complete.el) is obsolete.
2259 The @kbd{M-x ffap} command generalizes @code{find-file} with more 2265 The @kbd{M-x ffap} command generalizes @code{find-file} with more
2260powerful heuristic defaults (@pxref{FFAP}), often based on the text at 2266powerful heuristic defaults (@pxref{FFAP}), often based on the text at
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 37da6b5956d..7a88b7ef5e0 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2812,9 +2812,13 @@ frame parameters you don't want to be restored; they will then be set
2812according to your customizations in the init file. 2812according to your customizations in the init file.
2813 2813
2814@vindex desktop-files-not-to-save 2814@vindex desktop-files-not-to-save
2815@vindex remote-file-name-access-timeout
2815 Information about buffers visiting remote files is not saved by 2816 Information about buffers visiting remote files is not saved by
2816default. Customize the variable @code{desktop-files-not-to-save} to 2817default. Customize the variable @code{desktop-files-not-to-save} to
2817change this. 2818change this. In this case, you might also consider customizing
2819@code{remote-file-name-access-timeout}, which is the number of
2820seconds after which buffer restoration of a remote file is
2821stopped. This prevents Emacs being blocked.
2818 2822
2819@vindex desktop-restore-eager 2823@vindex desktop-restore-eager
2820 By default, all the buffers in the desktop are restored in one go. 2824 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..4973ab2c9b1 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -5158,10 +5158,10 @@ In order to disable those optimizations, set user option
5158 5158
5159@vindex remote-file-name-access-timeout 5159@vindex remote-file-name-access-timeout
5160Some packages, like @file{desktop.el} or @file{recentf.el}, access 5160Some packages, like @file{desktop.el} or @file{recentf.el}, access
5161remote files when loaded. If the respective file is not accessible, 5161remote files when loaded. If the requested file is not accessible,
5162@value{tramp} could block. In order to check whether this could 5162@value{tramp} could block. In order to check whether this could
5163happen, add a test via @code{access-file} with a proper timeout prior 5163happen, add a test via @code{access-file} with a proper timeout prior
5164loading these packages: 5164to loading these packages:
5165 5165
5166@lisp 5166@lisp
5167@group 5167@group
@@ -5181,6 +5181,12 @@ If the connection to the remote host isn't established yet, and if
5181this requires an interactive password, the timeout check doesn't work 5181this requires an interactive password, the timeout check doesn't work
5182properly. 5182properly.
5183 5183
5184@c Since Emacs 30.
5185@strong{Note}: In recent versions of Emacs, both packages already
5186apply this check. You just need to customize
5187@code{remote-file-name-access-timeout} to the desired timeout (in
5188seconds).
5189
5184 5190
5185@item 5191@item
5186Does @value{tramp} support @acronym{SSH} security keys? 5192Does @value{tramp} support @acronym{SSH} security keys?
diff --git a/etc/NEWS b/etc/NEWS
index 30523a08903..aadd5a52ee2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -476,6 +476,25 @@ which makes them visually distinct from subroutine prototypes.
476CPerl mode supports the new keywords for exception handling and the 476CPerl mode supports the new keywords for exception handling and the
477object oriented syntax which were added in Perl 5.36 and 5.38. 477object oriented syntax which were added in Perl 5.36 and 5.38.
478 478
479** Emacs Sessions (Desktop)
480
481+++
482*** Restoring buffers visiting remote files can now time out.
483When a buffer is restored which visits a remote file, the restoration
484of the session could hang if the remote host is off-line or slow to
485respond. Setting the user option 'remote-file-name-access-timeout' to
486a positive number will abandon the attempt to restore such buffers
487after a timeout of that many seconds, thus allowing the rest of
488desktop restoration to continue.
489
490** Recentf
491
492+++
493*** Checking recent remote files can now time out.
494Similarly to buffer restoration by "desktop", 'recentf-mode' checking
495of the accessibility of remote files can now time out if
496`remote-file-name-access-timeout' is set to a positive number.
497
479 498
480* New Modes and Packages in Emacs 30.1 499* New Modes and Packages in Emacs 30.1
481 500
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 6aacb85c12c..59298699914 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -397,7 +397,12 @@ or `desktop-modes-not-to-save'."
397(defcustom desktop-files-not-to-save 397(defcustom desktop-files-not-to-save
398 "\\(\\`/[^/:]*:\\|(ftp)\\'\\)" 398 "\\(\\`/[^/:]*:\\|(ftp)\\'\\)"
399 "Regexp identifying files whose buffers are to be excluded from saving. 399 "Regexp identifying files whose buffers are to be excluded from saving.
400The default value excludes buffers visiting remote files." 400The default value excludes buffers visiting remote files.
401
402If you modify this such that buffers visiting remote files are not excluded,
403you may wish customizing `remote-file-name-access-timeout' to a non-nil
404value, to avoid hanging the desktop restoration because some remote
405host is off-line."
401 :type '(choice (const :tag "None" nil) 406 :type '(choice (const :tag "None" nil)
402 regexp) 407 regexp)
403 :group 'desktop) 408 :group 'desktop)
@@ -1499,6 +1504,11 @@ This function is called from `window-configuration-change-hook'."
1499 (desktop-clear) 1504 (desktop-clear)
1500 (desktop-read desktop-dirname)) 1505 (desktop-read desktop-dirname))
1501 1506
1507;; ----------------------------------------------------------------------------
1508(defun desktop-access-file (filename)
1509 "Check whether FILENAME is accessible."
1510 (ignore-errors (not (access-file filename "Restoring desktop buffer"))))
1511
1502(defvar desktop-buffer-major-mode) 1512(defvar desktop-buffer-major-mode)
1503(defvar desktop-buffer-locals) 1513(defvar desktop-buffer-locals)
1504(defvar auto-insert) ; from autoinsert.el 1514(defvar auto-insert) ; from autoinsert.el
@@ -1508,8 +1518,8 @@ This function is called from `window-configuration-change-hook'."
1508 _buffer-misc) 1518 _buffer-misc)
1509 "Restore a file buffer." 1519 "Restore a file buffer."
1510 (when buffer-filename 1520 (when buffer-filename
1511 (if (or (file-exists-p buffer-filename) 1521 (if (or (desktop-access-file buffer-filename)
1512 (let ((msg (format "Desktop: File \"%s\" no longer exists." 1522 (let ((msg (format "Desktop: File \"%s\" no longer accessible."
1513 buffer-filename))) 1523 buffer-filename)))
1514 (if desktop-missing-file-warning 1524 (if desktop-missing-file-warning
1515 (y-or-n-p (concat msg " Re-create buffer? ")) 1525 (y-or-n-p (concat msg " Re-create buffer? "))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index f1d4997ba4f..e83f58f4eb2 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3998,9 +3998,14 @@ Let-bind it when necessary.")
3998 (with-parsed-tramp-file-name filename v 3998 (with-parsed-tramp-file-name filename v
3999 (with-tramp-timeout 3999 (with-tramp-timeout
4000 (timeout 4000 (timeout
4001 (unless (when-let ((p (tramp-get-connection-process v)))
4002 (and (process-live-p p)
4003 (tramp-get-connection-property p "connected")))
4004 (tramp-cleanup-connection v 'keep-debug 'keep-password))
4001 (tramp-error 4005 (tramp-error
4002 v 'file-error 4006 v 'file-error
4003 (format "%s: Timeout %s second(s) accessing %s" string timeout filename))) 4007 (format
4008 "%s: Timeout %s second(s) accessing %s" string timeout filename)))
4004 (setq filename (file-truename filename)) 4009 (setq filename (file-truename filename))
4005 (if (file-exists-p filename) 4010 (if (file-exists-p filename)
4006 (unless 4011 (unless
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 @@ point unchanged and return nil."
10219 (prog1 10219 (prog1
10220 (setq found 10220 (setq found
10221 (c-syntactic-re-search-forward 10221 (c-syntactic-re-search-forward
10222 "[;:,]\\|\\(=\\|\\s(\\)" 10222 ;; Consider making the next regexp a
10223 ;; c-lang-defvar (2023-07-04).
10224 (if (c-major-mode-is 'objc-mode)
10225 "\\(?:@end\\)\\|[;:,]\\|\\(=\\|[[(]\\)"
10226 "[;:,]\\|\\(=\\|\\s(\\)")
10223 limit 'limit t)) 10227 limit 'limit t))
10224 (setq got-init 10228 (setq got-init
10225 (and found (match-beginning 1)))) 10229 (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 @@
387 (parse-sexp-lookup-properties 387 (parse-sexp-lookup-properties
388 (cc-eval-when-compile 388 (cc-eval-when-compile
389 (boundp 'parse-sexp-lookup-properties)))) 389 (boundp 'parse-sexp-lookup-properties))))
390 ,(c-make-font-lock-search-form regexp highlights)) 390 ,(c-make-font-lock-search-form regexp highlights t))
391 nil))) 391 nil)))
392 392
393 (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights) 393 (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights)
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 @@ so that all identifiers are recognized as words.")
462 c-before-change-check-unbalanced-strings 462 c-before-change-check-unbalanced-strings
463 c-parse-quotes-before-change 463 c-parse-quotes-before-change
464 c-before-change-fix-comment-escapes) 464 c-before-change-fix-comment-escapes)
465 (c objc) '(c-extend-region-for-CPP 465 c '(c-extend-region-for-CPP
466 c-depropertize-CPP 466 c-depropertize-CPP
467 c-truncate-bs-cache 467 c-truncate-bs-cache
468 c-before-change-check-unbalanced-strings 468 c-before-change-check-unbalanced-strings
469 c-parse-quotes-before-change 469 c-parse-quotes-before-change
470 c-before-change-fix-comment-escapes) 470 c-before-change-fix-comment-escapes)
471 objc '(c-extend-region-for-CPP
472 c-depropertize-CPP
473 c-truncate-bs-cache
474 c-before-change-check-unbalanced-strings
475 c-unmark-<>-around-region
476 c-before-change-check-<>-operators
477 c-parse-quotes-before-change
478 c-before-change-fix-comment-escapes)
471 java '(c-parse-quotes-before-change 479 java '(c-parse-quotes-before-change
472 c-unmark-<>-around-region 480 c-unmark-<>-around-region
473 c-before-change-check-unbalanced-strings 481 c-before-change-check-unbalanced-strings
@@ -504,14 +512,24 @@ parameters \(point-min) and \(point-max).")
504 c-after-change-escape-NL-in-string 512 c-after-change-escape-NL-in-string
505 c-after-change-mark-abnormal-strings 513 c-after-change-mark-abnormal-strings
506 c-change-expand-fl-region) 514 c-change-expand-fl-region)
507 (c objc) '(c-depropertize-new-text 515 c '(c-depropertize-new-text
508 c-after-change-fix-comment-escapes 516 c-after-change-fix-comment-escapes
509 c-after-change-escape-NL-in-string 517 c-after-change-escape-NL-in-string
510 c-parse-quotes-after-change 518 c-parse-quotes-after-change
511 c-after-change-mark-abnormal-strings 519 c-after-change-mark-abnormal-strings
512 c-extend-font-lock-region-for-macros 520 c-extend-font-lock-region-for-macros
513 c-neutralize-syntax-in-CPP 521 c-neutralize-syntax-in-CPP
514 c-change-expand-fl-region) 522 c-change-expand-fl-region)
523 objc '(c-depropertize-new-text
524 c-after-change-fix-comment-escapes
525 c-after-change-escape-NL-in-string
526 c-parse-quotes-after-change
527 c-after-change-mark-abnormal-strings
528 c-unmark-<>-around-region
529 c-extend-font-lock-region-for-macros
530 c-neutralize-syntax-in-CPP
531 c-restore-<>-properties
532 c-change-expand-fl-region)
515 c++ '(c-depropertize-new-text 533 c++ '(c-depropertize-new-text
516 c-after-change-fix-comment-escapes 534 c-after-change-fix-comment-escapes
517 c-after-change-escape-NL-in-string 535 c-after-change-escape-NL-in-string
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index bcaa176e8cd..165f0792968 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1305,7 +1305,8 @@ or \"${ foo }\" will not.")
1305 "A sequence for recommended version number schemes in Perl.") 1305 "A sequence for recommended version number schemes in Perl.")
1306 1306
1307 (defconst cperl--single-attribute-rx 1307 (defconst cperl--single-attribute-rx
1308 `(sequence ,cperl--basic-identifier-rx 1308 `(sequence word-start
1309 ,cperl--basic-identifier-rx
1309 (optional (sequence "(" 1310 (optional (sequence "("
1310 (0+ (not (in ")"))) 1311 (0+ (not (in ")")))
1311 ")"))) 1312 ")")))
@@ -1552,7 +1553,7 @@ the last)."
1552 (if attr (concat 1553 (if attr (concat
1553 "\\(" 1554 "\\("
1554 cperl-maybe-white-and-comment-rex ; whitespace-comments 1555 cperl-maybe-white-and-comment-rex ; whitespace-comments
1555 "\\(\\sw\\|_\\)+" ; attr-name 1556 "\\(\\<\\sw\\|_\\)+" ; attr-name
1556 ;; attr-arg (1 level of internal parens allowed!) 1557 ;; attr-arg (1 level of internal parens allowed!)
1557 "\\((\\(\\\\.\\|[^\\()]\\|([^\\()]*)\\)*)\\)?" 1558 "\\((\\(\\\\.\\|[^\\()]\\|([^\\()]*)\\)*)\\)?"
1558 "\\(" ; optional : (XXX allows trailing???) 1559 "\\(" ; optional : (XXX allows trailing???)
@@ -6003,7 +6004,11 @@ default function."
6003 ;; ... or the start of a "sloppy" signature 6004 ;; ... or the start of a "sloppy" signature
6004 (sequence (eval cperl--sloppy-signature-rx) 6005 (sequence (eval cperl--sloppy-signature-rx)
6005 ;; arbtrarily continue "a few lines" 6006 ;; arbtrarily continue "a few lines"
6006 (repeat 0 200 (not (in "{")))))))) 6007 (repeat 0 200 (not (in "{"))))
6008 ;; make sure we have a reasonably
6009 ;; short match for an incomplete sub
6010 (not (in ";{("))
6011 buffer-end))))
6007 '(1 (if (match-beginning 3) 6012 '(1 (if (match-beginning 3)
6008 'font-lock-variable-name-face 6013 'font-lock-variable-name-face
6009 'font-lock-function-name-face) 6014 'font-lock-function-name-face)
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 @@ must return non-nil to exclude it."
112 :group 'recentf 112 :group 'recentf
113 :type '(repeat (choice regexp function))) 113 :type '(repeat (choice regexp function)))
114 114
115(defun recentf-access-file (filename)
116 "Check whether FILENAME is accessible."
117 (ignore-errors (not (access-file filename "Checking recentf file"))))
118
115(defun recentf-keep-default-predicate (file) 119(defun recentf-keep-default-predicate (file)
116 "Return non-nil if FILE should be kept in the recent list. 120 "Return non-nil if FILE should be kept in the recent list.
117It handles the case of remote files as well." 121It handles the case of remote files as well."
118 (cond 122 (cond
119 ((file-remote-p file nil t) (file-readable-p file)) 123 ((file-remote-p file nil t) (recentf-access-file file))
120 ((file-remote-p file)) 124 ((file-remote-p file))
121 ((file-readable-p file)))) 125 ((file-readable-p file))))
122 126
diff --git a/lisp/simple.el b/lisp/simple.el
index d78407e05bb..4bb6ab7a7f5 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4735,7 +4735,7 @@ impose the use of a shell (with its need to quote arguments)."
4735 (when (buffer-live-p buf) 4735 (when (buffer-live-p buf)
4736 (remove-function (process-filter proc) 4736 (remove-function (process-filter proc)
4737 nonce) 4737 nonce)
4738 (display-buffer buf)))) 4738 (display-buffer buf '(nil (allow-no-window . t))))))
4739 `((name . ,nonce))))))) 4739 `((name . ,nonce)))))))
4740 ;; Otherwise, command is executed synchronously. 4740 ;; Otherwise, command is executed synchronously.
4741 (shell-command-on-region (point) (point) command 4741 (shell-command-on-region (point) (point) command
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 @@ attributes, prototypes and signatures."
233 'font-lock-constant-face))) 233 'font-lock-constant-face)))
234 ;; The signature 234 ;; The signature
235 (goto-char (point-min)) 235 (goto-char (point-min))
236 (search-forward-regexp "\\(\$top\\),\\(\$down\\)") 236 (search-forward-regexp "\\(\\$top\\),\\(\\$down\\)")
237 (should (equal (get-text-property (match-beginning 1) 'face) 237 (should (equal (get-text-property (match-beginning 1) 'face)
238 'font-lock-variable-name-face)) 238 'font-lock-variable-name-face))
239 (should (equal (get-text-property (match-beginning 1) 'face) 239 (should (equal (get-text-property (match-beginning 1) 'face)