commit 314f12630af4d085d0c07283f110ad15b07bde14 (HEAD, refs/remotes/origin/master) Merge: 8051be9ac20 2550e8bb0b0 Author: Stefan Kangas Date: Thu Feb 16 06:30:22 2023 +0100 Merge from origin/emacs-29 2550e8bb0b0 Fix mule-tests under en_US.UTF-8 locale 32795309939 Move block closer above declaration_list rule (bug#61531) b18754bb179 Minor improvements in c-ts-mode and docs 3c6b726a7b4 Add super node as a keyword 1917c51fe68 ; Prevent ERC-induced false positive in JUnit report b16965ef7e6 Delete perplexing paragraph from Gnus manual 43c62a4732d ; Fix typo commit 8051be9ac204583e0641779763eb0803c730b4bf Author: Jim Porter Date: Sun Feb 12 23:25:59 2023 -0800 Allow unloading Eshell * lisp/eshell/em-extpipe.el (eshell-extpipe): * lisp/eshell/esh-opt.el (eshell-opt): New groups. Eshell uses these to identify modules to unload. * lisp/eshell/em-hist.el (eshell-hist-unload-hook): * lisp/eshell/em-ls.el (eshell-ls-unload-hook): * lisp/eshell/em-smart.el (eshell-smart-unload-hook): * lisp/eshell/eshell.el (eshell-unload-hook): Make obsolete and move to... * lisp/eshell/em-smart.el (em-smart-unload-function): * lisp/eshell/em-hist.el (em-hist-unload-function): * lisp/eshell/em-ls.el (em-ls-unload-function): * lisp/eshell/eshell.el (eshell-unload-function): ... these. * lisp/eshell/esh-mode.el (eshell-mode-unload-hook): * lisp/eshell/esh-module.el (eshell-module-unload-hook): Make obsolete. * lisp/eshell/em-ls (eshell-ls-enable-in-dired, eshell-ls-disable-in-dired): New functions... (eshell-ls-use-in-dired): ... use them. * lisp/eshell/esh-module.el (eshell-module--feature-name, eshell-unload-modules): New functions. (eshell-unload-extension-modules): Use 'eshell-unload-modules'. * lisp/eshell/eshell.el (eshell-unload-all-modules): Remove. * test/lisp/eshell/eshell-tests-unload.el: New file. * doc/misc/eshell.texi (Bugs and ideas): Remove item about unloading Eshell not working. * etc/NEWS: Announce this change (bug#61501). diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index e51e2cf799b..1c33c04f647 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -2189,8 +2189,6 @@ Bugs and ideas cause it to track the bottom of the output; but backspace no longer scrolls back. -@item It's not possible to fully @code{unload-feature} Eshell - @item Menu support was removed, but never put back @item If an interactive process is currently running, @kbd{M-!} doesn't work diff --git a/etc/NEWS b/etc/NEWS index c635e1fbe87..4fbe09e0541 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -145,6 +145,11 @@ this to your configuration: (keymap-set eshell-mode-map "" #'eshell-bol-ignoring-prompt) +--- +*** You can now properly unload Eshell. +Calling "(unload-feature 'eshell)" no longer signals an error, and now +correctly unloads Eshell and all of its modules. + +++ *** 'eshell-read-aliases-list' is now an interactive command. After manually editing 'eshell-aliases-file', you can use this command @@ -210,6 +215,12 @@ their customization options. This user option has been obsoleted in Emacs 27, use 'remote-file-name-inhibit-cache' instead. +--- +** User options 'eshell-NAME-unload-hook' are now obsolete. +These hooks were named incorrectly, and so they never actually ran +when unloading the correspending feature. Instead, you should use +hooks named after the feature name, like 'esh-mode-unload-hook'. + * Lisp Changes in Emacs 30.1 diff --git a/lisp/eshell/em-extpipe.el b/lisp/eshell/em-extpipe.el index 9078c44ed9f..5c9a0a85934 100644 --- a/lisp/eshell/em-extpipe.el +++ b/lisp/eshell/em-extpipe.el @@ -36,6 +36,21 @@ (eval-when-compile (require 'files-x)) +;;;###autoload +(progn +(defgroup eshell-extpipe nil + "Native shell pipelines. + +This module lets you construct pipelines that use your operating +system's shell instead of Eshell's own pipelining support. This +is especially relevant when executing commands on a remote +machine using Eshell's Tramp integration: using the remote +shell's pipelining avoids copying the data which will flow +through the pipeline to local Emacs buffers and then right back +again." + :tag "External pipelines" + :group 'eshell-module)) + ;;; Functions: (defun eshell-extpipe-initialize () ;Called from `eshell-mode' via intern-soft! diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 4796df1604e..2c199ec160f 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -80,6 +80,7 @@ eshell-hist-unload-hook (remove-hook 'kill-emacs-hook 'eshell-save-some-history))) "A hook that gets run when `eshell-hist' is unloaded." :type 'hook) +(make-obsolete-variable 'eshell-hist-unload-hook nil "30.1") (defcustom eshell-history-file-name (expand-file-name "history" eshell-directory-name) @@ -1037,6 +1038,9 @@ eshell-isearch-return (isearch-done) (eshell-send-input)) +(defun em-hist-unload-function () + (remove-hook 'kill-emacs-hook 'eshell-save-some-history)) + (provide 'em-hist) ;; Local Variables: diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 7e2a7578ef9..56c5f262789 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el @@ -62,24 +62,27 @@ eshell-ls-dired-initial-args This is useful for enabling human-readable format (-h), for example." :type '(repeat :tag "Arguments" string)) +(defun eshell-ls-enable-in-dired () + "Use `eshell-ls' to read directories in Dired." + (require 'dired) + (advice-add 'insert-directory :around #'eshell-ls--insert-directory) + (advice-add 'dired :around #'eshell-ls--dired)) + +(defun eshell-ls-disable-in-dired () + "Stop using `eshell-ls' to read directories in Dired." + (advice-remove 'insert-directory #'eshell-ls--insert-directory) + (advice-remove 'dired #'eshell-ls--dired)) + (defcustom eshell-ls-use-in-dired nil "If non-nil, use `eshell-ls' to read directories in Dired. Changing this without using customize has no effect." :set (lambda (symbol value) - (cond (value - (require 'dired) - (advice-add 'insert-directory :around - #'eshell-ls--insert-directory) - (advice-add 'dired :around #'eshell-ls--dired)) - (t - (advice-remove 'insert-directory - #'eshell-ls--insert-directory) - (advice-remove 'dired #'eshell-ls--dired))) + (if value + (eshell-ls-enable-in-dired) + (eshell-ls-disable-in-dired)) (set symbol value)) :type 'boolean :require 'em-ls) -(add-hook 'eshell-ls-unload-hook #'eshell-ls-unload-function) - (defcustom eshell-ls-default-blocksize 1024 "The default blocksize to use when display file sizes with -s." @@ -954,10 +957,8 @@ eshell-ls-decorated-name (car file))))) (car file)) -(defun eshell-ls-unload-function () - (advice-remove 'insert-directory #'eshell-ls--insert-directory) - (advice-remove 'dired #'eshell-ls--dired) - nil) +(defun em-ls-unload-function () + (eshell-ls-disable-in-dired)) (provide 'em-ls) diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index 154ff760212..d8b7fadc2c2 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el @@ -99,6 +99,7 @@ eshell-smart-unload-hook "A hook that gets run when `eshell-smart' is unloaded." :type 'hook :group 'eshell-smart) +(make-obsolete-variable 'eshell-smart-unload-hook nil "30.1") (defcustom eshell-review-quick-commands nil "If t, always review commands. @@ -321,6 +322,9 @@ eshell-smart-display-move (if clear (remove-hook 'pre-command-hook 'eshell-smart-display-move t)))) +(defun em-smart-unload-hook () + (remove-hook 'window-configuration-change-hook #'eshell-refresh-windows)) + (provide 'em-smart) ;; Local Variables: diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index e0af3579edf..b3cde472713 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -79,6 +79,7 @@ eshell-mode (defcustom eshell-mode-unload-hook nil "A hook that gets run when `eshell-mode' is unloaded." :type 'hook) +(make-obsolete-variable 'eshell-mode-unload-hook nil "30.1") (defcustom eshell-mode-hook nil "A hook that gets run when `eshell-mode' is entered." diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el index 651e793ad98..7fc74d38796 100644 --- a/lisp/eshell/esh-module.el +++ b/lisp/eshell/esh-module.el @@ -47,6 +47,7 @@ eshell-module-unload-hook "A hook run when `eshell-module' is unloaded." :type 'hook :group 'eshell-module) +(make-obsolete-variable 'eshell-module-unload-hook nil "30.1") (defcustom eshell-modules-list '(eshell-alias @@ -85,20 +86,37 @@ eshell-modules-list ;;; Code: +(defsubst eshell-module--feature-name (module &optional kind) + "Get the feature name for the specified Eshell MODULE." + (let ((module-name (symbol-name module)) + (prefix (cond ((eq kind 'core) "esh-") + ((memq kind '(extension nil)) "em-") + (t (error "unknown module kind %s" kind))))) + (if (string-match "^eshell-\\(.*\\)" module-name) + (concat prefix (match-string 1 module-name)) + (error "Invalid Eshell module name: %s" module)))) + (defsubst eshell-using-module (module) "Return non-nil if a certain Eshell MODULE is in use. The MODULE should be a symbol corresponding to that module's customization group. Example: `eshell-cmpl' for that module." (memq module eshell-modules-list)) +(defun eshell-unload-modules (modules &optional kind) + "Try to unload the specified Eshell MODULES." + (dolist (module modules) + (let ((module-feature (intern (eshell-module--feature-name module kind)))) + (when (featurep module-feature) + (message "Unloading %s..." (symbol-name module)) + (condition-case-unless-debug _ + (progn + (unload-feature module-feature) + (message "Unloading %s...done" (symbol-name module))) + (error (message "Unloading %s...failed" (symbol-name module)))))))) + (defun eshell-unload-extension-modules () - "Unload any memory resident extension modules." - (dolist (module (eshell-subgroups 'eshell-module)) - (if (featurep module) - (ignore-errors - (message "Unloading %s..." (symbol-name module)) - (unload-feature module) - (message "Unloading %s...done" (symbol-name module)))))) + "Try to unload all currently-loaded Eshell extension modules." + (eshell-unload-modules (eshell-subgroups 'eshell-module))) (provide 'esh-module) ;;; esh-module.el ends here diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index 9253f9a4a7d..09c19767a19 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -29,6 +29,11 @@ ;; defined in esh-util. (require 'esh-util) +(defgroup eshell-opt nil + "Functions for argument parsing in Eshell commands." + :tag "Option parsing" + :group 'eshell) + (defmacro eshell-eval-using-options (name macro-args options &rest body-forms) "Process NAME's MACRO-ARGS using a set of command line OPTIONS. After doing so, stores settings in local symbols as declared by OPTIONS; diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 0bfc0413cbf..7d2c0335db2 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -199,10 +199,11 @@ eshell-load-hook :type 'hook :group 'eshell) -(defcustom eshell-unload-hook '(eshell-unload-all-modules) +(defcustom eshell-unload-hook nil "A hook run when Eshell is unloaded from memory." :type 'hook :group 'eshell) +(make-obsolete-variable 'eshell-unload-hook nil "30.1") (defcustom eshell-buffer-name "*eshell*" "The basename used for Eshell buffers. @@ -370,28 +371,14 @@ eshell-command-result (set status-var eshell-last-command-status)) (cadr result)))))) -;;; Code: - -(defun eshell-unload-all-modules () - "Unload all modules that were loaded by Eshell, if possible. -If the user has require'd in any of the modules, or customized a -variable with a :require tag (such as `eshell-prefer-to-shell'), it -will be impossible to unload Eshell completely without restarting -Emacs." - ;; if the user set `eshell-prefer-to-shell' to t, but never loaded - ;; Eshell, then `eshell-subgroups' will be unbound - (when (fboundp 'eshell-subgroups) - (dolist (module (eshell-subgroups 'eshell)) - ;; this really only unloads as many modules as possible, - ;; since other `require' references (such as by customizing - ;; `eshell-prefer-to-shell' to a non-nil value) might make it - ;; impossible to unload Eshell completely - (if (featurep module) - (ignore-errors - (message "Unloading %s..." (symbol-name module)) - (unload-feature module) - (message "Unloading %s...done" (symbol-name module))))) - (message "Unloading eshell...done"))) +(defun eshell-unload-function () + (eshell-unload-extension-modules) + ;; Wait to unload core modules until after `eshell' has finished + ;; unloading. `eshell' depends on several of them, so they can't be + ;; unloaded immediately. + (run-at-time 0 nil #'eshell-unload-modules + (reverse (eshell-subgroups 'eshell)) 'core) + nil) (run-hooks 'eshell-load-hook) diff --git a/test/lisp/eshell/eshell-tests-unload.el b/test/lisp/eshell/eshell-tests-unload.el new file mode 100644 index 00000000000..cdd58efef18 --- /dev/null +++ b/test/lisp/eshell/eshell-tests-unload.el @@ -0,0 +1,99 @@ +;;; eshell-tests-unload.el --- test unloading Eshell -*- lexical-binding:t -*- + +;; Copyright (C) 2023 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Tests for unloading Eshell. + +;;; Code: + +(require 'ert) +(require 'ert-x) + +;; In order to test unloading Eshell, don't require any of its files +;; at the top level. This means we need to explicitly declare some of +;; the variables and functions we'll use. +(defvar eshell-directory-name) +(defvar eshell-history-file-name) +(defvar eshell-last-dir-ring-file-name) +(defvar eshell-modules-list) + +(declare-function eshell-module--feature-name "esh-module" + (module &optional kind)) +(declare-function eshell-subgroups "esh-util" (groupsym)) + +(defvar max-unload-time 5 + "The maximum amount of time to wait to unload Eshell modules, in seconds. +See `unload-eshell'.") + +(defun load-eshell () + "Load Eshell by calling the `eshell' function and immediately closing it." + (save-current-buffer + (ert-with-temp-directory eshell-directory-name + (let* (;; We want no history file, so prevent Eshell from falling + ;; back on $HISTFILE. + (process-environment (cons "HISTFILE" process-environment)) + (eshell-history-file-name nil) + (eshell-last-dir-ring-file-name nil) + (eshell-buffer (eshell t))) + (let (kill-buffer-query-functions) + (kill-buffer eshell-buffer)))))) + +(defun unload-eshell () + "Unload Eshell, waiting until the core modules are unloaded as well." + (let ((debug-on-error t) + (inhibit-message t)) + (unload-feature 'eshell) + ;; We unload core modules are unloaded from a timer, since they + ;; need to wait until after `eshell' itself is unloaded. Wait for + ;; this to finish. + (let ((start (current-time))) + (while (featurep 'esh-arg) + (when (> (float-time (time-since start)) + max-unload-time) + (error "timed out waiting to unload Eshell modules")) + (sit-for 0.1))))) + +;;; Tests: + +(ert-deftest eshell-test-unload/default () + "Test unloading Eshell with the default list of extension modules." + (load-eshell) + (unload-eshell)) + +(ert-deftest eshell-test-unload/no-modules () + "Test unloading Eshell with no extension modules." + (require 'esh-module) + (let (eshell-modules-list) + (load-eshell)) + (dolist (module (eshell-subgroups 'eshell-module)) + (should-not (featurep (intern (eshell-module--feature-name module))))) + (unload-eshell)) + +(ert-deftest eshell-test-unload/all-modules () + "Test unloading Eshell with every extension module." + (require 'esh-module) + (let ((eshell-modules-list (eshell-subgroups 'eshell-module))) + (load-eshell)) + (dolist (module (eshell-subgroups 'eshell-module)) + (should (featurep (intern (eshell-module--feature-name module))))) + (unload-eshell)) + +(provide 'eshell-tests-unload) +;;; eshell-tests-unload.el ends here commit 324a1d83c99f6641fa0460fe8c91fa9afad8a4eb Author: Jim Porter Date: Sun Feb 12 23:25:40 2023 -0800 ; Don't require 'eshell' in other Eshell files This isn't necessary and just makes unloading Eshell harder. * lisp/eshell/em-banner.el: * lisp/eshell/em-basic.el: * lisp/eshell/em-cmpl.el: * lisp/eshell/em-glob.el: * lisp/eshell/em-prompt.el: * lisp/eshell/em-rebind.el: * lisp/eshell/em-smart.el: * lisp/eshell/em-term.el: * lisp/eshell/em-tramp.el: * lisp/eshell/em-xtra.el: Stop requiring 'eshell', and instead require specific subcomponents. * lisp/eshell/em-hist.el: Stop requiring 'eshell' and 'em-pred' (extension modules shouldn't require each other so they can be independent). (eshell-hist-parse-modifier): Ensure this can only be called when 'em-pred' is in use, and declare the relevant function. * lisp/eshell/eshell.el (eshell-non-interactive-p): Move from here... * lisp/eshell/esh-mode.el (eshell-non-interactive-p): ... to here. diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el index 8bc497bdeb3..2bee50b80a4 100644 --- a/lisp/eshell/em-banner.el +++ b/lisp/eshell/em-banner.el @@ -43,7 +43,6 @@ (require 'esh-util) (require 'esh-mode) -(require 'eshell) ;;;###autoload (progn diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index bfff3bdf56e..016afe811b2 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el @@ -53,9 +53,10 @@ ;;; Code: -(require 'esh-util) -(require 'eshell) +(require 'esh-cmd) +(require 'esh-io) (require 'esh-opt) +(require 'esh-util) ;;;###autoload (progn diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index 2439f1ed804..af8ac4278f1 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -74,9 +74,7 @@ (require 'esh-util) (require 'em-dirs) -(eval-when-compile - (require 'cl-lib) - (require 'eshell)) +(eval-when-compile (require 'cl-lib)) ;;;###autoload (progn diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 716f5c32b87..c7360fb246e 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -49,8 +49,9 @@ ;;; Code: +(require 'esh-arg) +(require 'esh-module) (require 'esh-util) -(eval-when-compile (require 'eshell)) ;;;###autoload (progn diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 6e0e471d910..4796df1604e 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -59,8 +59,6 @@ (require 'ring) (require 'esh-opt) (require 'esh-mode) -(require 'em-pred) -(require 'eshell) ;;;###autoload (progn @@ -769,6 +767,8 @@ eshell-hist-parse-word-designator (defun eshell-hist-parse-modifier (hist reference) "Parse a history modifier beginning for HIST in REFERENCE." + (cl-assert (eshell-using-module 'em-pred)) + (declare-function eshell-parse-modifiers "em-pred" ()) (let ((here (point))) (insert reference) (prog1 diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index b3a0fadf618..9f9e58e83d7 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -27,8 +27,6 @@ ;;; Code: (require 'esh-mode) -(eval-when-compile (require 'eshell)) - (require 'text-property-search) ;;;###autoload diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el index f147d432300..75a2848a9d5 100644 --- a/lisp/eshell/em-rebind.el +++ b/lisp/eshell/em-rebind.el @@ -24,7 +24,6 @@ ;;; Code: (require 'esh-mode) -(eval-when-compile (require 'eshell)) ;;;###autoload (progn diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index ca04c429785..154ff760212 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el @@ -69,7 +69,6 @@ ;;; Code: (require 'esh-mode) -(eval-when-compile (require 'eshell)) ;;;###autoload (progn diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index a4d777e4a0d..ab26da857b7 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -34,7 +34,6 @@ (require 'cl-lib) (require 'esh-util) (require 'esh-ext) -(eval-when-compile (require 'eshell)) (require 'term) ;;;###autoload diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index 13dd62e1617..94eb9797033 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el @@ -29,8 +29,7 @@ (require 'esh-cmd) (eval-when-compile - (require 'esh-mode) - (require 'eshell)) + (require 'esh-mode)) (require 'tramp) diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el index defaa7b2887..45c3ea3c0fc 100644 --- a/lisp/eshell/em-xtra.el +++ b/lisp/eshell/em-xtra.el @@ -25,8 +25,6 @@ (require 'cl-lib) (require 'esh-util) -(eval-when-compile - (require 'eshell)) ;; There are no items in this custom group, but eshell modules (ab)use ;; custom groups. diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 1b8f5ff8018..e0af3579edf 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -200,6 +200,11 @@ eshell-directory-name (defvar eshell-first-time-p t "A variable which is non-nil the first time Eshell is loaded.") +(defvar eshell-non-interactive-p nil + "A variable which is non-nil when Eshell is not running interactively. +Modules should use this variable so that they don't clutter +non-interactive sessions, such as when using `eshell-command'.") + ;; Internal Variables: ;; these are only set to nil initially for the sake of the diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 7a7ece5cb7c..0bfc0413cbf 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -267,10 +267,7 @@ eshell-command-mode (define-obsolete-function-alias 'eshell-return-exits-minibuffer #'eshell-command-mode "28.1") -(defvar eshell-non-interactive-p nil - "A variable which is non-nil when Eshell is not running interactively. -Modules should use this variable so that they don't clutter -non-interactive sessions, such as when using `eshell-command'.") +(defvar eshell-non-interactive-p) ; Defined in esh-mode.el. (declare-function eshell-add-input-to-history "em-hist" (input)) commit 2550e8bb0b03ee1c2c7a17d56c9f578bbbf1a9da (refs/remotes/origin/emacs-29) Author: Eli Zaretskii Date: Wed Feb 15 21:00:54 2023 +0200 Fix mule-tests under en_US.UTF-8 locale * test/lisp/international/mule-tests.el (sgml-html-meta-utf-8): Accept also utf-8-unix/dos/whatever. (Bug#61534) * lisp/international/mule.el (sgml-html-meta-auto-coding-function): Fix comparison when buffer-file-coding-system is of type 'charset'. diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 52019697ad7..25b90b49c8f 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -2544,6 +2544,7 @@ sgml-html-meta-auto-coding-function ;; coding-system-equal, since it isn't a ;; coding-system. So test that up front. (not (equal sym-type 'charset)) + (not (equal bfcs-type 'charset)) (coding-system-equal 'utf-8 sym-type) (coding-system-equal 'utf-8 bfcs-type)) buffer-file-coding-system diff --git a/test/lisp/international/mule-tests.el b/test/lisp/international/mule-tests.el index 6e23d8c5421..6b76e35ae22 100644 --- a/test/lisp/international/mule-tests.el +++ b/test/lisp/international/mule-tests.el @@ -99,7 +99,7 @@ sgml-html-meta-run (ert-deftest sgml-html-meta-utf-8 () "Baseline: UTF-8." - (should (eq 'utf-8 (sgml-html-meta-run "utf-8")))) + (should (eq 'utf-8 (coding-system-base (sgml-html-meta-run "utf-8"))))) (ert-deftest sgml-html-meta-windows-hebrew () "A non-Unicode charset." commit 32795309939fe0153644ce1ff100b5fc615e6ec2 Author: Theodor Thornhill Date: Wed Feb 15 19:21:50 2023 +0100 Move block closer above declaration_list rule (bug#61531) * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Move rule above the previous rule. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 5337d148fc0..020f2642ac2 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -267,15 +267,15 @@ c-ts-mode--indent-styles ((query "(for_statement update: (_) @indent)") parent-bol 5) ((query "(call_expression arguments: (_) @indent)") parent c-ts-mode-indent-offset) ((parent-is "call_expression") parent 0) + ;; Closing bracket. This should be before initializer_list + ;; (and probably others) rule because that rule (and other + ;; similar rules) will match the closing bracket. (Bug#61398) + ((node-is "}") point-min c-ts-common-statement-offset) ,@(when (eq mode 'cpp) '(((node-is "access_specifier") parent-bol 0) ;; Indent the body of namespace definitions. ((parent-is "declaration_list") parent-bol c-ts-mode-indent-offset))) - ;; Closing bracket. This should be before initializer_list - ;; (and probably others) rule because that rule (and other - ;; similar rules) will match the closing bracket. (Bug#61398) - ((node-is "}") point-min c-ts-common-statement-offset) ;; int[5] a = { 0, 0, 0, 0 }; ((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset) commit b18754bb179a1125a7de99f7e2351776669d3cfc Author: Eli Zaretskii Date: Wed Feb 15 20:01:40 2023 +0200 Minor improvements in c-ts-mode and docs * lisp/progmodes/c-ts-mode.el (c-ts-base-mode-map): Add a binding for comment-region. * doc/emacs/programs.texi (C Indent): Mention "C-u TAB". diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index e9268ff2a0d..69b4f56bee1 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -540,15 +540,18 @@ C Indent @kindex C-M-q @r{(C mode)} @findex c-indent-exp @findex prog-indent-sexp -Reindent each line in the balanced expression that follows point. In -CC mode, this invokes @code{c-indent-exp}; in tree-sitter based -@code{c-ts-mode} this invokes a more general @code{prog-indent-sexp}. -A prefix argument inhibits warning messages about invalid syntax. +Reindent each line in the balanced expression (@pxref{Expressions}), +also known as ``sexp'', that follows point. In CC mode, this invokes +@code{c-indent-exp}; in tree-sitter based @code{c-ts-mode} this +invokes a more general @code{prog-indent-sexp}. A prefix argument +inhibits warning messages about invalid syntax. @item @key{TAB} @findex c-indent-line-or-region Reindent the current line, active region, or block starting on this -line (@code{c-indent-line-or-region}). +line (@code{c-indent-line-or-region}). With prefix argument, rigidly +reindent the balanced expression which starts on the current line, if +the current line needs reindentation. @vindex c-tab-always-indent If @code{c-tab-always-indent} is @code{t}, this command always reindents diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 04f68881945..5337d148fc0 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -738,7 +738,8 @@ c-ts-base-mode-map :doc "Keymap for C and C-like languages with tree-sitter" :parent prog-mode-map "C-c C-q" #'c-ts-mode-indent-defun - "C-c ." #'c-ts-mode-set-style) + "C-c ." #'c-ts-mode-set-style + "C-c C-c" #'comment-region) ;;;###autoload (define-derived-mode c-ts-base-mode prog-mode "C" commit 3c6b726a7b4a954b2e2c7bcd10dda8a2a931f50b Author: Theodor Thornhill Date: Wed Feb 15 18:54:46 2023 +0100 Add super node as a keyword * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): Add new node. diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index e15da7110f1..6948ebba631 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -162,7 +162,8 @@ java-ts-mode--font-lock-settings :override t :feature 'keyword `([,@java-ts-mode--keywords - (this)] @font-lock-keyword-face + (this) + (super)] @font-lock-keyword-face (labeled_statement (identifier) @font-lock-keyword-face)) :language 'java commit 1917c51fe6881847e5e373b81d2330aa86b5b7bb Author: F. Jason Park Date: Tue Feb 14 07:29:25 2023 -0800 ; Prevent ERC-induced false positive in JUnit report * test/lisp/erc/erc-scenarios-internal.el: Mimic other test files, like perl-mode-tests.el, in setting `ert-load-file-name' globally. This file formerly caused a false positive in the error detection logic of `ert-write-junit-test-summary-report'. It affected all scheduled pipelines, including those for the release branch, Emacs 29. diff --git a/test/lisp/erc/erc-scenarios-internal.el b/test/lisp/erc/erc-scenarios-internal.el index 8d38c2dde49..18eb94e24b0 100644 --- a/test/lisp/erc/erc-scenarios-internal.el +++ b/test/lisp/erc/erc-scenarios-internal.el @@ -21,6 +21,9 @@ (require 'ert-x) (eval-and-compile + (when (and (getenv "EMACS_TEST_DIRECTORY") + (getenv "EMACS_TEST_JUNIT_REPORT")) + (setq ert-load-file-name (or (macroexp-file-name) buffer-file-name))) (let ((load-path (cons (expand-file-name "erc-d" (ert-resource-directory)) load-path))) (load "erc-d-tests" nil 'silent))) commit b16965ef7e60e5220490a727b084439ed0d00ece Author: Stefan Kangas Date: Wed Feb 15 16:16:00 2023 +0100 Delete perplexing paragraph from Gnus manual * doc/misc/gnus.texi (Exiting Gnus): Delete a confusing paragraph, that may or may not have been intended as a joke. (Bug#61325) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 1769b70c9bc..486171a080a 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -3853,15 +3853,6 @@ Exiting Gnus @code{gnus-after-exiting-gnus-hook} is called as the final item when exiting Gnus. -Note: - -@quotation -Miss Lisa Cannifax, while sitting in English class, felt her feet go -numbly heavy and herself fall into a hazy trance as the boy sitting -behind her drew repeated lines with his pencil across the back of her -plastic chair. -@end quotation - @node Group Topics @section Group Topics commit dc843e0a9b3ba3e29bc65bdbd1050cfcc96cad5d Author: Robert Pluim Date: Wed Feb 15 16:05:50 2023 +0100 Describe the effect of 'guess' for 'ido-use-filename-at-point' * ido.el (ido-use-filename-at-point): Document 'guess' value better. diff --git a/lisp/ido.el b/lisp/ido.el index 98633d5d798..00a2e57f7ba 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -565,11 +565,12 @@ ido-work-directory-list-ignore-regexps (defcustom ido-use-filename-at-point nil "Non-nil means that Ido shall look for a filename at point. -May use `ffap-guesser' to guess whether text at point is a filename. -If found, use that as the starting point for filename selection." +Value `guess' means use `ffap-guesser' to guess whether text at +point is a filename. If found, use that as the starting point +for filename selection." :type '(choice (const :tag "Disabled" nil) - (const :tag "Guess filename" guess) + (const :tag "Guess filename using ffap-guesser" guess) (other :tag "Use literal filename" t))) commit 6a677fd3b6677248a8bc1787b105879684289fa2 Author: Robert Pluim Date: Wed Feb 15 14:31:43 2023 +0100 New option 'diff-ignore-whitespace-switches' Allows specifying the switches to use when ignoring whitespace for those of us who don't like "-b". * lisp/vc/diff-mode.el (diff-ignore-whitespace-switches): New defcustom. (diff-refresh-hunk): Use it when ignoring whitespace. * doc/emacs/files.texi (Diff Mode): Describe the new option. * etc/NEWS: Announce the new option. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 6586998e179..a9ae4696a06 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1737,10 +1737,13 @@ Diff Mode Re-generate the current hunk (@code{diff-refresh-hunk}). @item C-c C-w +@vindex diff-ignore-whitespace-switches @findex diff-ignore-whitespace-hunk Re-generate the current hunk, disregarding changes in whitespace. With a non-@code{nil} prefix arg, re-generate all the hunks -(@code{diff-ignore-whitespace-hunk}). +(@code{diff-ignore-whitespace-hunk}). This calls @code{diff-command} +with @code{diff-ignore-whitespace-switches}, which defaults to +@samp{-b}, meaning ignore changes in whitespace only. @item C-x 4 A @findex diff-add-change-log-entries-other-window diff --git a/etc/NEWS b/etc/NEWS index 624bbdf98f9..c635e1fbe87 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -106,6 +106,12 @@ When called with a non-nil prefix argument 'diff-ignore-whitespace-hunk' now iterates over all the hunks in the current diff, regenerating them without whitespace changes. ++++ +*** New user option 'diff-ignore-whitespace-switches'. +This allows changing which type of whitespace changes are ignored when +regenerating hunks with 'diff-ignore-whitespace-hunk'. Defaults to +the previously hard-coded "-b". + ** Buffer Selection --- diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 6d8a868aa48..d776375d681 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -153,6 +153,17 @@ diff-whitespace-style :type (get 'whitespace-style 'custom-type) :version "29.1") +(defcustom diff-ignore-whitespace-switches "-b" + "Switch or list of diff switches to use when ignoring whitespace. +The default \"-b\" means to ignore whitespace-only changes, +\"-w\" means ignore all whitespace changes." + :type '(choice + (string :tag "Ignore whitespace-only changes" :value "-b") + (string :tag "Ignore all whitespace changes" :value "-w") + (string :tag "Single switch") + (repeat :tag "Multiple switches" (string :tag "Switch"))) + :version "30.1") + (defvar diff-vc-backend nil "The VC backend that created the current Diff buffer, if any.") @@ -2130,7 +2141,7 @@ diff-refresh-hunk (coding-system-for-read buffer-file-coding-system) opts old new) (when ignore-whitespace - (setq opts '("-b"))) + (setq opts (ensure-list diff-ignore-whitespace-switches))) (when opt-type (setq opts (cons opt-type opts))) commit 43c62a4732d03c3f64bc512c2e73c13d3d964192 Author: Stefan Kangas Date: Wed Feb 15 15:21:43 2023 +0100 ; Fix typo diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index f510b7bb6c9..ec823d09d8c 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -293,7 +293,7 @@ rust-ts-mode--font-lock-settings '((field_identifier) @font-lock-property-face (shorthand_field_initializer (identifier) @font-lock-property-face)) - ;; Must be under type, otherwise some imports can be highlighted as consants. + ;; Must be under type, otherwise some imports can be highlighted as constants. :language 'rust :feature 'constant `((boolean_literal) @font-lock-constant-face commit 80b34d165da8b65bf31be7fc4de09610d7bf66f6 Author: Ulrich Müller Date: Tue Feb 14 19:51:37 2023 +0100 ; Simplify eclipse calculation in calendar/lunar.el * lisp/calendar/lunar.el (eclipse-check): Do the calculation in degrees, and simplify. diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 8ced4144105..1f827ca34b0 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el @@ -155,25 +155,18 @@ lunar-phase ;; from "Astronomy with your Personal Computer", Subroutine Eclipse ;; Line 7000 Peter Duffett-Smith Cambridge University Press 1990 (defun eclipse-check (moon-lat phase) - (let* ((moon-lat (* (/ float-pi 180) moon-lat)) - ;; For positions near the ascending or descending node, - ;; calculate the absolute angular distance from that node. - (moon-lat (abs (- moon-lat (* (floor (/ moon-lat float-pi)) - float-pi)))) - (moon-lat (if (> moon-lat 0.37) ; FIXME (* 0.5 float-pi) - (- float-pi moon-lat) - moon-lat)) + (let* ((node-dist (mod moon-lat 180)) + ;; Absolute angular distance from the ascending or descending + ;; node, whichever is nearer. + (node-dist (min node-dist (- 180 node-dist))) (phase-name (cond ((= phase 0) "Solar") ((= phase 2) "Lunar") (t "")))) - (cond ((string= phase-name "") - "") - ((< moon-lat 2.42600766e-1) - (concat "** " phase-name " Eclipse **")) - ((< moon-lat 0.37) - (concat "** " phase-name " Eclipse possible **")) - (t - "")))) + (cond + ((string= phase-name "") "") + ((< node-dist 13.9) (concat "** " phase-name " Eclipse **")) + ((< node-dist 21.2) (concat "** " phase-name " Eclipse possible **")) + (t "")))) (defconst lunar-cycles-per-year 12.3685 ; 365.25/29.530588853 "Mean number of lunar cycles per 365.25 day year.") commit 1e0f4c554b76e06eb56583cf5e8fe930d62e85f4 Merge: 142f5683c10 fdac69b45e6 Author: Stefan Kangas Date: Wed Feb 15 14:41:04 2023 +0100 ; Merge from origin/emacs-29 The following commit was skipped: fdac69b45e6 ; Auto-commit of loaddefs files. commit 142f5683c1042a5344abd51b97fe8e0d0c8cc5f5 Merge: 571558e4600 7678b7e46f2 Author: Stefan Kangas Date: Wed Feb 15 14:41:04 2023 +0100 Merge from origin/emacs-29 7678b7e46f2 Eglot: check server capability before sending didSave (bu... a3a1ef7bd5e Fix rust-ts-mode type and module highlighting (Bug#61302) 477aa047ee7 rust-ts-mode: Highlight variable reassignments 5206a551c16 Improve backward compatibility of save-restriction accd88d5545 Don't indent template_string contents (bug#61503) d97a3839967 csharp-ts-mode: fontify compiler directives (bug#61512) 420d2cae846 Update to Transient v0.3.7-209-gdab1dfa a3751b5d0c1 ; Raise an error if a VC package checkout is empty 6a32ba8b69c ; Fix the installation of dependencies for VC packages 4eac80fcc39 ; Prepare to update ERC version to 5.5 4f099a72173 ; Remove failing erc-reuse-buffers test 4bb27a5ca93 ; Minor docs copyedits 13bcff3da5c Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 3d572ae0d50 Rename with/without-narrowing to with/without-restriction d806b0e33cf * lisp/repeat.el: Rename internal function and variable (... dd8b720ee74 ; * etc/NEWS: Fix typos. 909bd04cf5f ; * lisp/calendar/lunar.el: Add comments. (bug#61460) 10f2aedea9a ; * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): delete ... 865758130a1 ; * admin/git-bisect-start: Update failing commits b948d0d7efe Merge branch 'scratch/fix-locked-narrowing' dcb2379a463 Minor improvements to labeled narrowing cc30422825a Fix spurious display of eclipses in Calendar f2114e8d89f Fix indentation for closing bracket in c-ts-mode (bug#61398) f49caaa8925 ; * src/pdumper.c (dump_buffer): Update hash. fe2ea5ddd8d Update to Org 9.6.1-31-gaf1bb1 8280d721d7c * src/.gdbinit (nextcons): Amend $.u.cdr to $.u.s.u.cdr (... eb2b0931cf1 Add lambda_expression to c-ts-common-indent-type-regexp-a... 2da05876edb ; Use the right name when specifying VC packages d4fc7012978 Tolerate missing elpa-packages.eld files 8bc1b7d0b27 Avoid warning about 'load-path' in non-interactive sessions 3d17aee13d9 ; Fix installation of dependencies for VC packages 86ca7df6a34 ; Mention Hunspell private-dictionary misfeature in doc s... 7287b7b53a1 Support webkit2gtk-4.1 048a2dabfc4 ; Fix typo 8f3091defb3 ; Fix typo in buffer.h 4da398d8b57 ; Fix typos 074008ee2d2 ; Fix doc strings in lisp/image/ directory 2d1e43436da ; Improve documentation of hash functions. 900f7e07275 ; Remove extraneous local variables from image-dired-*.el... 4297039bd13 Save and restore the absence of narrowing locks 4f053afe8e7 bug-reference: prevent match-data clobbering (bug#61395) 10af9fbcad1 ; * admin/notes/tree-sitter/starter-guide: Typos. 9ac242ce93d ; Fix recent changes in treesit docs f5789aefc2e Rename LIMIT to DEPTH in tree-sitter functions (bug#61231) b39821fdcef ; Fix incorrect function name in treesit manual 51901736965 Add 'live' property to treesit-node-check (bug#61235) 56960a6558b Update to Transient v0.3.7-205-gb8ad0da 68a6b364d1c Fix 'rmail-summary-output' 67c6ec25590 lisp-mode: add docstring recognition for more common lisp... 417a8ed8b05 ; Improve discoverability of empty file names handling e47cf6ca15a Update to Transient v0.3.7-204-gecff8c2 b04cce02ff4 Fix Scala entry in Eglot's DB of LSP servers 973c1d24c6a ruby-ts-mode: Also don't reindent 'identifier' when insid... a5651c0c403 ruby-ts-mode: Fix indentation inside empty if/unless/case... 2956e54b1dd Add an extensive test for labeled (locked) narrowing 79ce185ad13 Update the documentation about labeled (locked) narrowing a6cd4553d48 Rename two long line optimizations variables 0d73e4aa261 Add specific symbols for narrowings d8438e2bb44 Add 'without-narrowing' macro 97314447e60 Make 'narrowing-lock' and 'narrowing-unlock' internal a4aa32bdfff Fix 'save-restriction' for narrowing locks # Conflicts: # etc/NEWS commit 571558e460059b3756f592abaaf2a9a67778db66 Author: Robert Pluim Date: Tue Jan 10 19:55:50 2023 +0100 Teach 'diff-ignore-whitespace-hunk' how to regenerate all hunks This implements the request from Bug#58516. * lisp/vc/diff-mode.el (diff--ignore-whitespace-all-hunks): New function. Iterate over all hunks, regenerate ignoring whitespace changes. (diff-ignore-whitespace-hunk): Call `diff--ignore-whitespace-all-hunks' when called with a prefix arg. * doc/emacs/files.texi (Diff Mode): Describe new functionality. * etc/NEWS: Announce the change. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 664b9d5d9a3..6586998e179 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1738,7 +1738,8 @@ Diff Mode @item C-c C-w @findex diff-ignore-whitespace-hunk -Re-generate the current hunk, disregarding changes in whitespace +Re-generate the current hunk, disregarding changes in whitespace. +With a non-@code{nil} prefix arg, re-generate all the hunks (@code{diff-ignore-whitespace-hunk}). @item C-x 4 A diff --git a/etc/NEWS b/etc/NEWS index 2d63593ff17..624bbdf98f9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -98,6 +98,14 @@ This is a string or a list of strings that specifies the Git log switches for shortlogs, such as the one produced by 'C-x v L'. 'vc-git-log-switches' is no longer used for shortlogs. +** Diff Mode + ++++ +*** 'diff-ignore-whitespace-hunk' can now be applied to all hunks. +When called with a non-nil prefix argument +'diff-ignore-whitespace-hunk' now iterates over all the hunks in the +current diff, regenerating them without whitespace changes. + ** Buffer Selection --- diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index eb01dede56e..6d8a868aa48 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2103,10 +2103,13 @@ diff-current-defun (goto-char (+ (car pos) (cdr src))) (add-log-current-defun))))))) -(defun diff-ignore-whitespace-hunk () - "Re-diff the current hunk, ignoring whitespace differences." - (interactive) - (diff-refresh-hunk t)) +(defun diff-ignore-whitespace-hunk (&optional whole-buffer) + "Re-diff the current hunk, ignoring whitespace differences. +With non-nil prefix arg, re-diff all the hunks." + (interactive "P") + (if whole-buffer + (diff--ignore-whitespace-all-hunks) + (diff-refresh-hunk t))) (defun diff-refresh-hunk (&optional ignore-whitespace) "Re-diff the current hunk." @@ -2299,6 +2302,16 @@ diff--iterate-hunks (or (ignore-errors (diff-hunk-next) (point)) max))))))))) +;; This doesn't use `diff--iterate-hunks', since that assumes that +;; hunks don't change size. +(defun diff--ignore-whitespace-all-hunks () + "Re-diff all the hunks, ignoring whitespace-differences." + (save-excursion + (goto-char (point-min)) + (diff-hunk-next) + (while (looking-at diff-hunk-header-re) + (diff-refresh-hunk t)))) + (defun diff--font-lock-refined (max) "Apply hunk refinement from font-lock." (when (eq diff-refine 'font-lock) commit b9ef710dd3b46bdfe7a0352873a0f2be5b9e4ce4 Author: Mattias Engdegård Date: Wed Feb 15 12:21:44 2023 +0100 ; * lisp/international/emoji.el (emoji--narrow): move, avoid warning diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index b920582fee0..fec3e637f0c 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -116,6 +116,11 @@ emoji-search (emoji--add-recent glyph) (insert glyph)))) +(defclass emoji--narrow (transient-suffix) + ((title :initarg :title) + (done-derived :initarg :done-derived) + (children :initarg :children))) + (defun emoji--setup-prefix (command title done-derived spec) (transient-setup command nil nil @@ -137,11 +142,6 @@ emoji--setup-suffixes (defun emoji--group-description () (car (oref transient--prefix scope))) -(defclass emoji--narrow (transient-suffix) - ((title :initarg :title) - (done-derived :initarg :done-derived) - (children :initarg :children))) - (transient-define-suffix emoji-insert-glyph () "Insert the emoji you selected." (interactive nil not-a-mode) commit 16ba96ad3ddbd5607a2e40ffe5abfe53c3e6a1c5 Author: Mattias Engdegård Date: Wed Feb 15 12:01:25 2023 +0100 Add some `pure` and `side-effect-free` declarations * lisp/subr.el (string-to-list, string-to-vector, string-or-null-p) (booleanp, special-form-p, plistp, macrop, compiled-function-p) (flatten-tree): * lisp/emacs-lisp/subr-x.el (string-join, string-truncate-left) (string-blank-p, string-remove-prefix, string-remove-suffix) (string-pad, string-chop-newline): Declare functions pure, side-effect-free, and/or error-free. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 8cdbdf1ef6a..947390b3de3 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -102,6 +102,7 @@ string-join "Join all STRINGS using SEPARATOR. Optional argument SEPARATOR must be a string, a vector, or a list of characters; nil stands for the empty string." + (declare (pure t) (side-effect-free t)) (mapconcat #'identity strings separator)) (define-obsolete-function-alias 'string-reverse 'reverse "25.1") @@ -112,6 +113,7 @@ string-truncate-left When truncating, \"...\" is always prepended to the string, so the resulting string may be longer than the original if LENGTH is 3 or smaller." + (declare (pure t) (side-effect-free t)) (let ((strlen (length string))) (if (<= strlen length) string @@ -124,16 +126,19 @@ string-blank-p "Check whether STRING is either empty or only whitespace. The following characters count as whitespace here: space, tab, newline and carriage return." + (declare (pure t) (side-effect-free t)) (string-match-p "\\`[ \t\n\r]*\\'" string)) (defsubst string-remove-prefix (prefix string) "Remove PREFIX from STRING if present." + (declare (pure t) (side-effect-free t)) (if (string-prefix-p prefix string) (substring string (length prefix)) string)) (defsubst string-remove-suffix (suffix string) "Remove SUFFIX from STRING if present." + (declare (pure t) (side-effect-free t)) (if (string-suffix-p suffix string) (substring string 0 (- (length string) (length suffix))) string)) @@ -252,6 +257,7 @@ string-pad If START is nil (or not present), the padding is done to the end of the string, and if non-nil, padding is done to the start of the string." + (declare (pure t) (side-effect-free t)) (unless (natnump length) (signal 'wrong-type-argument (list 'natnump length))) (let ((pad-length (- length (length string)))) @@ -261,6 +267,7 @@ string-pad (defun string-chop-newline (string) "Remove the final newline (if any) from STRING." + (declare (pure t) (side-effect-free t)) (string-remove-suffix "\n" string)) (defun replace-region-contents (beg end replace-fn diff --git a/lisp/subr.el b/lisp/subr.el index 898ecb6e358..a5fc566cc74 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4124,15 +4124,18 @@ shell-quote-argument (defsubst string-to-list (string) "Return a list of characters in STRING." + (declare (side-effect-free t)) (append string nil)) (defsubst string-to-vector (string) "Return a vector of characters in STRING." + (declare (side-effect-free t)) (vconcat string)) (defun string-or-null-p (object) "Return t if OBJECT is a string or nil. Otherwise, return nil." + (declare (pure t) (side-effect-free error-free)) (or (stringp object) (null object))) (defun list-of-strings-p (object) @@ -4145,21 +4148,25 @@ list-of-strings-p (defun booleanp (object) "Return t if OBJECT is one of the two canonical boolean values: t or nil. Otherwise, return nil." + (declare (pure t) (side-effect-free error-free)) (and (memq object '(nil t)) t)) (defun special-form-p (object) "Non-nil if and only if OBJECT is a special form." + (declare (side-effect-free error-free)) (if (and (symbolp object) (fboundp object)) (setq object (indirect-function object))) (and (subrp object) (eq (cdr (subr-arity object)) 'unevalled))) (defun plistp (object) "Non-nil if and only if OBJECT is a valid plist." + (declare (pure t) (side-effect-free error-free)) (let ((len (proper-list-p object))) (and len (zerop (% len 2))))) (defun macrop (object) "Non-nil if and only if OBJECT is a macro." + (declare (side-effect-free t)) (let ((def (indirect-function object))) (when (consp def) (or (eq 'macro (car def)) @@ -4169,6 +4176,7 @@ compiled-function-p "Return non-nil if OBJECT is a function that has been compiled. Does not distinguish between functions implemented in machine code or byte-code." + (declare (side-effect-free error-free)) (or (subrp object) (byte-code-function-p object))) (defun field-at-pos (pos) @@ -6843,6 +6851,7 @@ flatten-tree \(flatten-tree \\='(1 (2 . 3) nil (4 5 (6)) 7)) => (1 2 3 4 5 6 7)" + (declare (side-effect-free error-free)) (let (elems) (while (consp tree) (let ((elem (pop tree))) commit fdac69b45e608f9f3610066ed873dacfd971119a Author: Stefan Kangas Date: Wed Feb 15 05:08:01 2023 +0100 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index dfb076e52df..dfa14140b4e 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -2921,7 +2921,7 @@ "semantic/bovine/c" ;;; Generated autoloads from progmodes/c-ts-common.el -(register-definition-prefixes "c-ts-common" '("c-ts-")) +(register-definition-prefixes "c-ts-common" '("c-ts-common-")) ;;; Generated autoloads from progmodes/c-ts-mode.el @@ -7881,36 +7881,53 @@ global-display-line-numbers-mode (fn &optional ARG)" t) (defvar header-line-indent "" "\ -String to indent at the start if the header line. -This is used in `header-line-indent-mode', and buffers that have -this switched on should have a `header-line-format' that look like: +String of spaces to indent the beginning of header-line due to line numbers. +This is intended to be used in `header-line-format', and requires +the `header-line-indent-mode' to be turned on, in order for the width +of this string to be kept updated when the line-number width changes +on display. An example of a `header-line-format' that uses this +variable might look like this: (\"\" header-line-indent THE-REST...) +where THE-REST is the format string which produces the actual text +of the header-line. Also see `header-line-indent-width'.") (defvar header-line-indent-width 0 "\ -The width of the current line numbers displayed. -This is updated when `header-line-indent-mode' is switched on. - +The width of the current line number display in the window. +This is measured in units of the frame's canonical columns. +This is updated when `header-line-indent-mode' is switched on, +and is intended for use in `:align-to' display specifications +that are part of `header-line-format', when portions of header-line +text should be aligned to respective parts of buffer text. Also see `header-line-indent'.") (autoload 'header-line-indent-mode "display-line-numbers" "\ -Mode to indent the header line in `display-line-numbers-mode' buffers. +Minor mode to help with alignment of header line when line numbers are shown. -This means that the header line will be kept indented so that it -has blank space that's as wide as the displayed line numbers in -the buffer. +This minor mode should be turned on in buffers which display header-line +that needs to be aligned with buffer text when `display-line-numbers-mode' +is turned on in the buffer. -Buffers that have this switched on should have a -`header-line-format' that look like: +Buffers that have this switched on should have a `header-line-format' +that uses the `header-line-indent' or the `header-line-indent-width' +variables, which this mode will keep up-to-date with the current +display of line numbers. For example, a `header-line-format' that +looks like this: (\"\" header-line-indent THE-REST...) -The `header-line-indent-width' variable is also kept updated, and -has the width of `header-line-format'. This can be used, for -instance, in `:align-to' specs, like: +will make sure the text produced by THE-REST (which should be +a header-line format string) is always indented to be aligned on +display with the first column of buffer text. + +The `header-line-indent-width' variable is also kept updated, +and can be used, for instance, in `:align-to' specs as part +of `header-line-format', like this: (space :align-to (+ header-line-indent-width 10)) +See also `line-number-display-width'. + This is a minor mode. If called interactively, toggle the `Header-Line-Indent mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable @@ -9763,6 +9780,10 @@ "emerge" the name is not known. (fn GLYPH &optional INTERACTIVE)" t) +(autoload 'emoji--init "emoji" "\ + + +(fn &optional FORCE INHIBIT-ADJUST)") (autoload 'emoji-zoom-increase "emoji" "\ Increase the size of the character under point. FACTOR is the multiplication factor for the size. @@ -10219,7 +10240,7 @@ 'erc-select When present, ID should be a symbol or a string to use for naming the server buffer and identifying the connection unequivocally. -See info node `(erc) Network Identifier' for details. Like USER +See Info node `(erc) Network Identifier' for details. Like USER and CLIENT-CERTIFICATE, this parameter cannot be specified interactively. @@ -15815,7 +15836,7 @@ "hideif" ;;; Generated autoloads from progmodes/hideshow.el -(defvar hs-special-modes-alist (mapcar #'purecopy '((c-mode "{" "}" "/[*/]" nil nil) (c++-mode "{" "}" "/[*/]" nil nil) (bibtex-mode ("@\\S(*\\(\\s(\\)" 1)) (java-mode "{" "}" "/[*/]" nil nil) (js-mode "{" "}" "/[*/]" nil) (mhtml-mode "{\\|<[^/>]*?" "}\\|]*[^/]>" "