[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b4824faa622 2/2: Merge branch 'master' of git.savannah.gnu.org:/s
From: |
Eli Zaretskii |
Subject: |
master b4824faa622 2/2: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs |
Date: |
Sat, 22 Jul 2023 08:56:18 -0400 (EDT) |
branch: master
commit b4824faa62272823d1e6326682a1f5c303498f7e
Merge: a9210e8efd6 297cf9d5bf0
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
doc/emacs/files.texi | 7 ++++---
doc/lispref/files.texi | 11 +++++++++++
doc/misc/tramp.texi | 33 +++++++++++++++++++++++----------
etc/EGLOT-NEWS | 7 +++----
etc/NEWS | 25 +++++++++++++++++++++----
lisp/net/tramp.el | 19 +++++++++++++++++++
lisp/progmodes/eglot.el | 12 +++++-------
lisp/thingatpt.el | 7 ++++++-
test/lisp/net/tramp-archive-tests.el | 14 ++++++++++++++
test/lisp/net/tramp-tests.el | 17 ++++++++++++++++-
10 files changed, 122 insertions(+), 30 deletions(-)
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 9734223b95e..ac7751ceb53 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -2093,10 +2093,11 @@ Otherwise, Emacs uses @command{ssh}.
@end enumerate
@cindex disabling remote files
+@cindex inhibit-remote-files
@noindent
-You can entirely turn off the remote file name feature by setting the
-variable @code{tramp-mode} to @code{nil}. You can turn off the
-feature in individual cases by quoting the file name with @samp{/:}
+You can entirely turn off the remote file name feature by running
+@kbd{M-x inhibit-remote-files}. You can turn off the feature in
+individual cases by quoting the file name with @samp{/:}
(@pxref{Quoted File Names}).
@cindex @code{ange-ftp}
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 31d4aaca507..aaab4e455a0 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3698,6 +3698,17 @@ between consecutive checks. For example:
@end example
@end defopt
+@defmac without-remote-files body@dots{}
+The @code{without-remote-files} macro evaluates the @var{body} forms
+with deactivated file name handlers for remote files. Those file
+names would be handled literally.
+
+The macro should be used only in forms where it is obvious, that
+remote files cannot appear or where it is intended not to handle
+remote file names. It also reduces checks with
+@code{file-name-handler-alist}, resulting in more performant code.
+@end defmac
+
@node Format Conversion
@section File Format Conversion
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index ff2a66ae720..1d8e0095328 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -5851,16 +5851,6 @@ If you want to enable Ange FTP's syntax, add the
following form:
(tramp-change-syntax 'simplified)
@end lisp
-@item
-@vindex tramp-mode
-To disable both @value{tramp} (and Ange FTP), set @code{tramp-mode} to
-@code{nil} in @file{.emacs}. @strong{Note}, that we don't use
-@code{customize-set-variable}, in order to avoid loading @value{tramp}.
-
-@lisp
-(setq tramp-mode nil)
-@end lisp
-
@item
@vindex tramp-ignored-file-name-regexp
To deactivate @value{tramp} for some look-alike remote file names, set
@@ -5877,6 +5867,29 @@ This is needed, if you mount for example a virtual file
system on your
local host's root directory as @file{/ssh:example.com:}.
@item
+@findex inhibit-remote-files
+To disable both @value{tramp} (and Ange FTP), type @kbd{M-x
+inhibit-remote-files @key{RET}}. You can also add this to your
+@file{.emacs}.
+
+@lisp
+(inhibit-remote-files)
+@end lisp
+
+@item
+@findex without-remote-files
+If you write code, which is intended to run only for local files, you
+can use the @code{without-remote-files} macro.
+
+@lisp
+(without-remote-files @dots{})
+@end lisp
+
+This improves performance, because many primitive file name operations
+don't check any longer for Tramp file name regexps then.
+
+@item
+@findex tramp-unload-tramp
To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp @key{RET}}.
Unloading @value{tramp} resets Ange FTP plugins also.
@end itemize
diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS
index 0ccc8af3169..01f0498eb81 100644
--- a/etc/EGLOT-NEWS
+++ b/etc/EGLOT-NEWS
@@ -29,10 +29,9 @@ problem, particularly on Mac OS. See github#1228 and
github#1226.
** Fixed "onTypeFormatting" feature
-This feature wasn't triggered for the 'newline' command because
-language servers often expect 10 (linefeed) to be the trigger
-character, but 'newline' emits 13 (carriage return). Also made this
-feature less chatty in the mode-line and messages buffer.
+For 'newline' commands, Eglot sometimes sent the wrong character code
+to the server. Also made this feature less chatty in the mode-line
+and messages buffer.
* Changes in Eglot 1.15 (29/4/2023)
diff --git a/etc/NEWS b/etc/NEWS
index d1af3b1b866..c2c436fb477 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -93,11 +93,12 @@ The 'tool-bar-position' frame parameter can be set to
'bottom' on all
window systems other than Nextstep.
** cl-print
+
*** You can expand the "..." truncation everywhere.
-The code that allowed "..." to be expanded in the *Backtrace* should
-now work anywhere the data is generated by `cl-print`.
+The code that allowed "..." to be expanded in the "*Backtrace*" buffer
+should now work anywhere the data is generated by 'cl-print'.
-*** hash-tables' contents can be expanded via the ellipsis
+*** hash-tables' contents can be expanded via the ellipsis.
** Modeline elements can now be right-aligned.
Anything following the symbol 'mode-line-format-right-align' in
@@ -264,6 +265,8 @@ docstring, or a comment, or (re)indents the surrounding
defun if
point is not in a comment or a string. It is by default bound to
'M-q' in 'prog-mode' and all its descendants.
+** Which Function Mode
+
+++
*** Which Function Mode can now display function names on the header line.
The new user option 'which-func-display' allows choosing where the
@@ -300,6 +303,19 @@ sessions, respectively.
It allows to kill only selected remote buffers, controlled by user
option 'tramp-cleanup-some-buffers-hook'.
++++
+*** New command 'inhibit-remote-files'.
+This command disables the handling of file names with the special
+remote file name syntax. It should be applied only when remote files
+won't be used in this Emacs instance. It provides a slightly improved
+performance of file name handling in Emacs.
+
++++
+*** New macro 'without-remote-files'.
+This macro could wrap code which handles local files only. Due to the
+temporary deactivation of remote files, it results in a slightly
+improved performance of file name handling in Emacs.
+
** EWW
+++
@@ -602,7 +618,7 @@ behavior back for any other reason, you can do that using
the
'coding-system-put' function. For example, the following restores the
previous behavior of showing 'U' in the mode line for 'koi8-u':
- (coding-system-put 'koi8-u :mnemonic ?U)
+ (coding-system-put 'koi8-u :mnemonic ?U)
+++
** Infinities and NaNs no longer act as symbols on non-IEEE platforms.
@@ -611,6 +627,7 @@ tokens like 0.0e+NaN and 1.0e+INF are no longer read as
symbols.
Instead, the Lisp reader approximates an infinity with the nearest
finite value, and a NaN with some other non-numeric object that
provokes an error if used numerically.
+
* Lisp Changes in Emacs 30.1
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 55e1ca932e4..53a80c41680 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2967,6 +2967,25 @@ whether HANDLER is to be called. Add operations defined
in
(put #'tramp-unload-file-name-handlers 'tramp-autoload t)
(add-hook 'tramp-unload-hook #'tramp-unload-file-name-handlers)
+;;;###autoload
+(progn (defun inhibit-remote-files ()
+ "Deactivate remote file names."
+ (interactive)
+ (when (fboundp 'tramp-cleanup-all-connections)
+ (funcall 'tramp-cleanup-all-connections))
+ (tramp-unload-file-name-handlers)
+ (setq tramp-mode nil)))
+
+;;;###autoload
+(progn (defmacro without-remote-files (&rest body)
+ "Deactivate remote file names temporarily.
+Run BODY."
+ (declare (indent 0) (debug ((form body) body)))
+ `(let ((file-name-handler-alist (copy-tree file-name-handler-alist))
+ tramp-mode)
+ (tramp-unload-file-name-handlers)
+ ,@body)))
+
;;; File name handler functions for completion mode:
;; This function takes action since Emacs 28.1, when
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 172fd97fdb5..ae31985a676 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2447,18 +2447,16 @@ buffer."
(defun eglot--post-self-insert-hook ()
"Set `eglot--last-inserted-char', maybe call on-type-formatting."
- (setq eglot--last-inserted-char last-input-event)
- (let ((ot-provider (eglot--server-capable :documentOnTypeFormattingProvider))
- ;; transform carriage return into line-feed
- (adjusted-ie (if (= last-input-event 13) 10 last-input-event)))
+ (setq eglot--last-inserted-char last-command-event)
+ (let ((ot-provider (eglot--server-capable
:documentOnTypeFormattingProvider)))
(when (and ot-provider
(ignore-errors ; github#906, some LS's send empty strings
- (or (eq adjusted-ie
+ (or (eq eglot--last-inserted-char
(seq-first (plist-get ot-provider
:firstTriggerCharacter)))
- (cl-find adjusted-ie
+ (cl-find eglot--last-inserted-char
(plist-get ot-provider :moreTriggerCharacter)
:key #'seq-first))))
- (eglot-format (point) nil adjusted-ie))))
+ (eglot-format (point) nil eglot--last-inserted-char))))
(defvar eglot--workspace-symbols-cache (make-hash-table :test #'equal)
"Cache of `workspace/Symbol' results used by `xref-find-definitions'.")
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index f3367290dee..72acb0b749f 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -250,7 +250,8 @@ Prefer the enclosing string with fallback on sexp at point.
(goto-char (nth 8 ppss))
(cons (point) (progn (forward-sexp) (point))))
;; At the beginning of the string
- (if (eq (char-syntax (char-after)) ?\")
+ (if (let ((ca (char-after)))
+ (and ca (eq (char-syntax ca) ?\")))
(let ((bound (bounds-of-thing-at-point 'sexp)))
(and bound
(<= (car bound) (point)) (< (point) (cdr bound))
@@ -359,6 +360,10 @@ E.g.:
(and (file-exists-p filename)
filename)))
+(put 'existing-filename 'bounds-of-thing-at-point
+ (lambda ()
+ (and (thing-at-point 'existing-filename)
+ (bounds-of-thing-at-point 'filename))))
(put 'existing-filename 'thing-at-point 'thing-at-point-file-at-point)
;; Faces
diff --git a/test/lisp/net/tramp-archive-tests.el
b/test/lisp/net/tramp-archive-tests.el
index 5485b12f74f..e34e830cb83 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -988,6 +988,20 @@ This tests also `file-executable-p', `file-writable-p' and
`set-file-modes'."
code tae tramp-archive-test-file-archive
(concat tramp-archive-test-archive "foo"))))))))))
+(ert-deftest tramp-archive-test49-without-remote-files ()
+ "Check that Tramp can be suppressed."
+ (skip-unless tramp-archive-enabled)
+
+ (should (file-exists-p tramp-archive-test-archive))
+ (should-not (without-remote-files (file-exists-p
tramp-archive-test-archive)))
+ (should (file-exists-p tramp-archive-test-archive))
+
+ (inhibit-remote-files)
+ (should-not (file-exists-p tramp-archive-test-archive))
+ (tramp-register-file-name-handlers)
+ (setq tramp-mode t)
+ (should (file-exists-p tramp-archive-test-archive)))
+
(ert-deftest tramp-archive-test99-libarchive-tests ()
"Run tests of libarchive test files."
:tags '(:expensive-test :unstable)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 16afc0f477a..9bc8ad8ce39 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -8009,7 +8009,22 @@ process sentinels. They shall not disturb each other."
(mapconcat #'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
-(ert-deftest tramp-test49-unload ()
+(ert-deftest tramp-test49-without-remote-files ()
+ "Check that Tramp can be suppressed."
+ (skip-unless (tramp--test-enabled))
+
+ (should (file-remote-p ert-remote-temporary-file-directory))
+ (should-not
+ (without-remote-files (file-remote-p ert-remote-temporary-file-directory)))
+ (should (file-remote-p ert-remote-temporary-file-directory))
+
+ (inhibit-remote-files)
+ (should-not (file-remote-p ert-remote-temporary-file-directory))
+ (tramp-register-file-name-handlers)
+ (setq tramp-mode t)
+ (should (file-remote-p ert-remote-temporary-file-directory)))
+
+(ert-deftest tramp-test50-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b4824faa622 2/2: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs,
Eli Zaretskii <=