From f47a29da5c4dd490a6de78da84f0fc272bb82993 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 3 Jan 2025 03:36:38 +0100 Subject: [PATCH 1/8] * lisp/man.el (Man-mode): Improve docstring. --- lisp/man.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index be088043a27..75f87feb8e8 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1652,9 +1652,8 @@ commands from `Man-mode'. Used by `woman'. (define-derived-mode Man-mode man-common "Man" "A mode for browsing Un*x manual pages. -The following man commands are available in the buffer. Try -\"\\[describe-key] RET\" for more information: - +The following man commands are available in the buffer: +\\ \\[man] Prompt to retrieve a new manpage. \\[Man-follow-manual-reference] Retrieve reference in SEE ALSO section. \\[Man-next-manpage] Jump to next manpage in circular list. @@ -1662,13 +1661,12 @@ The following man commands are available in the buffer. Try \\[Man-next-section] Jump to next manpage section. \\[Man-previous-section] Jump to previous manpage section. \\[Man-goto-section] Go to a manpage section. -\\[Man-goto-see-also-section] Jumps to the SEE ALSO manpage section. -\\[quit-window] Deletes the manpage window, bury its buffer. -\\[Man-kill] Deletes the manpage window, kill its buffer. -\\[describe-mode] Prints this help text. +\\[Man-goto-see-also-section] Jump to the SEE ALSO manpage section. +\\[quit-window] Delete the manpage window, bury its buffer. +\\[Man-kill] Delete the manpage window, kill its buffer. +\\[describe-mode] Print this help text. -The following variables may be of some use. Try -\"\\[describe-variable] RET\" for more information: +The following variables may be of some use: `Man-notify-method' What happens when manpage is ready to display. `Man-downcase-section-letters-flag' Force section letters to lower case. From 0cacf8063910ac2409641109ec7b3af24437fd2c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 3 Jan 2025 10:27:46 +0200 Subject: [PATCH 2/8] ; * etc/NEWS: Document change of 'make-cursor-line-fully-visible'. Bug#65214, bug#74430. --- etc/NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 408b2bc9f7c..6b2831e3809 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -196,6 +196,13 @@ removed, as it was considered more dangerous than useful. RFC 9110 To send an email address in the header of individual HTTP requests, see the variable 'url-request-extra-headers'. +--- +** 'pixel-scroll-precision-mode' sets 'make-cursor-line-fully-visible'. +'pixel-scroll-precision-mode' sets 'make-cursor-line-fully-visible' to a +nil value globally, since the usual requirement of the Emacs display to +make the cursor line fully visible contradicts the smooth scrolling +expectations. + * Changes in Emacs 30.1 From ae2589ea7a59ac3bde19b025ba4a7968c77208d7 Mon Sep 17 00:00:00 2001 From: Wilhelm Kirschbaum Date: Mon, 30 Dec 2024 12:45:08 +0200 Subject: [PATCH 3/8] Add expression handling to heex-ts-mode On the latest update of the grammar expressions were added and won't be seen as directives anymore. * lisp/progmodes/heex-ts-mode.el (heex-ts--sexp-regexp): Match on expression as well. (heex-ts--indent-rules): Indent on expression end. (Bug#75191) * test/lisp/progmodes/heex-ts-mode-resources/indent.erts: Add expression indent test. --- lisp/progmodes/heex-ts-mode.el | 3 ++- .../progmodes/heex-ts-mode-resources/indent.erts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index c8905afda5c..e19349b3a0f 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -54,7 +54,7 @@ (defconst heex-ts--sexp-regexp (rx bol (or "directive" "tag" "component" "slot" - "attribute" "attribute_value" "quoted_attribute_value") + "attribute" "attribute_value" "quoted_attribute_value" "expression") eol)) ;; There seems to be no parent directive block for tree-sitter-heex, @@ -81,6 +81,7 @@ ((node-is "end_slot") parent-bol 0) ((node-is "/>") parent-bol 0) ((node-is ">") parent-bol 0) + ((node-is "}") parent-bol 0) ((parent-is "comment") prev-adaptive-prefix 0) ((parent-is "component") parent-bol ,offset) ((parent-is "tag") parent-bol ,offset) diff --git a/test/lisp/progmodes/heex-ts-mode-resources/indent.erts b/test/lisp/progmodes/heex-ts-mode-resources/indent.erts index 500ddb2b536..7fef6571933 100644 --- a/test/lisp/progmodes/heex-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/heex-ts-mode-resources/indent.erts @@ -45,3 +45,19 @@ Name: Slots =-=-= + +Name: Expression + +=-= +
+{ +@bar +} +
+=-= +
+ { + @bar + } +
+=-=-= From 921f454f5087f16d9afc5574525baa92df91b8d0 Mon Sep 17 00:00:00 2001 From: Wilhelm Kirschbaum Date: Mon, 30 Dec 2024 12:56:40 +0200 Subject: [PATCH 4/8] Update fontification for attribute values in heex-ts-mode Attribute values are strings as with html-ts-mode. * lisp/progmodes/heex-ts-mode.el (heex-ts--font-lock-settings): Change to attribute value to @font-lock-string-face. (Bug#75192) --- lisp/progmodes/heex-ts-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index e19349b3a0f..0f7785a3279 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -113,7 +113,7 @@ `((special_attribute_name) @font-lock-keyword-face) :language 'heex :feature 'heex-string - `([(attribute_value) (quoted_attribute_value)] @font-lock-constant-face) + `([(attribute_value) (quoted_attribute_value)] @font-lock-string-face) :language 'heex :feature 'heex-component `([ From 55f43f5b220ed3cc49141257918e51e403dd85ac Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 3 Jan 2025 21:39:32 -0800 Subject: [PATCH 5/8] ; Fix typo in treesit-explore-mode * lisp/treesit.el (treesit-explore-mode): We added the hook to kill-buffer-hook, so make sure to remove it from kill-buffer-hook, not post-command-hook. --- lisp/treesit.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index d788edf7ffc..2887521110b 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3601,7 +3601,7 @@ window." ;; Turn off explore mode. (remove-hook 'post-command-hook #'treesit--explorer-post-command t) - (remove-hook 'post-command-hook + (remove-hook 'kill-buffer-hook #'treesit--explorer-kill-explorer-buffer t) (treesit--explorer-kill-explorer-buffer))) From 4b2bb63b7ac386daabb0bbd2dc00fb542a9bcc21 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 4 Jan 2025 14:18:54 +0200 Subject: [PATCH 6/8] Fix documentation and prompt in 'package-isolate' * lisp/emacs-lisp/package.el (package-isolate): Fix doc string and the prompt. (Bug#75163) --- lisp/emacs-lisp/package.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index fa1d361d775..0fc5aaac343 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2647,16 +2647,23 @@ will be deleted." (defun package-isolate (packages &optional temp-init) "Start an uncustomized Emacs and only load a set of PACKAGES. +Interactively, prompt for PACKAGES to load, which should be specified +separated by commas. +If called from Lisp, PACKAGES should be a list of packages to load. If TEMP-INIT is non-nil, or when invoked with a prefix argument, -the Emacs user directory is set to a temporary directory." +the Emacs user directory is set to a temporary directory. +This command is intended for testing Emacs and/or the packages +in a clean environment." (interactive (cl-loop for p in (cl-loop for p in (package--alist) append (cdr p)) unless (package-built-in-p p) collect (cons (package-desc-full-name p) p) into table finally return - (list (cl-loop for c in (completing-read-multiple - "Isolate packages: " table - nil t) + (list + (cl-loop for c in + (completing-read-multiple + "Packages to isolate, as comma-separated list: " table + nil t) collect (alist-get c table nil nil #'string=)) current-prefix-arg))) (let* ((name (concat "package-isolate-" From 6d8c3c0cbe42c4b288679456f0eec9a78593e2a5 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Thu, 19 Dec 2024 14:33:35 -0800 Subject: [PATCH 7/8] Use `keymap*-set' over `global-set-key'/`define-key' in elisp intro * doc/lispintro/emacs-lisp-intro.texi (Key Bindings): Since `global-set-key' and `define-key' are considered legacy, we encourage `keymap-global-set' and `keymap-set' now. (Bug#74999) --- doc/lispintro/emacs-lisp-intro.texi | 120 +++++++++++++++++++--------- 1 file changed, 82 insertions(+), 38 deletions(-) diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 3e3febaf162..2c94e7f407e 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -13810,7 +13810,7 @@ syntax table determines which characters these are." If you wish, you can also install this key binding by evaluating it: @smallexample -(global-set-key "\C-c=" '@value{COUNT-WORDS}) +(keymap-global-set "C-c =" '@value{COUNT-WORDS}) @end smallexample To conduct the first test, set mark and point to the beginning and end @@ -14762,7 +14762,7 @@ almost the same code as for the recursive version of Let's reuse @kbd{C-c =} as a convenient key binding: @smallexample -(global-set-key "\C-c=" 'count-words-defun) +(keymap-global-set "C-c =" 'count-words-defun) @end smallexample Now we can try out @code{count-words-defun}: install both @@ -17229,7 +17229,7 @@ Now for some personal key bindings: @smallexample @group ;;; Compare windows -(global-set-key "\C-cw" 'compare-windows) +(keymap-global-set "C-c w" 'compare-windows) @end group @end smallexample @@ -17242,20 +17242,18 @@ each window as far as they match. I use this command all the time. This also shows how to set a key globally, for all modes. @cindex Setting a key globally -@cindex Global set key +@cindex Keymap global set @cindex Key setting globally -@findex global-set-key -The command is @code{global-set-key}. It is followed by the -key binding. In a @file{.emacs} file, the keybinding is written as -shown: @code{\C-c} stands for Control-C, which means to press the -control key and the @kbd{c} key at the same time. The @code{w} means -to press the @kbd{w} key. The key binding is surrounded by double -quotation marks. In documentation, you would write this as -@w{@kbd{C-c w}}. (If you were binding a @key{META} key, such as -@kbd{M-c}, rather than a @key{CTRL} key, you would write -@w{@code{\M-c}} in your @file{.emacs} file. @xref{Init Rebinding, , -Rebinding Keys in Your Init File, emacs, The GNU Emacs Manual}, for -details.) +@findex keymap-global-set +The key setting command is @code{keymap-global-set}. It is followed by +the key binding. In a @file{.emacs} file, the keybinding is written as +shown: @code{C-c} stands for Control-C, which means to press the control +key and the @kbd{c} key at the same time. The @code{w} means to press +the @kbd{w} key. The key binding is surrounded by double quotation +marks. (If you were binding a @key{META} key, rather than a @key{CTRL} +key, you would write @w{@code{M-c}} in your @file{.emacs} file. +@xref{Init Rebinding, , Rebinding Keys in Your Init File, emacs, The GNU +Emacs Manual}, for details.) The command invoked by the keys is @code{compare-windows}. Note that @code{compare-windows} is preceded by a single-quote; otherwise, Emacs @@ -17284,7 +17282,7 @@ Here is another key binding, with a comment: @group ;;; Key binding for 'occur' ; I use occur a lot, so let's bind it to a key: -(global-set-key "\C-co" 'occur) +(keymap-global-set "C-c o" 'occur) @end group @end smallexample @@ -17296,7 +17294,7 @@ uses the entire buffer. Matching lines are shown in a buffer called @file{*Occur*}. That buffer serves as a menu to jump to occurrences. -@findex global-unset-key +@findex keymap-global-unset @cindex Unbinding key @cindex Key unbinding @need 1250 @@ -17306,7 +17304,7 @@ work: @smallexample @group ;;; Unbind 'C-x f' -(global-unset-key "\C-xf") +(keymap-global-unset "C-x f") @end group @end smallexample @@ -17324,7 +17322,7 @@ The following rebinds an existing key: @smallexample @group ;;; Rebind 'C-x C-b' for 'buffer-menu' -(global-set-key "\C-x\C-b" 'buffer-menu) +(keymap-global-set "C-x C-b" 'buffer-menu) @end group @end smallexample @@ -17336,33 +17334,80 @@ window, I prefer the @code{buffer-menu} command, which not only lists the buffers, but moves point into that window. +@subsection Legacy Global Key Binding Commands + +@findex global-set-key +@cindex Global set key +Historically, keys are bound globally using a lower-level function, +@code{global-set-key}, which is now considered legacy. While you are +encouraged to use @code{keymap-global-set}, you likely would encounter +@code{global-set-key} in various places. The first example in this +section can be rewritten using @code{global-set-key} as: + +@smallexample +@group +(global-set-key "\C-cw" 'compare-windows) +@end group +@end smallexample + +It is very similar to @code{keymap-global-set}, with the keybinding +following a slightly different format. Control-C is represented by +@code{\C-c}, instead of @code{C-c}. There is no space between key +strokes, like @code{\C-c} and @code{w} in this example. Despite the +difference, in documentation, this is still written as @w{@kbd{C-c w}} +for readability. + +@findex global-unset-key +Historically, keys are unbound globally using a lower-function, +@code{global-unset-key}, which is now considered legacy. Its key +binding format follows that of @code{global-set-key}. The key unbinding +example in this section can be rewritten as: + +@smallexample +@group +;;; Unbind 'C-x f' +(global-unset-key "\C-xf") +@end group +@end smallexample + @node Keymaps @section Keymaps @cindex Keymaps @cindex Rebinding keys Emacs uses @dfn{keymaps} to record which keys call which commands. -When you use @code{global-set-key} to set the key binding for a single -command in all parts of Emacs, you are specifying the key binding in -@code{current-global-map}. +When you use @code{keymap-global-set} to set the key binding for a +single command in all parts of Emacs, you are specifying the key binding +in @code{current-global-map}. Specific modes, such as C mode or Text mode, have their own keymaps; the mode-specific keymaps override the global map that is shared by all buffers. -The @code{global-set-key} function binds, or rebinds, the global +The @code{keymap-global-set} function binds, or rebinds, the global keymap. For example, the following binds the key @kbd{C-x C-b} to the function @code{buffer-menu}: @smallexample -(global-set-key "\C-x\C-b" 'buffer-menu) +(keymap-global-set "C-x C-b" 'buffer-menu) @end smallexample -Mode-specific keymaps are bound using the @code{define-key} function, +Mode-specific keymaps are bound using the @code{keymap-set} function, which takes a specific keymap as an argument, as well as the key and -the command. For example, my @file{.emacs} file contains the -following expression to bind the @code{texinfo-insert-@@group} command -to @kbd{C-c C-c g}: +the command. For example, the following expression binds the +@code{texinfo-insert-@@group} command to @kbd{C-c C-c g}: + +@smallexample +@group +(keymap-set texinfo-mode-map "C-c C-c g" 'texinfo-insert-@@group) +@end group +@end smallexample + +Historically, keymaps are bound using a lower-level function, +@code{define-key}, which is now considered legacy. While you are +encouraged to use @code{keymap-set}, you likely would encounter +@code{define-key} in various places. The above key binding can be +rewritten using @code{define-key} as: @smallexample @group @@ -17396,9 +17441,9 @@ Here is the @code{texinfo-insert-@@group} function definition: write a function to insert a word; but I prefer key strokes consistent with other Texinfo mode key bindings.) -You will see numerous @code{define-key} expressions in -@file{loaddefs.el} as well as in the various mode libraries, such as -@file{cc-mode.el} and @file{lisp-mode.el}. +You will see numerous @code{keymap-set} and @code{define-key} +expressions in @file{loaddefs.el} as well as in the various mode +libraries, such as @file{cc-mode.el} and @file{lisp-mode.el}. @xref{Key Bindings, , Customizing Key Bindings, emacs, The GNU Emacs Manual}, and @ref{Keymaps, , Keymaps, elisp, The GNU Emacs Lisp @@ -17440,13 +17485,12 @@ window. @need 1250 To replace the key binding for the default -@code{split-window-vertically}, you must also unset that key and bind -the keys to @code{split-window-quietly}, like this: +@code{split-window-vertically}, you must bind the keys to +@code{split-window-quietly}, like this: @smallexample @group -(global-unset-key "\C-x2") -(global-set-key "\C-x2" 'split-window-quietly) +(keymap-global-set "C-x 2" 'split-window-quietly) @end group @end smallexample @@ -17608,7 +17652,7 @@ I bind @code{line-to-top-of-window} to my @key{F6} function key like this: @smallexample -(global-set-key [f6] 'line-to-top-of-window) +(keymap-global-set "" 'line-to-top-of-window) @end smallexample For more information, see @ref{Init Rebinding, , Rebinding Keys in @@ -18791,7 +18835,7 @@ Here is the @code{the-the} function, as I include it in my @group ;; Bind 'the-the' to C-c \ -(global-set-key "\C-c\\" 'the-the) +(keymap-global-set "C-c \\" 'the-the) @end group @end smallexample From 6468c3f7a74133b130d15172d770c8b7eebfeac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Date: Sat, 4 Jan 2025 10:37:59 +0100 Subject: [PATCH 8/8] Update doc string of 'insert' * src/editfns.c (Finsert): Mention 'decode-coding-string' instead of the obsolete 'string-as-multibyte' in doc string. (Bug#75345) --- src/editfns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index a3676892444..e02cf14b968 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1364,8 +1364,8 @@ to unibyte for insertion (see `string-make-unibyte'). When operating on binary data, it may be necessary to preserve the original bytes of a unibyte string when inserting it into a multibyte -buffer; to accomplish this, apply `string-as-multibyte' to the string -and insert the result. +buffer; to accomplish this, apply `decode-coding-string' with the +`no-conversion' coding system to the string and insert the result. usage: (insert &rest ARGS) */) (ptrdiff_t nargs, Lisp_Object *args)