[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 2443f4ec77f: Merge remote-tracking branch 'origin/master
From: |
Po Lu |
Subject: |
feature/android 2443f4ec77f: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Tue, 4 Jul 2023 20:45:55 -0400 (EDT) |
branch: feature/android
commit 2443f4ec77ffdb2a5b59e243b50ee04cd4f2eb1f
Merge: 8ed8f08ed2f cb674ab40ce
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
doc/emacs/files.texi | 6 +++++
doc/emacs/misc.texi | 6 ++++-
doc/misc/tramp.texi | 10 +++++--
etc/NEWS | 19 ++++++++++++++
lisp/desktop.el | 16 +++++++++---
lisp/net/tramp.el | 7 ++++-
lisp/progmodes/cc-engine.el | 6 ++++-
lisp/progmodes/cc-fonts.el | 2 +-
lisp/progmodes/cc-langs.el | 46 +++++++++++++++++++++++----------
lisp/progmodes/cperl-mode.el | 11 +++++---
lisp/recentf.el | 6 ++++-
lisp/simple.el | 2 +-
test/lisp/progmodes/cperl-mode-tests.el | 2 +-
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
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 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
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..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
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 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.
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
@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
@@ -5181,6 +5181,12 @@ If the connection to the remote host isn't established
yet, and if
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 already
+apply this check. You just need to customize
+@code{remote-file-name-access-timeout} to the desired timeout (in
+seconds).
+
@item
Does @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.
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 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
+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
+
++++
+*** 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
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'."
(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)
@@ -1499,6 +1504,11 @@ This function is called from
`window-configuration-change-hook'."
(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 +1518,8 @@ This function is called from
`window-configuration-change-hook'."
_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 f1d4997ba4f..e83f58f4eb2 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3998,9 +3998,14 @@ Let-bind it when necessary.")
(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/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."
(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 @@
(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)
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.")
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 @@ parameters \(point-min) and \(point-max).")
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
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.")
"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 @@ the last)."
(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 @@ default function."
;; ... 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)
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."
: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))))
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)."
(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
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."
'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)