From 7263631dca6145354e994d84c9ff3e09c450739b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jul 2022 11:11:47 +0300 Subject: [PATCH 1/4] Fix bookmark support for Help functions in native-compilation builds * lisp/help.el (describe-key--helper, describe-function--helper): New helper functions. (describe-key): Call 'describe-key--helper' instead of a lambda-function. * lisp/help-fns.el (describe-function): Call 'describe-function--helper' instead of a lambda-function. (Bug#56643) --- lisp/help-fns.el | 10 +++------- lisp/help.el | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 6a7951d160e..656e7b7da24 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -251,13 +251,9 @@ handling of autoloaded functions." (or describe-function-orig-buffer (current-buffer)))) - (help-setup-xref - (list (lambda (function buffer) - (let ((describe-function-orig-buffer - (if (buffer-live-p buffer) buffer))) - (describe-function function))) - function describe-function-orig-buffer) - (called-interactively-p 'interactive)) + (help-setup-xref (list #'describe-function--helper + function describe-function-orig-buffer) + (called-interactively-p 'interactive)) (save-excursion (with-help-window (help-buffer) diff --git a/lisp/help.el b/lisp/help.el index fd331ac0d48..0701bf178aa 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -881,6 +881,19 @@ Describe the following key, mouse click, or menu item: " (setq yank-menu (copy-sequence saved-yank-menu)) (fset 'yank-menu (cons 'keymap yank-menu)))))) +;; These two are named functions because lambda-functions cannot be +;; serialized in a native-compilation build, which breaks bookmark +;; support in help-mode.el. +(defun describe-key--helper (key-list buf) + (describe-key key-list + (if (buffer-live-p buf) buf))) + +(defvar describe-function-orig-buffer) +(defun describe-function--helper (func buf) + (let ((describe-function-orig-buffer + (if (buffer-live-p buf) buf))) + (describe-function func))) + (defun describe-key (&optional key-list buffer up-event) "Display documentation of the function invoked by KEY-LIST. KEY-LIST can be any kind of a key sequence; it can include keyboard events, @@ -926,10 +939,7 @@ current buffer." `(,seq ,brief-desc ,defn ,locus))) key-list)) 2))) - (help-setup-xref (list (lambda (key-list buf) - (describe-key key-list - (if (buffer-live-p buf) buf))) - key-list buf) + (help-setup-xref (list #'describe-key--helper key-list buf) (called-interactively-p 'interactive)) (if (and (<= (length info-list) 1) (help--binding-undefined-p (nth 2 (car info-list)))) From 54c4ceb0091e0d3190755afbd7875864cd91b730 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jul 2022 12:54:07 +0300 Subject: [PATCH 2/4] Update the documentation of 'declare' forms * doc/lispref/compile.texi (Native-Compilation Variables): Mention the 'declare' alternative for 'native-comp-speed'. * doc/lispref/functions.texi (Declare Form): Document 'declare' forms that were previously undocumented. --- doc/lispref/compile.texi | 4 +++- doc/lispref/functions.texi | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 335200469b2..f336753a6c3 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -985,7 +985,9 @@ corresponding compiler @option{-O0}, @option{-O1}, etc.@: command-line options of the compiler. The value @minus{}1 means disable native-compilation: functions and files will be only byte-compiled; however, the @file{*.eln} files will still be produced, they will just -contain the compiled code in bytecode form. +contain the compiled code in bytecode form. (This can be achieved at +function granularity by using the @w{@code{(declare (speed -1))}} +form, @pxref{Declare Form}.) The default value is 2. @end defopt diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 06d50311799..28893875062 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2333,6 +2333,30 @@ the current buffer. @item (modes @var{modes}) Specify that this command is meant to be applicable for @var{modes} only. + +@item (pure @var{val}) +If @var{val} is non-@code{nil}, this function is @dfn{pure} +(@pxref{What Is a Function}). This is the same as the @code{pure} +property of the function's symbol (@pxref{Standard Properties}). + +@item (side-effect-free @var{val}) +If @var{val} is non-@code{nil}, this function is free of side effects, +so the byte compiler can ignore calls whose value is ignored. This is +the same as the @code{side-effect-free} property of the function's +symbol, @pxref{Standard Properties}. + +@item (speed @var{n}) +Specify the value of @code{native-comp-speed} in effect for native +compilation of this function (@pxref{Native-Compilation Variables}). +This allows function-level control on the optimization level used for +native code emitted for the function. In particular, if @var{n} is +@minus{}1, native compilation of the function will emit bytecode +instead of native code for the function. + +@item no-font-lock-keyword +This is valid for macros only. Macros with this declaration are +highlighted by font-lock (@pxref{Font Lock Mode}) as normal functions, +not specially as macros. @end table @end defmac From 2529e8200232aa8ce252084634d81a2809fb26fa Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jul 2022 12:56:00 +0300 Subject: [PATCH 3/4] ; * doc/lispref/functions.texi (Declare Form): Fix typo. --- doc/lispref/functions.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 28893875062..a70364c3cb5 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2348,7 +2348,7 @@ symbol, @pxref{Standard Properties}. @item (speed @var{n}) Specify the value of @code{native-comp-speed} in effect for native compilation of this function (@pxref{Native-Compilation Variables}). -This allows function-level control on the optimization level used for +This allows function-level control of the optimization level used for native code emitted for the function. In particular, if @var{n} is @minus{}1, native compilation of the function will emit bytecode instead of native code for the function. From b4067394dcf33d64e0372bf553cec5b6f9c4af1c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 23 Jul 2022 19:45:24 +0200 Subject: [PATCH 4/4] Set `default-directory' of Tramp archive connection buffer * lisp/net/tramp-archive.el (tramp-archive-file-name-handler): Set `default-directory' of Tramp connection buffer. (Bug#56628) --- lisp/net/tramp-archive.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 4b649edaabd..33348ca21ef 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -339,6 +339,13 @@ arguments to pass to the OPERATION." (tramp-archive-run-real-handler #'file-directory-p (list archive))) (tramp-archive-run-real-handler operation args) + ;; The default directory of the Tramp connection buffer + ;; cannot be accessed. (Bug#56628) + ;; FIXME: It is superfluous to set it every single loop. + ;; But there is no place to set it when creating the buffer. + (with-current-buffer + (tramp-get-buffer (tramp-archive-dissect-file-name filename)) + (setq default-directory (file-name-as-directory archive))) ;; Now run the handler. (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) (tramp-gvfs-methods tramp-archive-all-gvfs-methods)