diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/calendar/lunar.el | 7 | ||||
-rw-r--r-- | lisp/emacs-lisp/package-vc.el | 39 | ||||
-rw-r--r-- | lisp/erc/erc-backend.el | 6 | ||||
-rw-r--r-- | lisp/erc/erc-button.el | 2 | ||||
-rw-r--r-- | lisp/erc/erc-match.el | 2 | ||||
-rw-r--r-- | lisp/erc/erc-sasl.el | 39 | ||||
-rw-r--r-- | lisp/erc/erc-services.el | 6 | ||||
-rw-r--r-- | lisp/erc/erc.el | 44 | ||||
-rw-r--r-- | lisp/faces.el | 4 | ||||
-rw-r--r-- | lisp/international/mule.el | 1 | ||||
-rw-r--r-- | lisp/ldefs-boot.el | 110 | ||||
-rw-r--r-- | lisp/progmodes/c-ts-mode.el | 17 | ||||
-rw-r--r-- | lisp/progmodes/csharp-mode.el | 27 | ||||
-rw-r--r-- | lisp/progmodes/eglot.el | 15 | ||||
-rw-r--r-- | lisp/progmodes/java-ts-mode.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/js.el | 1 | ||||
-rw-r--r-- | lisp/progmodes/rust-ts-mode.el | 107 | ||||
-rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 1 | ||||
-rw-r--r-- | lisp/repeat.el | 18 | ||||
-rw-r--r-- | lisp/subr.el | 53 | ||||
-rw-r--r-- | lisp/textmodes/emacs-news-mode.el | 23 | ||||
-rw-r--r-- | lisp/transient.el | 250 |
22 files changed, 470 insertions, 305 deletions
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 70681f42c90..8ced4144105 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el @@ -85,6 +85,9 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon, (* 0.0107306 time time) (* 0.00001236 time time time)) 360.0)) + ;; moon-lat is the argument of latitude, which is the angle + ;; of the moon measured from the ascending node of its orbit + ;; (i.e. argument of perigee + true anomaly). (moon-lat (mod (+ 21.2964 (* 390.67050646 index) @@ -153,9 +156,11 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon, ;; 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) + (moon-lat (if (> moon-lat 0.37) ; FIXME (* 0.5 float-pi) (- float-pi moon-lat) moon-lat)) (phase-name (cond ((= phase 0) "Solar") diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index bf49f274bfd..b753adcb8a0 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -435,21 +435,26 @@ version of that package." (push pkg missing)))))) (version-order (a b) "Predicate to sort packages in order." - (version-list-< (cadr b) (cadr a))) + (version-list-< + (package-desc-version b) + (package-desc-version a))) (duplicate-p (a b) "Are A and B the same package?" - (eq (car a) (car b))) + (eq (package-desc-name a) (package-desc-name b))) (depends-on-p (target package) "Does PACKAGE depend on TARGET?" (or (eq target package) (let* ((pac package-archive-contents) (desc (cadr (assoc package pac)))) - (seq-some - (apply-partially #'depends-on-p target) - (package-desc-reqs desc))))) + (and desc (seq-some + (apply-partially #'depends-on-p target) + (package-desc-reqs desc)))))) (dependent-order (a b) - (or (not (depends-on-p (car b) (car a))) - (depends-on-p (car a) (car b))))) + (let ((desc-a (package-desc-name a)) + (desc-b (package-desc-name b))) + (or (not desc-a) (not desc-b) + (not (depends-on-p desc-b desc-a)) + (depends-on-p desc-a desc-b))))) (mapc #'search requirements) (cl-callf sort to-install #'version-order) (cl-callf seq-uniq to-install #'duplicate-p) @@ -597,6 +602,13 @@ attribute in PKG-SPEC." (vc-retrieve-tag dir release-rev) (message "No release revision was found, continuing..."))))) +(defvar package-vc-non-code-file-names + '(".dir-locals.el" ".dir-locals-2.el") + "List of file names that do not contain Emacs Lisp code. +This list is used by `package-vc--unpack' to better check if the +user is fetching code from a repository that does not contain any +Emacs Lisp files.") + (defun package-vc--unpack (pkg-desc pkg-spec &optional rev) "Install the package described by PKG-DESC. PKG-SPEC is a package specification, a property list describing @@ -606,7 +618,7 @@ checkout. This overrides the `:branch' attribute in PKG-SPEC." (pcase-let* (((map :lisp-dir) pkg-spec) (name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) - (pkg-dir (expand-file-name dirname package-user-dir))) + (pkg-dir (file-name-as-directory (expand-file-name dirname package-user-dir)))) (when (string-empty-p name) (user-error "Empty package name")) (setf (package-desc-dir pkg-desc) pkg-dir) @@ -615,6 +627,17 @@ checkout. This overrides the `:branch' attribute in PKG-SPEC." (package--delete-directory pkg-dir) (error "There already exists a checkout for %s" name))) (package-vc--clone pkg-desc pkg-spec pkg-dir rev) + (when (directory-empty-p pkg-dir) + (delete-directory pkg-dir) + (error "Empty checkout for %s" name)) + (unless (seq-remove + (lambda (file) + (member (file-name-nondirectory file) package-vc-non-code-file-names)) + (directory-files-recursively pkg-dir "\\.el\\'" nil)) + (when (yes-or-no-p (format "No Emacs Lisp files found when fetching \"%s\", \ +abort installation?" name)) + (delete-directory pkg-dir t) + (user-error "Installation aborted"))) ;; When nothing is specified about a `lisp-dir', then should ;; heuristically check if there is a sub-directory with lisp diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 1da701aebc4..cf0b734bd28 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -425,7 +425,7 @@ Called with a server buffer as its only argument. Potential uses include exponential backoff and probing for connectivity prior to dialing. Use `erc-schedule-reconnect' to instead try again later and optionally alter the attempts tally." - :package-version '(ERC . "5.4.1") ; FIXME on next release + :package-version '(ERC . "5.5") :type '(choice (function-item erc-server-delayed-reconnect) function)) @@ -1167,7 +1167,7 @@ Note that future bundled modules providing IRCv3 functionality will not be compatible with the legacy format. User code should eventually transition to expecting this \"5.5+ variant\" and set this option to nil." - :package-version '(ERC . "5.4.1") ; FIXME increment on next release + :package-version '(ERC . "5.5") :type '(choice (const nil) (const legacy) (const overridable))) @@ -1201,7 +1201,7 @@ instead, leave them as a single string." (get 'erc-parse-tags 'erc-v3-warned-p)) (put 'erc-parse-tags 'erc-v3-warned-p t) (display-warning - 'ERC + 'erc (concat "Legacy ERC tags behavior is currently in effect, but other modules," " including those bundled with ERC, may override this in future" diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 1be47c3e665..c28dddefa0e 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -176,7 +176,7 @@ PAR is a number of a regexp grouping whose text will be passed to CALLBACK. There can be several PAR arguments. If REGEXP is `nicknames', these are ignored, and CALLBACK will be called with the nickname matched as the argument." - :version "29.1" + :package-version '(ERC . "5.5") :type '(repeat (list :tag "Button" (choice :tag "Matches" diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index 499bcaf5724..52ee5c855f3 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -244,7 +244,7 @@ server and other miscellaneous functions." "Whether to `regexp-quote' when adding to a match list interactively. When the value is a boolean, the opposite behavior will be made available via universal argument." - :package-version '(ERC . "5.4.1") ; FIXME increment on next release + :package-version '(ERC . "5.5") :type '(choice (const ask) (const t) (const nil))) diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el index 97c7c54a517..ed91f412255 100644 --- a/lisp/erc/erc-sasl.el +++ b/lisp/erc/erc-sasl.el @@ -24,13 +24,13 @@ ;; ;; https://lists.gnu.org/archive/html/erc-discuss/2012-02/msg00001.html ;; -;; See options and Info manual for usage. +;; See M-x customize-group RET erc-sasl RET and (info "(erc) SASL") +;; for usage. ;; ;; TODO: ;; -;; - Find a way to obfuscate the password in memory (via something -;; like `auth-source--obfuscate'); it's currently visible in -;; backtraces. +;; - Obfuscate non-auth-source passwords in memory. They're currently +;; visible in backtraces. ;; ;; - Implement a proxy mechanism that chooses the strongest available ;; mechanism for you. Requires CAP 3.2 (see bug#49860). @@ -52,7 +52,7 @@ (defgroup erc-sasl nil "SASL for ERC." :group 'erc - :package-version '(ERC . "5.4.1")) ; FIXME increment on next release + :package-version '(ERC . "5.5")) (defcustom erc-sasl-mechanism 'plain "SASL mechanism to connect with. @@ -76,19 +76,19 @@ commands, `erc' and `erc-tls'." (defcustom erc-sasl-password :password "Optional account password to send when authenticating. -When `erc-sasl-auth-source-function' is a function, ERC will -attempt an auth-source query and prompt for input if it fails. -Otherwise, when the value is a nonempty string, ERC will use it -unconditionally for most mechanisms. Likewise with `:password', -except ERC will instead use the \"session password\" on file, if -any, which often originates from the entry-point commands `erc' -or `erc-tls'. As with auth-source, ERC will prompt for input as -a fallback. - -Note that, with `:password', ERC will forgo sending a traditional +When `erc-sasl-auth-source-function' is a function, ERC attempts +an auth-source query and prompts for input if it fails. +Otherwise, when the value of this option is a nonempty string, +ERC uses it unconditionally for most mechanisms. Likewise with a +value of `:password', except ERC instead uses the \"session +password\" on file, if any, which often originates from the +entry-point commands `erc' or `erc-tls'. As with auth-source, +ERC prompts for input as a fallback. + +Note that, with `:password', ERC forgoes sending a traditional server password via the IRC \"PASS\" command. Also, when -`erc-sasl-mechanism' is set to `ecdsa-nist256p-challenge', this -option should hold the file name of the key." +`erc-sasl-mechanism' is set to `ecdsa-nist256p-challenge', ERC +expects this option to hold the file name of the key." :type '(choice (const nil) (const :password) string symbol)) (defcustom erc-sasl-auth-source-function nil @@ -100,9 +100,8 @@ though ERC itself only specifies `:user' paired with a ERC binds all options defined in this library, such as `erc-sasl-password', to their values from entry-point invocation. In return, ERC expects a string to send as the SASL password, or -nil, in which case, ERC will prompt the for input. See info -node `(erc) auth-source' for details on ERC's auth-source -integration." +nil, in which case, ERC prompts for input. See Info node `(erc) +auth-source' for details on ERC's auth-source integration." :type '(choice (function-item erc-sasl-auth-source-password-as-host) (function-item erc-auth-source-search) (const nil) diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index 1c2fc2fcdc8..2e6959cc3f0 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el @@ -180,9 +180,9 @@ Called with a subset of keyword parameters known to `auth-source-search' and relevant to authenticating to nickname services. In return, ERC expects a string to send as the password, or nil, to fall through to the next method, such as -prompting. See info node `(erc) auth-source' for details." - :package-version '(ERC . "5.4.1") ; FIXME update when publishing to ELPA - :type '(choice (const erc-auth-source-search) +prompting. See Info node `(erc) auth-source' for details." + :package-version '(ERC . "5.5") + :type '(choice (function-item erc-auth-source-search) (const nil) function)) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index ff1820cfaf2..d35907a1677 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -217,8 +217,8 @@ parameters and authentication." This variable only exists for legacy reasons. It's not customizable and is limited to a single server password. Users looking for similar -functionality should consider auth-source instead. See info -node `(auth) Top' and info node `(erc) auth-source'.") +functionality should consider auth-source instead. See Info +node `(auth) Top' and Info node `(erc) auth-source'.") (make-obsolete-variable 'erc-password "use auth-source instead" "29.1") @@ -250,19 +250,19 @@ node `(auth) Top' and info node `(erc) auth-source'.") Issue an error when the number of input lines submitted for sending exceeds this value. The value t means disallow more than 1 line of input." - :package-version '(ERC . "5.4.1") ; FIXME match to next release + :package-version '(ERC . "5.5") :group 'erc :type '(choice integer boolean)) (defcustom erc-ask-about-multiline-input nil "Whether to ask to ignore `erc-inhibit-multiline-input' when tripped." - :package-version '(ERC . "5.4.1") ; FIXME match to next release + :package-version '(ERC . "5.5") :group 'erc :type 'boolean) (defcustom erc-prompt-hidden ">" "Text to show in lieu of the prompt when hidden." - :package-version '(ERC . "5.4.1") ; FIXME increment on next ELPA release + :package-version '(ERC . "5.5") :group 'erc-display :type 'string) @@ -272,7 +272,7 @@ To unhide, type something in the input area. Once revealed, a prompt remains unhidden until the next disconnection. Channel prompts are unhidden upon rejoining. See `erc-unhide-query-prompt' for behavior concerning query prompts." - :package-version '(ERC . "5.4.1") ; FIXME increment on next ELPA release + :package-version '(ERC . "5.5") :group 'erc-display :type '(choice (const :tag "Always hide prompt" t) (set (const server) @@ -284,7 +284,7 @@ prompts are unhidden upon rejoining. See Otherwise, prompts in a connection's query buffers remain hidden until the user types in the input area or a new message arrives from the target." - :package-version '(ERC . "5.4.1") ; FIXME increment on next ELPA release + :package-version '(ERC . "5.5") :group 'erc-display ;; Extensions may one day offer a way to discover whether a target ;; is online. When that happens, this can be expanded accordingly. @@ -1479,7 +1479,7 @@ The available choices are: `bury' - bury it in a new buffer, `buffer' - in place of the current buffer, any other value - in place of the current buffer." - :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA + :package-version '(ERC . "5.5") :group 'erc-buffers :type '(choice (const :tag "Split window and select" window) (const :tag "Split window, don't select" window-noselect) @@ -1495,7 +1495,7 @@ This only affects automatic reconnections and is ignored when issuing a /reconnect command or reinvoking `erc-tls' with the same args (assuming success, of course). See `erc-join-buffer' for a description of possible values." - :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA + :package-version '(ERC . "5.5") :group 'erc-buffers :type '(choice (const :tag "Use value of `erc-join-buffer'" nil) (const :tag "Split window and select" window) @@ -2319,7 +2319,7 @@ Example usage: 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." (interactive (let ((erc-default-port erc-default-port-tls)) @@ -3258,10 +3258,10 @@ if any. In return, ERC expects a string to send as the server password, or nil, to skip the \"PASS\" command completely. An explicit `:password' argument to entry-point commands `erc' and `erc-tls' also inhibits lookup, as does setting this option to -nil. See info node `(erc) auth-source' for details." - :package-version '(ERC . "5.4.1") ; FIXME update when publishing to ELPA +nil. See Info node `(erc) auth-source' for details." + :package-version '(ERC . "5.5") :group 'erc - :type '(choice (const erc-auth-source-search) + :type '(choice (function-item erc-auth-source-search) (const nil) function)) @@ -3272,11 +3272,11 @@ Called with a subset of keyword arguments known to channel. In return, ERC expects a string to use as the channel \"key\", or nil to just join the channel normally. Setting the option itself to nil tells ERC to always forgo consulting -auth-source for channel keys. For more information, see info +auth-source for channel keys. For more information, see Info node `(erc) auth-source'." - :package-version '(ERC . "5.4.1") ; FIXME update when publishing to ELPA + :package-version '(ERC . "5.5") :group 'erc - :type '(choice (const erc-auth-source-search) + :type '(choice (function-item erc-auth-source-search) (const nil) function)) @@ -6837,8 +6837,8 @@ shortened server name instead." ;; erc-goodies is required at end of this file. -;; FIXME when 29.1 is cut and `format-spec' is added to ELPA Compat, -;; remove the function invocations from the spec form below. +;; TODO when ERC drops Emacs 28, replace the expressions in the format +;; spec below with functions. (defun erc-update-mode-line-buffer (buffer) "Update the mode line in a single ERC buffer BUFFER." (with-current-buffer buffer @@ -7213,7 +7213,7 @@ See also `format-spec'." (defcustom erc-kill-server-hook '(erc-kill-server erc-networks-shrink-ids-and-buffer-names) "Invoked whenever a live server buffer is killed via `kill-buffer'." - :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA + :package-version '(ERC . "5.5") :group 'erc-hooks :type 'hook) @@ -7222,7 +7222,7 @@ See also `format-spec'." erc-networks-shrink-ids-and-buffer-names erc-networks-rename-surviving-target-buffer) "Invoked whenever a channel-buffer is killed via `kill-buffer'." - :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA + :package-version '(ERC . "5.5") :group 'erc-hooks :type 'hook) @@ -7232,7 +7232,7 @@ See also `format-spec'." "Hook run whenever a query buffer is killed. See also `kill-buffer'." - :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA + :package-version '(ERC . "5.5") :group 'erc-hooks :type 'hook) @@ -7311,7 +7311,7 @@ Called with a string meant to represent a URL scheme, like \"ircs\", followed by any number of keyword arguments recognized by `erc' and `erc-tls'." :group 'erc - :package-version '(ERC . "5.4.1") ; FIXME increment on release + :package-version '(ERC . "5.5") :type '(choice (const nil) function)) (defun erc--url-default-connect-function (scheme &rest plist) diff --git a/lisp/faces.el b/lisp/faces.el index 4933b495a6c..d1a7881e396 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -191,7 +191,7 @@ For internal use only." (let ((face-id (car (gethash face face--new-frame-defaults)))) (push `(,face-id ,face . ,spec) faces))) (frame--face-hash-table frame)) - (mapcar #'cdr (sort faces (lambda (f1 f2) (< (car f1) (car f2))))))) + (mapcar #'cdr (sort faces (lambda (f1 f2) (> (car f1) (car f2))))))) (defun face-list () "Return a list of all defined faces." @@ -199,7 +199,7 @@ For internal use only." (maphash (lambda (face spec) (push `(,(car spec) . ,face) faces)) face--new-frame-defaults) - (mapcar #'cdr (sort faces (lambda (f1 f2) (< (car f1) (car f2))))))) + (mapcar #'cdr (sort faces (lambda (f1 f2) (> (car f1) (car f2))))))) (defun make-face (face) "Define a new face with name FACE, a symbol. 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 @@ This function is intended to be added to `auto-coding-functions'." ;; 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/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 @@ and corresponding effects. ;;; 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 @@ 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 @@ If called from Lisp, return the name as a string; return nil if 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 @@ Example usage: 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 @@ it is disabled. ;;; 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 "{\\|<[^/>]*?" "}\\|</[^/>]*[^/]>" "<!--" mhtml-forward nil))) "\ +(defvar hs-special-modes-alist (mapcar #'purecopy '((c-mode "{" "}" "/[*/]" nil nil) (c-ts-mode "{" "}" "/[*/]" nil nil) (c++-mode "{" "}" "/[*/]" nil nil) (c++-ts-mode "{" "}" "/[*/]" nil nil) (bibtex-mode ("@\\S(*\\(\\s(\\)" 1)) (java-mode "{" "}" "/[*/]" nil nil) (java-ts-mode "{" "}" "/[*/]" nil nil) (js-mode "{" "}" "/[*/]" nil) (js-ts-mode "{" "}" "/[*/]" nil) (mhtml-mode "{\\|<[^/>]*?" "}\\|</[^/>]*[^/]>" "<!--" mhtml-forward nil))) "\ Alist for initializing the hideshow variables for different modes. Each element has the form (MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC @@ -17306,12 +17327,12 @@ Return non-nil if there is an image at point.") ;;; Generated autoloads from image/image-converter.el (autoload 'image-converter-add-handler "image-converter" "\ -Make Emacs use CONVERTER to parse image files that end with SUFFIX. -CONVERTER is a function with two parameters, where the first is -the file name or a string with the image data, and the second is -non-nil if the first parameter is image data. The converter -should output the image in the current buffer, converted to -`image-convert-to-format'. +Make Emacs use CONVERTER to parse image files whose names end with SUFFIX. +CONVERTER is a function with two arguments, the file name or a string +with the image data, and a non-nil value if the first argument is image data. +The converter should produce the image in the current buffer, converted to +the format given by `image-convert-to-format'. +SUFFIX should not include the leading dot. (fn SUFFIX CONVERTER)") (register-definition-prefixes "image-converter" '("image-convert")) @@ -17355,9 +17376,9 @@ Open directory DIR and create a default window configuration. Convenience command that: - - Opens Dired in folder DIR - - Splits windows in most useful (?) way - - Sets `truncate-lines' to t + - opens Dired in folder DIR; + - splits windows in most useful (?) way; and + - sets `truncate-lines' to t After the command has finished, you would typically mark some image files in Dired and type @@ -17415,11 +17436,12 @@ Default bookmark handler for Image-Dired buffers. ;;; Generated autoloads from image/image-dired-dired.el (autoload 'image-dired-dired-toggle-marked-thumbs "image-dired-dired" "\ -Toggle thumbnails in front of file names in the Dired buffer. -If no marked file could be found, insert or hide thumbnails on the -current line. ARG, if non-nil, specifies the files to use instead -of the marked files. If ARG is an integer, use the next ARG (or -previous -ARG, if ARG<0) files. +Toggle thumbnails in front of marked file names in the Dired buffer. +If no file is marked, toggle display of thumbnail on the current file's line. +ARG, if non-nil (interactively, the prefix argument), specifies the files +whose thumbnail display to toggle instead of the marked files: if ARG is an +integer, use the next ARG (or previous -ARG, if ARG<0) files; any other +value of ARG means toggle thumbnail display of the current line's file. (fn &optional ARG)" '(dired-mode)) (autoload 'image-dired-jump-thumbnail-buffer "image-dired-dired" "\ @@ -17471,7 +17493,8 @@ Append thumbnails to `image-dired-thumbnail-buffer'." '(dired-mode)) (autoload 'image-dired-display-thumb "image-dired-dired" "\ Shorthand for `image-dired-display-thumbs' with prefix argument." '(dired-mode)) (autoload 'image-dired-dired-display-external "image-dired-dired" "\ -Display file at point using an external viewer." '(dired-mode)) +Display file at point using an external viewer. +The viewer is specified by the value of `image-dired-external-viewer'." '(dired-mode)) (autoload 'image-dired-dired-display-image "image-dired-dired" "\ Display current image file. See documentation for `image-dired-display-image' for more information. @@ -17479,11 +17502,11 @@ See documentation for `image-dired-display-image' for more information. (fn &optional _)" '(dired-mode)) (set-advertised-calling-convention 'image-dired-dired-display-image 'nil '"29.1") (autoload 'image-dired-mark-tagged-files "image-dired-dired" "\ -Use REGEXP to mark files with matching tag. +Mark files whose tag matches REGEXP. A `tag' is a keyword, a piece of meta data, associated with an image file and stored in image-dired's database file. This command -lets you input a regexp and this will be matched against all tags -on all image files in the database file. The files that have a +prompts for a regexp, and then matches it against all the tags +of all the image files in the database file. The files that have a matching tag will be marked in the Dired buffer. (fn REGEXP)" '(dired-mode)) @@ -17498,7 +17521,8 @@ matching tag will be marked in the Dired buffer. ;;; Generated autoloads from image/image-dired-tags.el (autoload 'image-dired-tag-files "image-dired-tags" "\ -Tag marked file(s) in Dired. With prefix ARG, tag file at point. +Tag file(s) which are marked in a Dired buffer. +With prefix ARG, tag the file at point. (fn ARG)" '(dired-mode)) (autoload 'image-dired-delete-tag "image-dired-tags" "\ @@ -18311,7 +18335,9 @@ Add submenus to the File menu, to convert to and from various formats." t) (put 'ispell-check-comments 'safe-local-variable (lambda (a) (memq a '(nil t exclusive)))) (defvar ispell-personal-dictionary nil "\ File name of your personal spelling dictionary, or nil. -If nil, the default personal dictionary for your spelling checker is used.") +If nil, the default personal dictionary for your spelling checker is used. +Due to a misfeature of Hunspell, if the value is an absolute file name, the +file by that name must already exist for Hunspell to be able to use it.") (custom-autoload 'ispell-personal-dictionary "ispell" t) (put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p) (defconst ispell-menu-map (let ((map (make-sparse-keymap "Spell"))) (define-key map [ispell-change-dictionary] `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary :help ,(purecopy "Supply explicit dictionary file name"))) (define-key map [ispell-kill-ispell] `(menu-item ,(purecopy "Kill Process") (lambda nil (interactive) (ispell-kill-ispell nil 'clear)) :enable (and (boundp 'ispell-process) ispell-process (eq (ispell-process-status) 'run)) :help ,(purecopy "Terminate Ispell subprocess"))) (define-key map [ispell-pdict-save] `(menu-item ,(purecopy "Save Dictionary") (lambda nil (interactive) (ispell-pdict-save t t)) :help ,(purecopy "Save personal dictionary"))) (define-key map [ispell-customize] `(menu-item ,(purecopy "Customize...") (lambda nil (interactive) (customize-group 'ispell)) :help ,(purecopy "Customize spell checking options"))) (define-key map [ispell-help] `(menu-item ,(purecopy "Help") (lambda nil (interactive) (describe-function 'ispell-help)) :help ,(purecopy "Show standard Ispell keybindings and commands"))) (define-key map [flyspell-mode] `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") flyspell-mode :help ,(purecopy "Check spelling while you edit the text") :button (:toggle bound-and-true-p flyspell-mode))) (define-key map [ispell-complete-word] `(menu-item ,(purecopy "Complete Word") ispell-complete-word :help ,(purecopy "Complete word at cursor using dictionary"))) (define-key map [ispell-complete-word-interior-frag] `(menu-item ,(purecopy "Complete Word Fragment") ispell-complete-word-interior-frag :help ,(purecopy "Complete word fragment at cursor"))) (define-key map [ispell-continue] `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue :enable (and (boundp 'ispell-region-end) (marker-position ispell-region-end) (equal (marker-buffer ispell-region-end) (current-buffer))) :help ,(purecopy "Continue spell checking last region"))) (define-key map [ispell-word] `(menu-item ,(purecopy "Spell-Check Word") ispell-word :help ,(purecopy "Spell-check word at cursor"))) (define-key map [ispell-comments-and-strings] `(menu-item ,(purecopy "Spell-Check Comments") ispell-comments-and-strings :help ,(purecopy "Spell-check only comments and strings"))) (define-key map [ispell-region] `(menu-item ,(purecopy "Spell-Check Region") ispell-region :enable mark-active :help ,(purecopy "Spell-check text in marked region"))) (define-key map [ispell-message] `(menu-item ,(purecopy "Spell-Check Message") ispell-message :visible (eq major-mode 'mail-mode) :help ,(purecopy "Skip headers and included message text"))) (define-key map [ispell-buffer] `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer :help ,(purecopy "Check spelling of selected buffer"))) map) "\ @@ -26541,8 +26567,12 @@ or call the function `repeat-mode'.") (autoload 'repeat-mode "repeat" "\ Toggle Repeat mode. -When Repeat mode is enabled, and the command symbol has the property named -`repeat-map', this map is activated temporarily for the next command. +When Repeat mode is enabled, certain commands bound to multi-key +sequences can be repeated by typing a single key, after typing the +full key sequence once. +The commands which can be repeated like that are those whose symbol + has the property `repeat-map' which specifies a keymap of single +keys for repeating. See `describe-repeat-maps' for a list of all repeatable commands. This is a global minor mode. If called interactively, toggle the diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index af7aa1c3a0e..a60c464093e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -219,6 +219,7 @@ delimiters < and >'s." MODE is either `c' or `cpp'." (let ((common `(((parent-is "translation_unit") point-min 0) + ((query "(ERROR (ERROR)) @indent") point-min 0) ((node-is ")") parent 1) ((node-is "]") parent-bol 0) ((node-is "else") parent-bol 0) @@ -267,15 +268,15 @@ MODE is either `c' or `cpp'." ((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) @@ -738,7 +739,8 @@ the semicolon. This function skips the semicolon." :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" @@ -772,8 +774,7 @@ the semicolon. This function skips the semicolon." `((block . ,(rx (or "compound_statement" "field_declaration_list" "enumerator_list" - "initializer_list" - "field_declaration_list"))) + "initializer_list"))) (if . "if_statement") (else . ("if_statement" . "alternative")) (do . "do_statement") @@ -785,7 +786,7 @@ the semicolon. This function skips the semicolon." ;; Electric (setq-local electric-indent-chars - (append "{}():;," electric-indent-chars)) + (append "{}():;,#" electric-indent-chars)) ;; Imenu. (setq-local treesit-simple-imenu-settings diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 852e893dc25..b6b842d7fd4 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -862,7 +862,30 @@ compilation and evaluation time conflicts." :language 'c-sharp :feature 'escape-sequence :override t - '((escape_sequence) @font-lock-escape-face))) + '((escape_sequence) @font-lock-escape-face) + + :language 'c-sharp + :feature 'directives + :override t + '((if_directive + "if" @font-lock-preprocessor-face + (identifier) @font-lock-variable-name-face) + (elif_directive + "elif" @font-lock-preprocessor-face + (identifier) @font-lock-variable-name-face) + (else_directive) @font-lock-preprocessor-face + (endif_directive) @font-lock-preprocessor-face + (define_directive + "define" @font-lock-preprocessor-face + (identifier) @font-lock-variable-name-face) + (nullable_directive) @font-lock-preprocessor-face + (pragma_directive) @font-lock-preprocessor-face + (region_directive) @font-lock-preprocessor-face + (endregion_directive) @font-lock-preprocessor-face + (region_directive + (preproc_message) @font-lock-variable-name-face) + (endregion_directive + (preproc_message) @font-lock-variable-name-face)))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)) @@ -925,7 +948,7 @@ Key bindings: (setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list '(( comment definition) - ( keyword string type) + ( keyword string type directives) ( constant escape-sequence expression literal property) ( function bracket delimiter error))) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 58d519548e0..82401b685ce 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2496,13 +2496,14 @@ When called interactively, use the currently active server" (defun eglot--signal-textDocument/didSave () "Send textDocument/didSave to server." (eglot--signal-textDocument/didChange) - (jsonrpc-notify - (eglot--current-server-or-lose) - :textDocument/didSave - (list - ;; TODO: Handle TextDocumentSaveRegistrationOptions to control this. - :text (buffer-substring-no-properties (point-min) (point-max)) - :textDocument (eglot--TextDocumentIdentifier)))) + (when (eglot--server-capable :textDocumentSync :save) + (jsonrpc-notify + (eglot--current-server-or-lose) + :textDocument/didSave + (list + ;; TODO: Handle TextDocumentSaveRegistrationOptions to control this. + :text (buffer-substring-no-properties (point-min) (point-max)) + :textDocument (eglot--TextDocumentIdentifier))))) (defun eglot-flymake-backend (report-fn &rest _more) "A Flymake backend for Eglot. 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 @@ :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 diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 05d69c314bb..1f08f09935b 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3442,6 +3442,7 @@ This function is intended for use in `after-change-functions'." ((parent-is "arguments") parent-bol js-indent-level) ((parent-is "array") parent-bol js-indent-level) ((parent-is "formal_parameters") parent-bol js-indent-level) + ((parent-is "template_string") no-indent) ; Don't indent the string contents. ((parent-is "template_substitution") parent-bol js-indent-level) ((parent-is "object_pattern") parent-bol js-indent-level) ((parent-is "object") parent-bol js-indent-level) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 5c71a8ad461..ec823d09d8c 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -124,8 +124,8 @@ (treesit-font-lock-rules :language 'rust :feature 'attribute - '((attribute_item) @font-lock-constant-face - (inner_attribute_item) @font-lock-constant-face) + '((attribute_item) @font-lock-preprocessor-face + (inner_attribute_item) @font-lock-preprocessor-face) :language 'rust :feature 'bracket @@ -148,12 +148,6 @@ '(([(block_comment) (line_comment)]) @font-lock-comment-face) :language 'rust - :feature 'constant - `((boolean_literal) @font-lock-constant-face - ((identifier) @font-lock-constant-face - (:match "^[A-Z][A-Z\\d_]*$" @font-lock-constant-face))) - - :language 'rust :feature 'delimiter '((["," "." ";" ":" "::"]) @font-lock-delimiter-face) @@ -163,11 +157,16 @@ (macro_definition "macro_rules!" @font-lock-constant-face) (macro_definition (identifier) @font-lock-preprocessor-face) (field_declaration name: (field_identifier) @font-lock-property-face) - (parameter) @rust-ts-mode--fontify-pattern - (let_declaration) @rust-ts-mode--fontify-pattern - (for_expression) @rust-ts-mode--fontify-pattern - (let_condition) @rust-ts-mode--fontify-pattern - (match_arm) @rust-ts-mode--fontify-pattern) + (parameter pattern: (_) @rust-ts-mode--fontify-pattern) + (let_declaration pattern: (_) @rust-ts-mode--fontify-pattern) + (for_expression pattern: (_) @rust-ts-mode--fontify-pattern) + (let_condition pattern: (_) @rust-ts-mode--fontify-pattern) + (match_arm pattern: (_) @rust-ts-mode--fontify-pattern)) + + :language 'rust + :feature 'assignment + '((assignment_expression left: (_) @rust-ts-mode--fontify-pattern) + (compound_assignment_expr left: (_) @rust-ts-mode--fontify-pattern)) :language 'rust :feature 'function @@ -206,7 +205,54 @@ :language 'rust :feature 'type - `((enum_variant name: (identifier) @font-lock-type-face) + `((scoped_use_list path: (identifier) @font-lock-constant-face) + (scoped_use_list path: (scoped_identifier + name: (identifier) @font-lock-constant-face)) + + ((use_as_clause alias: (identifier) @font-lock-type-face) + (:match "^[A-Z]" @font-lock-type-face)) + ((use_as_clause path: (identifier) @font-lock-type-face) + (:match "^[A-Z]" @font-lock-type-face)) + ((use_as_clause path: + (scoped_identifier path: (_) + name: (identifier) @font-lock-type-face)) + (:match "^[A-Z]" @font-lock-type-face)) + (use_as_clause path: (scoped_identifier name: (identifier) @default)) + + ((use_declaration + argument: (scoped_identifier + path: (_) @font-lock-constant-face + name: (identifier) @font-lock-type-face)) + (:match "^[A-Z]" @font-lock-type-face)) + (use_declaration + argument: (scoped_identifier + name: (identifier) @default)) + + (use_declaration + argument: (scoped_identifier + path: (scoped_identifier + path: (_) @font-lock-constant-face + name: (identifier) @font-lock-constant-face) + name: (identifier) @default)) + + (use_declaration + argument: (scoped_use_list + path: (scoped_identifier + path: (_) @font-lock-constant-face + name: (identifier) @font-lock-constant-face))) + + ((use_list (identifier) @font-lock-type-face) + (:match "^[A-Z]" @font-lock-type-face)) + (use_list (identifier) @default) + ((use_list (scoped_identifier path: (_) + name: (identifier) @font-lock-type-face)) + (:match "^[A-Z]" @font-lock-type-face)) + (use_list (scoped_identifier path: (_) + name: (identifier) @default)) + (use_wildcard (scoped_identifier + name: (identifier) @font-lock-constant-face)) + + (enum_variant name: (identifier) @font-lock-type-face) (match_arm pattern: (match_pattern (_ type: (identifier) @font-lock-type-face))) (match_arm @@ -221,24 +267,39 @@ ((scoped_identifier path: (identifier) @font-lock-type-face) (:match "^[A-Z]" @font-lock-type-face)) ((scoped_identifier - (scoped_identifier - path: (identifier) @font-lock-type-face)) - (:match "^[A-Z]" @font-lock-type-face)) - ((scoped_identifier path: [(identifier) @font-lock-type-face (scoped_identifier name: (identifier) @font-lock-type-face)]) (:match "^[A-Z]" @font-lock-type-face)) - (scoped_type_identifier path: (identifier) @font-lock-type-face) + ((scoped_identifier path: (identifier) @font-lock-type-face) + (:match + "^\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)$" + @font-lock-type-face)) + (scoped_identifier path: (_) @font-lock-constant-face + name: (identifier) @font-lock-type-face) + (scoped_identifier path: (scoped_identifier + name: (identifier) @font-lock-constant-face)) + (scoped_type_identifier path: (_) @font-lock-constant-face) + (scoped_type_identifier + path: (scoped_identifier + path: (_) @font-lock-constant-face + name: (identifier) @font-lock-constant-face)) (type_identifier) @font-lock-type-face - (use_as_clause alias: (identifier) @font-lock-type-face) - (use_list (identifier) @font-lock-type-face)) + ;; Ensure function calls aren't highlighted as types. + (call_expression function: (scoped_identifier name: (identifier) @default))) :language 'rust :feature 'property '((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 constants. + :language 'rust + :feature 'constant + `((boolean_literal) @font-lock-constant-face + ((identifier) @font-lock-constant-face + (:match "^[A-Z][A-Z\\d_]*$" @font-lock-constant-face))) + :language 'rust :feature 'variable '((identifier) @font-lock-variable-name-face @@ -261,7 +322,7 @@ (treesit-available-p) `(lambda (node override start end &rest _) (let ((captures (treesit-query-capture - (treesit-node-child-by-field-name node "pattern") + node ,(treesit-query-compile 'rust '((identifier) @id (shorthand_field_identifier) @id))))) (pcase-dolist (`(_name . ,id) captures) @@ -342,7 +403,7 @@ delimiters < and >'s." (setq-local treesit-font-lock-feature-list '(( comment definition) ( keyword string) - ( attribute builtin constant escape-sequence + ( assignment attribute builtin constant escape-sequence number type) ( bracket delimiter error function operator property variable))) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 561b90deedd..88a1ff3e202 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -86,6 +86,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." ((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset) ((parent-is "array") parent-bol typescript-ts-mode-indent-offset) ((parent-is "formal_parameters") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "template_string") no-indent) ; Don't indent the string contents. ((parent-is "template_substitution") parent-bol typescript-ts-mode-indent-offset) ((parent-is "object_pattern") parent-bol typescript-ts-mode-indent-offset) ((parent-is "object") parent-bol typescript-ts-mode-indent-offset) diff --git a/lisp/repeat.el b/lisp/repeat.el index 37d4aaec985..2fcac4d2ce3 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -359,8 +359,8 @@ This property can override the value of this variable." :group 'repeat :version "28.1") -(defvar repeat-exit-function nil - "Function that exits the repeating sequence.") +(defvar repeat--transient-exitfun nil + "Function returned by `set-transient-map'.") (defvar repeat-exit-timer nil "Timer activated after the last key typed in the repeating key sequence.") @@ -517,9 +517,9 @@ See `describe-repeat-maps' for a list of all repeatable commands." 'ignore)) (setq repeat-in-progress t) - (repeat--exit) + (repeat--clear-prev) (let ((exitfun (set-transient-map map))) - (setq repeat-exit-function exitfun) + (setq repeat--transient-exitfun exitfun) (let* ((prop (repeat--command-property 'repeat-exit-timeout)) (timeout (unless (eq prop 'no) (or prop repeat-exit-timeout)))) @@ -538,17 +538,17 @@ See `describe-repeat-maps' for a list of all repeatable commands." This function can be used to force exit of repetition while it's active." (interactive) (setq repeat-in-progress nil) - (repeat--exit) + (repeat--clear-prev) (funcall repeat-echo-function nil)) -(defun repeat--exit () +(defun repeat--clear-prev () "Internal function to clean up previously set exit function and timer." (when repeat-exit-timer (cancel-timer repeat-exit-timer) (setq repeat-exit-timer nil)) - (when repeat-exit-function - (funcall repeat-exit-function) - (setq repeat-exit-function nil))) + (when repeat--transient-exitfun + (funcall repeat--transient-exitfun) + (setq repeat--transient-exitfun nil))) (defun repeat-echo-message-string (keymap) "Return a string with the list of repeating keys in KEYMAP." diff --git a/lisp/subr.el b/lisp/subr.el index db33483f509..a0a22072a18 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3946,30 +3946,51 @@ See also `locate-user-emacs-file'.") "Return non-nil if the current buffer is narrowed." (/= (- (point-max) (point-min)) (buffer-size))) -(defmacro with-narrowing (start end &rest rest) +(defmacro with-restriction (start end &rest rest) "Execute BODY with restrictions set to START and END. The current restrictions, if any, are restored upon return. -With the optional :locked TAG argument, inside BODY, -`narrow-to-region' and `widen' can be used only within the START -and END limits, unless the restrictions are unlocked by calling -`narrowing-unlock' with TAG. See `narrowing-lock' for a more -detailed description. +When the optional :label LABEL argument is present, in which +LABEL is a symbol, inside BODY, `narrow-to-region' and `widen' +can be used only within the START and END limits. To gain access +to other portions of the buffer, use `without-restriction' with the +same LABEL argument. -\(fn START END [:locked TAG] BODY)" - (if (eq (car rest) :locked) - `(internal--with-narrowing ,start ,end (lambda () ,@(cddr rest)) +\(fn START END [:label LABEL] BODY)" + (if (eq (car rest) :label) + `(internal--with-restriction ,start ,end (lambda () ,@(cddr rest)) ,(cadr rest)) - `(internal--with-narrowing ,start ,end (lambda () ,@rest)))) + `(internal--with-restriction ,start ,end (lambda () ,@rest)))) -(defun internal--with-narrowing (start end body &optional tag) - "Helper function for `with-narrowing', which see." +(defun internal--with-restriction (start end body &optional label) + "Helper function for `with-restriction', which see." (save-restriction - (progn - (narrow-to-region start end) - (if tag (narrowing-lock tag)) - (funcall body)))) + (narrow-to-region start end) + (if label (internal--lock-narrowing label)) + (funcall body))) + +(defmacro without-restriction (&rest rest) + "Execute BODY without restrictions. + +The current restrictions, if any, are restored upon return. + +When the optional :label LABEL argument is present, the +restrictions set by `with-restriction' with the same LABEL argument +are lifted. + +\(fn [:label LABEL] BODY)" + (if (eq (car rest) :label) + `(internal--without-restriction (lambda () ,@(cddr rest)) + ,(cadr rest)) + `(internal--without-restriction (lambda () ,@rest)))) + +(defun internal--without-restriction (body &optional label) + "Helper function for `without-restriction', which see." + (save-restriction + (if label (internal--unlock-narrowing label)) + (widen) + (funcall body))) (defun find-tag-default-bounds () "Determine the boundaries of the default tag, based on text at point. diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index b844955e1be..c5e7b8f4bc6 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -53,13 +53,28 @@ :parent emacs-news-common-map "C-c C-s" #'emacs-news-next-untagged-entry "C-c C-r" #'emacs-news-previous-untagged-entry - "C-c C-t" #'emacs-news-toggle-tag + "C-c C-t" #'emacs-news-cycle-tag + "C-c C-d" #'emacs-news-delete-temporary-markers "C-c C-g" #'emacs-news-goto-section "C-c C-j" #'emacs-news-find-heading "C-c C-e" #'emacs-news-count-untagged-entries "C-x C-q" #'emacs-news-view-mode "<remap> <open-line>" #'emacs-news-open-line) +(easy-menu-define emacs-news-mode-menu emacs-news-mode-map + "Menu for `emacs-news-mode'." + '("News" + ["Next Untagged" emacs-news-next-untagged-entry :help "Go to next untagged entry"] + ["Previous Untagged" emacs-news-previous-untagged-entry :help "Go to previous untagged entry"] + ["Count Untagged" emacs-news-count-untagged-entries :help "Count the number of untagged entries"] + ["Cycle Tag" emacs-news-cycle-tag :help "Cycle documentation tag of current entry"] + ["Delete Tags" emacs-news-delete-temporary-markers :help "Delete all documentation tags in buffer"] + "--" + ["Goto Section" emacs-news-goto-section :help "Prompt for section and go to it"] + ["Goto Heading" emacs-news-find-heading :help "Prompt for heading and go to it"] + "--" + ["Enter View Mode" emacs-news-view-mode :help "Enter view-only mode"])) + (defvar emacs-news-view-mode-map ;; This is defined this way instead of inheriting because we're ;; deriving the mode from `special-mode' and want the keys from there. @@ -173,8 +188,8 @@ untagged NEWS entry." (interactive nil emacs-news-mode) (emacs-news-next-untagged-entry t)) -(defun emacs-news-toggle-tag () - "Toggle documentation tag of current headline in the Emacs NEWS file." +(defun emacs-news-cycle-tag () + "Cycle documentation tag of current headline in the Emacs NEWS file." (interactive nil emacs-news-mode) (save-excursion (goto-char (line-beginning-position)) @@ -191,7 +206,7 @@ untagged NEWS entry." (insert "+++")) ((looking-at (rx bol "+++" eol)) (delete-char 4)) - (t (user-error "Invalid headline tag; can't toggle"))))) + (t (user-error "Invalid headline tag; can't cycle"))))) (defun emacs-news-count-untagged-entries () "Say how many untagged entries there are in the current NEWS buffer." diff --git a/lisp/transient.el b/lisp/transient.el index 73ea6fa940e..c0ecd2950d7 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -965,7 +965,7 @@ keyword. Only use this alias to define an infix command that actually sets an infix argument. To define a infix command that, for -example, sets a variable use `transient-define-infix' instead. +example, sets a variable, use `transient-define-infix' instead. \(fn NAME ARGLIST [DOCSTRING] [KEYWORD VALUE]...)") @@ -1509,18 +1509,8 @@ then just return it. Otherwise return the symbol whose ;;; Keymaps -(defvar transient-base-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "ESC ESC ESC") #'transient-quit-all) - (define-key map (kbd "C-g") #'transient-quit-one) - (define-key map (kbd "C-q") #'transient-quit-all) - (define-key map (kbd "C-z") #'transient-suspend) - (define-key map (kbd "C-v") #'transient-scroll-up) - (define-key map (kbd "C-M-v") #'transient-scroll-down) - (define-key map [next] #'transient-scroll-up) - (define-key map [prior] #'transient-scroll-down) - map) - "Parent of other keymaps used by Transient. +(defvar-keymap transient-base-map + :doc "Parent of other keymaps used by Transient. This is the parent keymap of all the keymaps that are used in all transients: `transient-map' (which in turn is the parent @@ -1533,40 +1523,42 @@ the latter isn't a proper transient prefix command, it can be edited using the same functions as used for transients. If you add a new command here, then you must also add a binding -to `transient-predicate-map'.") - -(defvar transient-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map transient-base-map) - (define-key map (kbd "C-u") #'universal-argument) - (define-key map (kbd "C--") #'negative-argument) - (define-key map (kbd "C-t") #'transient-show) - (define-key map (kbd "?") #'transient-help) - (define-key map (kbd "C-h") #'transient-help) - ;; Also bound to "C-x p" and "C-x n" in transient-common-commands. - (define-key map (kbd "C-M-p") #'transient-history-prev) - (define-key map (kbd "C-M-n") #'transient-history-next) - map) - "Top-level keymap used by all transients. +to `transient-predicate-map'." + "ESC ESC ESC" #'transient-quit-all + "C-g" #'transient-quit-one + "C-q" #'transient-quit-all + "C-z" #'transient-suspend + "C-v" #'transient-scroll-up + "C-M-v" #'transient-scroll-down + "<next>" #'transient-scroll-up + "<prior>" #'transient-scroll-down) + +(defvar-keymap transient-map + :doc "Top-level keymap used by all transients. If you add a new command here, then you must also add a binding -to `transient-predicate-map'. Also see `transient-base-map'.") - -(defvar transient-edit-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map transient-base-map) - (define-key map (kbd "?") #'transient-help) - (define-key map (kbd "C-h") #'transient-help) - (define-key map (kbd "C-x l") #'transient-set-level) - map) - "Keymap that is active while a transient in is in \"edit mode\".") - -(defvar transient-sticky-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map transient-base-map) - (define-key map (kbd "C-g") #'transient-quit-seq) - map) - "Keymap that is active while an incomplete key sequence is active.") +to `transient-predicate-map'. Also see `transient-base-map'." + :parent transient-base-map + "C-u" #'universal-argument + "C--" #'negative-argument + "C-t" #'transient-show + "?" #'transient-help + "C-h" #'transient-help + ;; Also bound to "C-x p" and "C-x n" in transient-common-commands. + "C-M-p" #'transient-history-prev + "C-M-n" #'transient-history-next) + +(defvar-keymap transient-edit-map + :doc "Keymap that is active while a transient in is in \"edit mode\"." + :parent transient-base-map + "?" #'transient-help + "C-h" #'transient-help + "C-x l" #'transient-set-level) + +(defvar-keymap transient-sticky-map + :doc "Keymap that is active while an incomplete key sequence is active." + :parent transient-base-map + "C-g" #'transient-quit-seq) (defvar transient--common-command-prefixes '(?\C-x)) @@ -1606,70 +1598,28 @@ to `transient-predicate-map'. Also see `transient-base-map'.") "Show common permanently"))) (list "C-x l" "Show/hide suffixes" #'transient-set-level)))))))) -(defvar transient-popup-navigation-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "<down-mouse-1>") #'transient-noop) - (define-key map (kbd "<up>") #'transient-backward-button) - (define-key map (kbd "<down>") #'transient-forward-button) - (define-key map (kbd "C-r") #'transient-isearch-backward) - (define-key map (kbd "C-s") #'transient-isearch-forward) - (define-key map (kbd "M-RET") #'transient-push-button) - map) - "One of the keymaps used when popup navigation is enabled. -See `transient-enable-popup-navigation'.") - -(defvar transient-button-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "<mouse-1>") #'transient-push-button) - (define-key map (kbd "<mouse-2>") #'transient-push-button) - map) - "One of the keymaps used when popup navigation is enabled. -See `transient-enable-popup-navigation'.") - -(defvar transient-predicate-map - (let ((map (make-sparse-keymap))) - (define-key map [transient-suspend] #'transient--do-suspend) - (define-key map [transient-help] #'transient--do-stay) - (define-key map [transient-set-level] #'transient--do-stay) - (define-key map [transient-history-prev] #'transient--do-stay) - (define-key map [transient-history-next] #'transient--do-stay) - (define-key map [universal-argument] #'transient--do-stay) - (define-key map [negative-argument] #'transient--do-minus) - (define-key map [digit-argument] #'transient--do-stay) - (define-key map [top-level] #'transient--do-quit-all) - (define-key map [transient-quit-all] #'transient--do-quit-all) - (define-key map [transient-quit-one] #'transient--do-quit-one) - (define-key map [transient-quit-seq] #'transient--do-stay) - (define-key map [transient-show] #'transient--do-stay) - (define-key map [transient-update] #'transient--do-stay) - (define-key map [transient-toggle-common] #'transient--do-stay) - (define-key map [transient-set] #'transient--do-call) - (define-key map [transient-save] #'transient--do-call) - (define-key map [transient-reset] #'transient--do-call) - (define-key map [describe-key-briefly] #'transient--do-stay) - (define-key map [describe-key] #'transient--do-stay) - (define-key map [transient-scroll-up] #'transient--do-stay) - (define-key map [transient-scroll-down] #'transient--do-stay) - (define-key map [mwheel-scroll] #'transient--do-stay) - (define-key map [scroll-bar-toolkit-scroll] #'transient--do-stay) - (define-key map [transient-noop] #'transient--do-noop) - (define-key map [transient-mouse-push-button] #'transient--do-move) - (define-key map [transient-push-button] #'transient--do-push-button) - (define-key map [transient-backward-button] #'transient--do-move) - (define-key map [transient-forward-button] #'transient--do-move) - (define-key map [transient-isearch-backward] #'transient--do-move) - (define-key map [transient-isearch-forward] #'transient--do-move) - ;; If a valid but incomplete prefix sequence is followed by - ;; an unbound key, then Emacs calls the `undefined' command - ;; but does not set `this-command', `this-original-command' - ;; or `real-this-command' accordingly. Instead they are nil. - (define-key map [nil] #'transient--do-warn) - map) - "Base keymap used to map common commands to their transient behavior. +(defvar-keymap transient-popup-navigation-map + :doc "One of the keymaps used when popup navigation is enabled. +See `transient-enable-popup-navigation'." + "<down-mouse-1>" #'transient-noop + "<up>" #'transient-backward-button + "<down>" #'transient-forward-button + "C-r" #'transient-isearch-backward + "C-s" #'transient-isearch-forward + "M-RET" #'transient-push-button) + +(defvar-keymap transient-button-map + :doc "One of the keymaps used when popup navigation is enabled. +See `transient-enable-popup-navigation'." + "<mouse-1>" #'transient-push-button + "<mouse-2>" #'transient-push-button) + +(defvar-keymap transient-predicate-map + :doc "Base keymap used to map common commands to their transient behavior. The \"transient behavior\" of a command controls, among other things, whether invoking the command causes the transient to be -exited or not and whether infix arguments are exported before +exited or not, and whether infix arguments are exported before doing so. Each \"key\" is a command that is common to all transients and @@ -1681,7 +1631,43 @@ transient behavior of the respective command. For transient commands that are bound in individual transients, the transient behavior is specified using the `:transient' slot -of the corresponding object.") +of the corresponding object." + "<transient-suspend>" #'transient--do-suspend + "<transient-help>" #'transient--do-stay + "<transient-set-level>" #'transient--do-stay + "<transient-history-prev>" #'transient--do-stay + "<transient-history-next>" #'transient--do-stay + "<universal-argument>" #'transient--do-stay + "<negative-argument>" #'transient--do-minus + "<digit-argument>" #'transient--do-stay + "<top-level>" #'transient--do-quit-all + "<transient-quit-all>" #'transient--do-quit-all + "<transient-quit-one>" #'transient--do-quit-one + "<transient-quit-seq>" #'transient--do-stay + "<transient-show>" #'transient--do-stay + "<transient-update>" #'transient--do-stay + "<transient-toggle-common>" #'transient--do-stay + "<transient-set>" #'transient--do-call + "<transient-save>" #'transient--do-call + "<transient-reset>" #'transient--do-call + "<describe-key-briefly>" #'transient--do-stay + "<describe-key>" #'transient--do-stay + "<transient-scroll-up>" #'transient--do-stay + "<transient-scroll-down>" #'transient--do-stay + "<mwheel-scroll>" #'transient--do-stay + "<scroll-bar-toolkit-scroll>" #'transient--do-stay + "<transient-noop>" #'transient--do-noop + "<transient-mouse-push-button>" #'transient--do-move + "<transient-push-button>" #'transient--do-push-button + "<transient-backward-button>" #'transient--do-move + "<transient-forward-button>" #'transient--do-move + "<transient-isearch-backward>" #'transient--do-move + "<transient-isearch-forward>" #'transient--do-move + ;; If a valid but incomplete prefix sequence is followed by + ;; an unbound key, then Emacs calls the `undefined' command + ;; but does not set `this-command', `this-original-command' + ;; or `real-this-command' accordingly. Instead they are nil. + "<nil>" #'transient--do-warn) (defvar transient--transient-map nil) (defvar transient--predicate-map nil) @@ -1725,9 +1711,9 @@ of the corresponding object.") (string-trim key) cmd conflict))) (define-key map kbd cmd)))) - (when-let ((b (lookup-key map "-"))) (define-key map [kp-subtract] b)) - (when-let ((b (lookup-key map "="))) (define-key map [kp-equal] b)) - (when-let ((b (lookup-key map "+"))) (define-key map [kp-add] b)) + (when-let ((b (keymap-lookup map "-"))) (keymap-set map "<kp-subtract>" b)) + (when-let ((b (keymap-lookup map "="))) (keymap-set map "<kp-equal>" b)) + (when-let ((b (keymap-lookup map "+"))) (keymap-set map "<kp-add>" b)) (when transient-enable-popup-navigation ;; `transient--make-redisplay-map' maps only over bindings that are ;; directly in the base keymap, so that cannot be a composed keymap. @@ -1742,7 +1728,7 @@ of the corresponding object.") (set-keymap-parent map transient-predicate-map) (when (memq (oref transient--prefix transient-non-suffix) '(nil transient--do-warn transient--do-noop)) - (define-key map [handle-switch-frame] #'transient--do-suspend)) + (keymap-set map "<handle-switch-frame>" #'transient--do-suspend)) (dolist (obj transient--suffixes) (let* ((cmd (oref obj command)) (sub-prefix (and (symbolp cmd) (get cmd 'transient--prefix) t)) @@ -1810,8 +1796,8 @@ of the corresponding object.") This function is called by transient prefix commands to setup the transient. In that case NAME is mandatory, LAYOUT and EDIT must -be nil and PARAMS may be (but usually is not) used to set e.g. the -\"scope\" of the transient (see `transient-define-prefix'). +be nil and PARAMS may be (but usually is not) used to set, e.g., +the \"scope\" of the transient (see `transient-define-prefix'). This function is also called internally in which case LAYOUT and EDIT may be non-nil." @@ -2587,10 +2573,10 @@ transient is active." (defvar transient-resume-mode) -(defun transient-help () - "Show help for the active transient or one of its suffixes." - (interactive) - (if (called-interactively-p 'any) +(defun transient-help (&optional interactive) + "Show help for the active transient or one of its suffixes.\n\n(fn)" + (interactive (list t)) + (if interactive (setq transient--helpp t) (with-demoted-errors "transient-help: %S" (when (lookup-key transient--transient-map @@ -3831,17 +3817,15 @@ Suffixes on levels %s and %s are unavailable.\n" (propertize (format ">=%s" (1+ level)) 'face 'transient-disabled-suffix)))))) -(defvar transient-resume-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [remap Man-quit] #'transient-resume) - (define-key map [remap Info-exit] #'transient-resume) - (define-key map [remap quit-window] #'transient-resume) - map) - "Keymap for `transient-resume-mode'. +(defvar-keymap transient-resume-mode-map + :doc "Keymap for `transient-resume-mode'. This keymap remaps every command that would usually just quit the documentation buffer to `transient-resume', which additionally -resumes the suspended transient.") +resumes the suspended transient." + "<remap> <Man-quit>" #'transient-resume + "<remap> <Info-exit>" #'transient-resume + "<remap> <quit-window>" #'transient-resume) (define-minor-mode transient-resume-mode "Auxiliary minor-mode used to resume a transient after viewing help.") @@ -3901,13 +3885,11 @@ See `forward-button' for information about N." ;;; Compatibility ;;;; Popup Isearch -(defvar transient--isearch-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map isearch-mode-map) - (define-key map [remap isearch-exit] #'transient-isearch-exit) - (define-key map [remap isearch-cancel] #'transient-isearch-cancel) - (define-key map [remap isearch-abort] #'transient-isearch-abort) - map)) +(defvar-keymap transient--isearch-mode-map + :parent isearch-mode-map + "<remap> <isearch-exit>" #'transient-isearch-exit + "<remap> <isearch-cancel>" #'transient-isearch-cancel + "<remap> <isearch-abort>" #'transient-isearch-abort) (defun transient-isearch-backward (&optional regexp-p) "Do incremental search backward. @@ -4034,8 +4016,8 @@ that does that. Of course \"Q\" may already be bound to something else, so that function binds \"M-q\" to that command instead. Of course \"M-q\" may already be bound to something else, but we stop there." - (define-key transient-base-map "q" #'transient-quit-one) - (define-key transient-sticky-map "q" #'transient-quit-seq) + (keymap-set transient-base-map "q" #'transient-quit-one) + (keymap-set transient-sticky-map "q" #'transient-quit-seq) (setq transient-substitute-key-function #'transient-rebind-quit-commands)) |