commit 85043246f14933eedf3d2c7c6f5ab603ec3f6a21 (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Wed May 15 00:09:39 2024 +0300 (xref--collect-matches): Move inhibit-modification-hooks binding down * lisp/progmodes/xref.el (xref--collect-matches): Move the inhibit-modification-hooks binding a little down (bug#53749). (xref--show-common-initialize): Add sharp-quoting. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index f9faec1b474..9013729c505 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1282,7 +1282,7 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." (erase-buffer) (setq overlay-arrow-position nil) (xref--insert-xrefs xref-alist) - (add-hook 'post-command-hook 'xref--apply-truncation nil t) + (add-hook 'post-command-hook #'xref--apply-truncation nil t) (goto-char (point-min)) (setq xref--original-window (assoc-default 'window alist) xref--original-window-intent (assoc-default 'display-action alist)) @@ -2112,10 +2112,7 @@ Such as the current syntax table and the applied syntax properties." (defun xref--collect-matches (hit regexp tmp-buffer syntax-needed) (pcase-let* ((`(,line ,file ,text) hit) (file (and file (concat xref--hits-remote-id file))) - (buf (xref--find-file-buffer file)) - ;; This is fairly dangerouns, but improves performance - ;; for large lists, see https://debbugs.gnu.org/53749#227 - (inhibit-modification-hooks t)) + (buf (xref--find-file-buffer file))) (if buf (with-current-buffer buf (save-excursion @@ -2130,6 +2127,9 @@ Such as the current syntax table and the applied syntax properties." ;; Using the temporary buffer is both a performance and a buffer ;; management optimization. (with-current-buffer tmp-buffer + ;; This let is fairly dangerouns, but improves performance + ;; for large lists, see https://debbugs.gnu.org/53749#227 + (let ((inhibit-modification-hooks t)) (erase-buffer) (when (and syntax-needed (not (equal file xref--temp-buffer-file-name))) @@ -2144,7 +2144,7 @@ Such as the current syntax table and the applied syntax properties." (setq-local xref--temp-buffer-file-name file) (setq-local inhibit-read-only t) (erase-buffer)) - (insert text) + (insert text)) (goto-char (point-min)) (when syntax-needed (syntax-ppss-flush-cache (point))) commit 0a008401dc083bcba5bd704ba5eb866c03facdc2 Author: Eli Zaretskii Date: Tue May 14 20:45:58 2024 +0300 Avoid another warning (bug#70942). diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index c3860cb0b0a..e9048e157cd 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -191,6 +191,8 @@ Should be used by commands in `image-dired-thumbnail-mode'." "Return non-nil if there is an `image-dired' thumbnail at point." (get-text-property (point) 'image-dired-thumbnail)) +(declare-function clear-image-cache "image.c" (&optional filter)) + (defun image-dired-update-thumbnail-at-point () "Update the thumbnail at point if the original image file has been modified. This function uncaches and removes the thumbnail file under the old name." commit 4a973ce7e2b647a6adb0a6eaab74426a332f5721 Author: Eli Zaretskii Date: Tue May 14 20:42:11 2024 +0300 Fix some compilation warnings Reported by Jacob Faibussowitsch * lisp/net/eww.el (imagep): Declare. * src/xdisp.c (note_fringe_highlight): Now compiled only if HAVE_WINDOW_SYSTEM. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index c3437ddd1d6..ceafca282c4 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1353,6 +1353,7 @@ within text input fields." (setq text-property-default-nonsticky '((face . t) (eww-form . t) (field . t)))) +(declare-function imagep "image.c") (defvar text-scale-mode) (defvar text-scale-mode-amount) (defun eww--rescale-images () diff --git a/src/xdisp.c b/src/xdisp.c index 4b7d7e02c68..63ff8670b79 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -35733,6 +35733,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, define_frame_cursor1 (f, cursor, pointer); } +#ifdef HAVE_WINDOW_SYSTEM /* Take proper action when mouse has moved to the window WINDOW, with window-local x-position X and y-position Y. This is only used for @@ -35811,6 +35812,8 @@ note_fringe_highlight (struct frame *f, Lisp_Object window, int x, int y, } } +#endif /* HAVE_WINDOW_SYSTEM */ + /* EXPORT: Take proper action when the mouse has moved to position X, Y on frame F with regards to highlighting portions of display that have commit 060914d6c1c69be74e7f19a07550cec892738d0e Author: Andrea Corallo Date: Tue May 14 17:47:36 2024 +0200 * lisp/gnus/nnatom.el (libxml-parse-xml-region): Declare to silence warning. diff --git a/lisp/gnus/nnatom.el b/lisp/gnus/nnatom.el index add9ae2dff9..13286159784 100644 --- a/lisp/gnus/nnatom.el +++ b/lisp/gnus/nnatom.el @@ -43,6 +43,7 @@ ;;;; Atom feed parser: +(declare-function libxml-parse-xml-region "xml.c") (defun nnatom--read-feed (feed _) "Return a list structure representing FEED, or nil." (if (string-match-p "\\`https?://" feed) commit 161808ae94ec4e97b2499c9c24c28eaf53c7a972 Author: Robert Pluim Date: Tue May 7 17:12:22 2024 +0200 ; * src/process.c (network_lookup_address_info_1): Quote function diff --git a/src/process.c b/src/process.c index 50d1968200d..d716453631e 100644 --- a/src/process.c +++ b/src/process.c @@ -4678,7 +4678,7 @@ network_lookup_address_info_1 (Lisp_Object host, const char *service, int ret; if (STRING_MULTIBYTE (host) && SBYTES (host) != SCHARS (host)) - error ("Non-ASCII hostname %s detected, please use puny-encode-domain", + error ("Non-ASCII hostname %s detected, please use `puny-encode-domain'", SSDATA (host)); #ifdef WINDOWSNT commit 45ebb66ccf28c1df63cfcfa00891be4e48cdedda Author: Robert Pluim Date: Fri Apr 19 15:14:11 2024 +0200 Document 'use-default-font-for-symbols' more "why does my set-fontset-font call not work for symbols" is a common question, and it's because 'use-default-font-for-symbols' is not discoverable enough. * doc/emacs/mule.texi (Modifying Fontsets): Mention it here. * doc/lispref/display.texi (Fontsets): And here. * src/fontset.c (Fset_fontset_font): And most importantly here. diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index a16a9ea8f71..ab6125f5745 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -1671,6 +1671,10 @@ used. Some examples are: nil 'append) @end example +When modifying the fontset for the @code{symbol} script, the value of +@code{use-default-font-for-symbols} will affect whether the fontset is +actually used. + @noindent @xref{Fontsets, , , elisp, GNU Emacs Lisp Reference Manual}, for more details about using the @code{set-fontset-font} function. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 011738df268..a9f89406070 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3983,7 +3983,9 @@ that case, use @var{font-spec} for all the characters in the charset. @var{characters} may be a script symbol (@pxref{Character Properties, char-script-table}). In that case, use @var{font-spec} for all the -characters belonging to the script. +characters belonging to the script. See also +@code{use-default-font-for-symbols}, which affects font selection +when @var{fontset} is @code{symbol}. @var{characters} may be @code{nil}, which means to use @var{font-spec} for any character in @var{fontset} for which no font-spec is diff --git a/src/fontset.c b/src/fontset.c index a98d75606b3..bac04119957 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1501,7 +1501,8 @@ CHARACTERS may be a script symbol. In that case, use FONT-SPEC for all the characters that belong to the script. See the variable `script-representative-chars' for the list of known scripts, and see the variable `char-script-table' for the script of any specific -character. +character. Note: for the `symbol' script only, whether the FONTSET +is actually used depends on the value of `use-default-font-for-symbols'. CHARACTERS may be a charset symbol. In that case, use FONT-SPEC for all the characters in the charset. See `list-character-sets' and commit 8074c08cd553ab6ee5ffe61cc2e56fb1e0a4fe34 Author: Illia Ostapyshyn Date: Mon May 6 20:24:22 2024 +0200 Use proper smime-keys entry for S/MIME signatures using OpenSSL bug#67931 * doc/misc/emacs-mime.texi (MML Definition): * lisp/gnus/mml.el (mml-parse-1): Add chainfile parameter to sign tags. * lisp/gnus/mml-smime.el (mml-smime-openssl-sign-query): Include the additional certificates from smime-keys in MML tag generation as chainfile parameters. (mml-smime-openssl-sign): Forward chainfile entries from the parsed tag alist to smime-sign-buffer. ; * lisp/gnus/smime.el (smime-sign-region): Fix typo in documentation. ; (smime-sign-buffer): Improve documentation to match smime-sign-region. diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 96a6328cd47..ef7ea614f8b 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -787,6 +787,10 @@ Parameters for @samp{sign=smime}: @item keyfile File containing key and certificate for signer. +@item chainfile +File containing an additional certificate to be included with the +message. + @end table Parameters for @samp{encrypt=smime}: diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 3064c46d2a3..9218bc079db 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -129,11 +129,15 @@ Whether the passphrase is cached at all is controlled by (if func (funcall func handle ctl)))) -(defun mml-smime-openssl-sign (_cont) - (when (null smime-keys) - (customize-variable 'smime-keys) - (error "No S/MIME keys configured, use customize to add your key")) - (smime-sign-buffer (cdar smime-keys)) +(defun mml-smime-openssl-sign (cont) + (smime-sign-buffer + ;; List with key and certificate as its car, and a list of additional + ;; certificates to include in its cadr for smime-sign-region + (list + (cdr (assq 'keyfile cont)) + (mapcar #'cdr (cl-remove-if-not (apply-partially #'equal 'chainfile) + cont + :key #'car-safe)))) (goto-char (point-min)) (while (search-forward "\r\n" nil t) (replace-match "\n" t t)) @@ -167,21 +171,23 @@ Whether the passphrase is cached at all is controlled by (when (null smime-keys) (customize-variable 'smime-keys) (error "No S/MIME keys configured, use customize to add your key")) - (list 'keyfile - (if (= (length smime-keys) 1) - (cadar smime-keys) - (or (let ((from (cadr (mail-extract-address-components - (or (save-excursion - (save-restriction - (message-narrow-to-headers) - (message-fetch-field "from"))) - ""))))) - (and from (smime-get-key-by-email from))) - (smime-get-key-by-email - (gnus-completing-read "Sign this part with what signature" - (mapcar #'car smime-keys) nil nil nil - (and (listp (car-safe smime-keys)) - (caar smime-keys)))))))) + (let ((key-with-certs + (if (= (length smime-keys) 1) + (cdar smime-keys) + (or (let ((from (cadr (mail-extract-address-components + (or (save-excursion + (save-restriction + (message-narrow-to-headers) + (message-fetch-field "from"))) + ""))))) + (and from (smime-get-key-with-certs-by-email from))) + (smime-get-key-with-certs-by-email + (gnus-completing-read "Sign this part with what signature" + (mapcar #'car smime-keys) nil nil nil + (and (listp (car-safe smime-keys)) + (caar smime-keys)))))))) + (append (list 'keyfile (car key-with-certs)) + (mapcan (apply-partially #'list 'chainfile) (cadr key-with-certs))))) (defun mml-smime-get-file-cert () (ignore-errors diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index edb3c286242..e3bc3932529 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -233,6 +233,10 @@ part. This is for the internal use, you should never modify the value.") (if (eq (car-safe tag) 'certfile) (cdr tag))) taginfo))) + (chainfiles (delq nil (mapcar (lambda (tag) + (if (eq (car-safe tag) 'chainfile) + (cdr tag))) + taginfo))) (recipients (cdr (assq 'recipients taginfo))) (sender (cdr (assq 'sender taginfo))) (location (cdr (assq 'tag-location taginfo))) @@ -267,6 +271,10 @@ part. This is for the internal use, you should never modify the value.") (mapcar (lambda (certfile) (list "certfile" certfile)) certfiles)) + ,@(apply #'append + (mapcar (lambda (chainfile) + (list "chainfile" chainfile)) + chainfiles)) ,(if recipients "recipients") ,recipients ,(if sender "sender") diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index b61579912dd..987bc7273db 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -261,7 +261,7 @@ password under `cache-key'." If signing fails, the buffer is not modified. Region is assumed to have proper MIME tags. KEYFILE is expected to contain a PEM encoded private key and certificate as its car, and a list of additional -certificates to include in its caar. If no additional certificates is +certificates to include in its cadr. If no additional certificates are included, KEYFILE may be the file containing the PEM encoded private key and certificate itself." (smime-new-details-buffer) @@ -327,7 +327,10 @@ is expected to contain of a PEM encoded certificate." (defun smime-sign-buffer (&optional keyfile buffer) "S/MIME sign BUFFER with key in KEYFILE. -KEYFILE should contain a PEM encoded key and certificate." +KEYFILE is expected to contain a PEM encoded private key and certificate +as its car, and a list of additional certificates to include in its +cadr. If no additional certificates are included, KEYFILE may be the +file containing the PEM encoded private key and certificate itself." (interactive) (with-current-buffer (or buffer (current-buffer)) (unless (smime-sign-region commit 52287b8697fddfee08d362e02605a69e3c3faccd Author: Po Lu Date: Tue May 14 22:15:38 2024 +0800 ; * .dir-locals.el (c-mode): Designate INLINE_HEADER_* as noise macros. diff --git a/.dir-locals.el b/.dir-locals.el index b34949ae961..2339a0f59ca 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -18,7 +18,8 @@ (c-mode . ((c-file-style . "GNU") (c-noise-macro-names . ("INLINE" "NO_INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" "UNINIT" "CALLBACK" "ALIGN_STACK" "ATTRIBUTE_MALLOC" - "ATTRIBUTE_DEALLOC_FREE" "ANDROID_EXPORT" "TEST_STATIC")) + "ATTRIBUTE_DEALLOC_FREE" "ANDROID_EXPORT" "TEST_STATIC" + "INLINE_HEADER_BEGIN" "INLINE_HEADER_END")) (electric-quote-comment . nil) (electric-quote-string . nil) (indent-tabs-mode . t) commit a39a8060124a5c9390cab186dece82ea35164f70 Author: Andrea Corallo Date: Tue May 14 10:50:05 2024 +0200 * doc/lispref/functions.texi (Declare Form): Rename and update 'ftype' entry. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index deca99960c7..dcce4043064 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2715,7 +2715,7 @@ function. This allows function-level control of the safety level used for the code emitted for the function (@pxref{Native-Compilation Variables}). -@item (type @var{type}) +@item (ftype @var{type} &optional @var{function}) Declare @var{type} to be the type of this function. This is used for documentation by @code{describe-function}. Also it can be used by the native compiler (@pxref{Native Compilation}) for improving code @@ -2727,14 +2727,16 @@ without type declaration. interleaved with symbols @code{&optional} and @code{&rest} to match the function's arguments (@pxref{Argument List}). -Here's an example of using @code{type} inside @code{declare} to declare +@var{function} if present should be the name of function being defined. + +Here's an example of using @code{ftype} inside @code{declare} to declare a function @code{positive-p} that takes an argument of type @var{number} and return a @var{boolean}: @lisp @group (defun positive-p (x) - (declare (type (function (number) boolean))) + (declare (ftype (function (number) boolean))) (when (> x 0) t)) @end group @@ -2748,8 +2750,8 @@ argument of type @var{string} and return one of the symbols @lisp @group (defun cons-or-number (x &optional err-msg) - (declare (type (function ((or cons number) &optional string) - (member is-cons is-number)))) + (declare (ftype (function ((or cons number) &optional string) + (member is-cons is-number)))) (if (consp x) 'is-cons (if (numberp x) commit e0cbed16b4573e0d6f848a4e239d559eeff08d95 Author: Andrea Corallo Date: Tue May 14 10:37:31 2024 +0200 * etc/NEWS: Rename 'type' -> 'ftype' and tweak it. diff --git a/etc/NEWS b/etc/NEWS index 632b9d4c1d7..34052764f5f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2488,16 +2488,17 @@ and see if you get only warnings that matter. ** Function 'declare' forms +++ -*** New 'type' function declaration. -The declaration '(type TYPE)' specifies the type of a function. +*** New 'ftype' function declaration. +The declaration '(ftype TYPE)' specifies the type of a function. Example: (defun hello (x y) - (declare (type (function (integer boolean) string))) + (declare (ftype (function (integer boolean) string))) ...) specifies that the function takes two arguments, an integer and a -boolean, and returns a string. This information can be used by the +boolean, and returns a string. If the compilation happens with +'compilation-safety' set to zero, this information can be used by the native compiler to produce better code, but specifying an incorrect type may lead to Emacs crashing. See the Info node "(elisp) Declare Form" for further information. commit b87670b56460185bec902806daa52b05faa5d26d Author: Andrea Corallo Date: Tue May 14 09:58:42 2024 +0200 * Allow for optional function name parameter in 'ftype' declaration * lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Allow for optional function name parameter in 'ftype' declaration. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 2031049e678..2fa646f2531 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -223,7 +223,11 @@ So far, FUNCTION can only be a symbol, not a lambda expression." val))))) (defalias 'byte-run--set-function-type - #'(lambda (f _args val) + #'(lambda (f _args val &optional f2) + (when (and f2 (not (eq f2 f))) + (error + "`%s' does not match top level function `%s' inside function type \ +declaration" f2 f)) (list 'function-put (list 'quote f) ''function-type (list 'quote val)))) commit 6e1bb713f61da3e09b811883ed889067a1cc939b Author: Andrea Corallo Date: Tue May 14 09:24:05 2024 +0200 Change 'type' declaration to 'ftype' * lisp/window.el (get-lru-window, get-largest-window) (one-window-p): Update function type declaration. * lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh) (last, eventp, mouse-movement-p, log10, memory-limit) (internal-pop-keymap): Likewise. * lisp/simple.el (count-lines, mark, string-empty-p): Likewise. * lisp/files.el (parse-colon-path): Likewise. * lisp/env.el (getenv): Likewise. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise. * lisp/emacs-lisp/lisp.el (buffer-end): Likewise. * lisp/emacs-lisp/comp.el (comp--final): Likewise. * lisp/custom.el (custom-variable-p): Likewise. * lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Rename 'type' -> 'ftype'. diff --git a/lisp/custom.el b/lisp/custom.el index 6f2aa18ba1d..c049e8f8be0 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -667,7 +667,7 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable." A customizable variable is either (i) a variable whose property list contains a non-nil `standard-value' or `custom-autoload' property, or (ii) an alias for another customizable variable." - (declare (type (function (symbol) t)) + (declare (ftype (function (symbol) t)) (side-effect-free t)) (when (symbolp variable) (setq variable (indirect-variable variable)) diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 2acd22d0a6a..2031049e678 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -251,7 +251,7 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.") (list 'completion #'byte-run--set-completion) (list 'modes #'byte-run--set-modes) (list 'interactive-args #'byte-run--set-interactive-args) - (list 'type #'byte-run--set-function-type)) + (list 'ftype #'byte-run--set-function-type)) "List associating function properties to their macro expansion. Each element of the list takes the form (PROP FUN) where FUN is a function. For each (PROP . VALUES) in a function's declaration, diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index f9fa83da585..83ca480616f 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3325,12 +3325,12 @@ Prepare every function for final compilation and drive the C back-end." ;; are assumed just to be true. Use with extreme caution... (defun comp-hint-fixnum (x) - (declare (type (function (t) fixnum)) + (declare (ftype (function (t) fixnum)) (gv-setter (lambda (val) `(setf ,x ,val)))) x) (defun comp-hint-cons (x) - (declare (type (function (t) cons)) + (declare (ftype (function (t) cons)) (gv-setter (lambda (val) `(setf ,x ,val)))) x) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 9edc11ad132..e65eec508d9 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -534,7 +534,7 @@ major mode's decisions about context.") "Return the \"far end\" position of the buffer, in direction ARG. If ARG is positive, that's the end of the buffer. Otherwise, that's the beginning of the buffer." - (declare (type (function ((or number marker)) integer)) + (declare (ftype (function ((or number marker)) integer)) (side-effect-free error-free)) (if (> arg 0) (point-max) (point-min))) diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index f23343a34c6..d655855fab2 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -130,7 +130,7 @@ usually more efficient than that of a simplified version: (concat (car parens) (mapconcat \\='regexp-quote strings \"\\\\|\") (cdr parens))))" - (declare (type (function (list &optional t) string)) + (declare (ftype (function (list &optional t) string)) (pure t) (side-effect-free t)) (save-match-data ;; Recurse on the sorted list. diff --git a/lisp/env.el b/lisp/env.el index 7d0c7dd0126..28f4f8a1d61 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -207,7 +207,7 @@ parameter. Otherwise, this function searches `process-environment' for VARIABLE. If it is not found there, then it continues the search in the environment list of the selected frame." - (declare (type (function (string &optional frame) (or null string))) + (declare (ftype (function (string &optional frame) (or null string))) (side-effect-free t)) (interactive (list (read-envvar-name "Get environment variable: " t))) (let ((value (getenv-internal (if (multibyte-string-p variable) diff --git a/lisp/files.el b/lisp/files.el index c24e48e3db2..ae6dc1d6b29 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -862,7 +862,7 @@ GNU and Unix systems). Substitute environment variables into the resulting list of directory names. For an empty path element (i.e., a leading or trailing separator, or two adjacent separators), return nil (meaning `default-directory') as the associated list element." - (declare (type (function (string) list))) + (declare (ftype (function (string) list))) (when (stringp search-path) (let ((spath (substitute-env-vars search-path)) (double-slash-special-p diff --git a/lisp/simple.el b/lisp/simple.el index deab52c4201..cdbbd876e3b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1762,7 +1762,7 @@ not at the start of a line. When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not included in the count." - (declare (type (function ((or integer marker) (or integer marker) &optional t) + (declare (ftype (function ((or integer marker) (or integer marker) &optional t) integer)) (side-effect-free t)) (save-excursion @@ -6884,7 +6884,7 @@ is active, and returns an integer or nil in the usual way. If you are using this in an editing command, you are most likely making a mistake; see the documentation of `set-mark'." - (declare (type (function (&optional t) (or integer null))) + (declare (ftype (function (&optional t) (or integer null))) (side-effect-free t)) (if (or force (not transient-mark-mode) mark-active mark-even-if-inactive) (marker-position (mark-marker)) @@ -11147,7 +11147,7 @@ killed." (defun lax-plist-get (plist prop) "Extract a value from a property list, comparing with `equal'." - (declare (type (function (list t) t)) + (declare (ftype (function (list t) t)) (pure t) (side-effect-free t) (obsolete plist-get "29.1")) (plist-get plist prop #'equal)) diff --git a/lisp/subr.el b/lisp/subr.el index d18765c2a5b..d6481fdf73e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -451,7 +451,7 @@ This function accepts any number of arguments in ARGUMENTS. Also see `always'." ;; Not declared `side-effect-free' because we don't want calls to it ;; elided; see `byte-compile-ignore'. - (declare (type (function (&rest t) null)) + (declare (ftype (function (&rest t) null)) (pure t) (completion ignore)) (interactive) nil) @@ -481,7 +481,7 @@ for the sake of consistency. To alter the look of the displayed error messages, you can use the `command-error-function' variable." - (declare (type (function (string &rest t) nil)) + (declare (ftype (function (string &rest t) nil)) (advertised-calling-convention (string &rest args) "23.1")) (signal 'error (list (apply #'format-message args)))) @@ -547,21 +547,21 @@ was called." "Return t if NUMBER is zero." ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because ;; = has a byte-code. - (declare (type (function (number) boolean)) + (declare (ftype (function (number) boolean)) (pure t) (side-effect-free t) (compiler-macro (lambda (_) `(= 0 ,number)))) (= 0 number)) (defun fixnump (object) "Return t if OBJECT is a fixnum." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (side-effect-free error-free)) (and (integerp object) (<= most-negative-fixnum object most-positive-fixnum))) (defun bignump (object) "Return t if OBJECT is a bignum." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (side-effect-free error-free)) (and (integerp object) (not (fixnump object)))) @@ -575,7 +575,7 @@ Most uses of this function turn out to be mistakes. We recommend to use `ash' instead, unless COUNT could ever be negative, and if, when COUNT is negative, your program really needs the special treatment of negative COUNT provided by this function." - (declare (type (function (integer integer) integer)) + (declare (ftype (function (integer integer) integer)) (compiler-macro (lambda (form) (macroexp-warn-and-return @@ -754,7 +754,7 @@ treatment of negative COUNT provided by this function." If LIST is nil, return nil. If N is non-nil, return the Nth-to-last link of LIST. If N is bigger than the length of LIST, return LIST." - (declare (type (function (list &optional integer) list)) + (declare (ftype (function (list &optional integer) list)) (pure t) (side-effect-free t)) ; pure up to mutation (if n (and (>= n 0) @@ -1592,7 +1592,7 @@ See also `current-global-map'.") (defun eventp (object) "Return non-nil if OBJECT is an input event or event object." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (pure t) (side-effect-free error-free)) (or (integerp object) (and (if (consp object) @@ -1660,7 +1660,7 @@ in the current Emacs session, then this function may return nil." (defsubst mouse-movement-p (object) "Return non-nil if OBJECT is a mouse movement event." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (side-effect-free error-free)) (eq (car-safe object) 'mouse-movement)) @@ -1970,7 +1970,7 @@ be a list of the form returned by `event-start' and `event-end'." (defun log10 (x) "Return (log X 10), the log base 10 of X." - (declare (type (function (number) float)) + (declare (ftype (function (number) float)) (side-effect-free t) (obsolete log "24.4")) (log x 10)) @@ -3257,7 +3257,7 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'." (defun memory-limit () "Return an estimate of Emacs virtual memory usage, divided by 1024." - (declare (type (function () integer)) + (declare (ftype (function () integer)) (side-effect-free error-free)) (let ((default-directory temporary-file-directory)) (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0))) @@ -6492,7 +6492,7 @@ To test whether a function can be called interactively, use `commandp'." ;; Kept around for now. See discussion at: ;; https://lists.gnu.org/r/emacs-devel/2020-08/msg00564.html - (declare (type (function () boolean)) + (declare (ftype (function () boolean)) (obsolete called-interactively-p "23.2") (side-effect-free error-free)) (called-interactively-p 'interactive)) diff --git a/lisp/window.el b/lisp/window.el index 639090752be..8feeba0d83e 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2515,7 +2515,7 @@ have special meanings: Any other value of ALL-FRAMES means consider all windows on the selected frame and no others." - (declare (type (function (&optional t t t) (or window null))) + (declare (ftype (function (&optional t t t) (or window null))) (side-effect-free error-free)) (let ((windows (window-list-1 nil 'nomini all-frames)) best-window best-time second-best-window second-best-time time) @@ -2595,7 +2595,7 @@ have special meanings: Any other value of ALL-FRAMES means consider all windows on the selected frame and no others." - (declare (type (function (&optional t t t) (or window null))) + (declare (ftype (function (&optional t t t) (or window null))) (side-effect-free error-free)) (let ((best-size 0) best-window size) @@ -4091,7 +4091,7 @@ with a special meaning are: Anything else means consider all windows on the selected frame and no others." - (declare (type (function (&optional t t) boolean)) + (declare (ftype (function (&optional t t) boolean)) (side-effect-free error-free)) (let ((base-window (selected-window))) (if (and nomini (eq base-window (minibuffer-window))) commit 041aa3ffc65c1146bed43ecaa1b0df4e7486c963 Merge: dd13ab0756b becdee74822 Author: Michael Albinus Date: Tue May 14 10:50:17 2024 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit dd13ab0756bc28a02d7685d6ae4ee442a23a5b84 Author: Michael Albinus Date: Tue May 14 10:49:52 2024 +0200 Trace Tramp user error * lisp/net/tramp-androidsu.el (tramp-androidsu-maybe-open-connection): Use `tramp-user-error' for the traces. diff --git a/lisp/net/tramp-androidsu.el b/lisp/net/tramp-androidsu.el index 0910d274cc4..361e45b9de5 100644 --- a/lisp/net/tramp-androidsu.el +++ b/lisp/net/tramp-androidsu.el @@ -156,7 +156,8 @@ multibyte mode and waits for the shell prompt to appear." su-binary (shell-quote-argument (or (executable-find "su") - (user-error + (tramp-user-error + vec "No su binary is available in any of `exec-path'"))) command (format "PATH=%s exec %s - %s || exit" path su-binary user)) commit becdee748223b4bdd95dc85de265499cc512f7a9 Author: Po Lu Date: Tue May 14 16:17:36 2024 +0800 ; * lisp/net/tramp-androidsu.el (tramp-androidsu-handle-make-process): Typo. diff --git a/lisp/net/tramp-androidsu.el b/lisp/net/tramp-androidsu.el index 0910d274cc4..afe1957f09a 100644 --- a/lisp/net/tramp-androidsu.el +++ b/lisp/net/tramp-androidsu.el @@ -400,7 +400,7 @@ FUNCTION." ;; that starting inferior shells on systems with ;; such implementations does not needlessly fail. (if (tramp-get-connection-property v "remote-namespace") - (append (list "su" "-mm" user "-c") command) + (append (list "su" "-mm" "-c") command) (append (list "su" "-c") command)) (if (tramp-get-connection-property v "remote-namespace") (append (list "su" "-mm" "-" user "-c") command) commit 6c45f0b54611a8ea1eec918004ac7392aacd732a Merge: 7ddba8e71e4 65b04466330 Author: Michael Albinus Date: Tue May 14 10:18:35 2024 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 7ddba8e71e4c5b8c03eff0d8405bfe50b44eeafc Author: Michael Albinus Date: Tue May 14 10:18:04 2024 +0200 ; Fix whitespace diff --git a/src/dbusbind.c b/src/dbusbind.c index 9f93f2894c2..35ce03c7911 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -493,8 +493,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) - wrong_type_argument (QD_Bus, - CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); + wrong_type_argument (QD_Bus, CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); sprintf (signature, "%c", dtype); break; @@ -552,8 +551,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object) xd_signature_cat (signature, x); if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) - wrong_type_argument (QD_Bus, - CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); + wrong_type_argument (QD_Bus, CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); /* Closing signature. */ xd_signature_cat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING); commit 65b0446633041519f1515ea8c1e6c28f6d315c37 Author: Po Lu Date: Tue May 14 16:13:58 2024 +0800 Port tramp-androidsu to a wider variety of systems * lisp/net/tramp-androidsu.el (tramp-androidsu-maybe-open-connection): Search for `su' when the connection is initiated; replace PATH of inferior shell with trap-androidsu-remote-path. (tramp-androidsu-handle-make-process): Do not provide username if root. diff --git a/lisp/net/tramp-androidsu.el b/lisp/net/tramp-androidsu.el index 953f75ad9f3..0910d274cc4 100644 --- a/lisp/net/tramp-androidsu.el +++ b/lisp/net/tramp-androidsu.el @@ -142,12 +142,24 @@ multibyte mode and waits for the shell prompt to appear." ;; `android-use-exec-loader' off. tramp-androidsu-local-shell-name "-i")) (user (tramp-file-name-user vec)) - command) + su-binary path command) ;; Set sentinel. Initialize variables. (set-process-sentinel p #'tramp-process-sentinel) (tramp-post-process-creation p vec) - ;; Replace `login-args' place holders. - (setq command (format "exec su - %s || exit" user)) + ;; Replace `login-args' place holders. `PATH' must be + ;; set to `tramp-androidsu-remote-path', as some `su' + ;; implementations propagate their callers' environments + ;; to the root session, which might be contaminated with + ;; incompatible `ls' binaries or similar. + (setq path (tramp-shell-quote-argument + (string-join tramp-androidsu-remote-path ":")) + su-binary + (shell-quote-argument + (or (executable-find "su") + (user-error + "No su binary is available in any of `exec-path'"))) + command (format "PATH=%s exec %s - %s || exit" + path su-binary user)) ;; Attempt to execute the shell inside the global mount ;; namespace if requested. (when tramp-androidsu-mount-global-namespace @@ -163,12 +175,13 @@ multibyte mode and waits for the shell prompt to appear." (setq tramp-androidsu-su-mm-supported ;; Detect support for `su -mm'. (tramp-adb-send-command-and-check - vec "su -mm -c 'exit 24'" 24))) + vec (format "%s -mm -c 'exit 24'" su-binary) + 24))) (when tramp-androidsu-su-mm-supported (tramp-set-connection-property vec "remote-namespace" t) - (setq command (format "exec su -mm - %s || exit" - user))))) + (setq command (format "PATH=%s exec %s -mm - %s || exit" + path su-binary user))))) ;; Send the command. (tramp-message vec 3 "Sending command `%s'" command) (tramp-adb-send-command vec command t t) @@ -379,9 +392,19 @@ FUNCTION." :name name :buffer buffer :command - (if (tramp-get-connection-property v "remote-namespace") - (append (list "su" "-mm" "-" user "-c") command) - (append (list "su" "-" user "-c") command)) + (if (equal user "root") + ;; Invoke su in the simplest manner possible, that + ;; is to say, without specifying the user, which + ;; certain implementations cannot parse when a + ;; command is also present, if it may be omitted, so + ;; that starting inferior shells on systems with + ;; such implementations does not needlessly fail. + (if (tramp-get-connection-property v "remote-namespace") + (append (list "su" "-mm" user "-c") command) + (append (list "su" "-c") command)) + (if (tramp-get-connection-property v "remote-namespace") + (append (list "su" "-mm" "-" user "-c") command) + (append (list "su" "-" user "-c") command))) :coding coding :noquery noquery :connection-type connection-type commit 149c6412df6b16216c95ed10f88f8805fb7ea317 Author: Eli Zaretskii Date: Tue May 14 10:53:40 2024 +0300 ; * etc/NEWS: Fix wording, again. diff --git a/etc/NEWS b/etc/NEWS index cb07fbf12ba..632b9d4c1d7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1047,7 +1047,7 @@ It defines whether to flatten the list of sections in an imenu or show it nested. +++ -*** Imenu completions can now be sorted. +*** The sort order of Imenu completions can now be customized. You can customize the option 'completion-category-overrides' and set 'display-sort-function' for the category 'imenu'. commit e583cc35e40b5cb0431d957374c5f8cc8954883c Author: Eli Zaretskii Date: Tue May 14 10:52:17 2024 +0300 ; * etc/NEWS: Fix wording. diff --git a/etc/NEWS b/etc/NEWS index 7b429414a7f..cb07fbf12ba 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1047,7 +1047,7 @@ It defines whether to flatten the list of sections in an imenu or show it nested. +++ -*** Imenu completions now can be sorted. +*** Imenu completions can now be sorted. You can customize the option 'completion-category-overrides' and set 'display-sort-function' for the category 'imenu'.