commit a5f2d6279e0793aa0f8ba1939273866b6464b7e7 (HEAD, refs/remotes/origin/master) Author: Sean Whitton Date: Wed Mar 12 11:59:46 2025 +0800 ; exchange-point-and-mark-highlight-region: Add more detail here too diff --git a/lisp/simple.el b/lisp/simple.el index 53658ac6d9b..1d4f7b55567 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7458,7 +7458,10 @@ Does not set point. Does nothing if mark ring is empty." "Activate region when exchanging point and mark. When set to nil, this modifies `exchange-point-and-mark' so that it -doesn't activate the mark if it is not already active. +doesn't activate the mark if it is not already active, except when there +is a prefix argument. Setting this variable to nil effectively swaps +the meanings of the presence and absence of a prefix argument to +`exchange-point-and-mark'. This variable has no effect when Transient Mark mode is off." :type 'boolean commit cd1defc441fc7694aaa0adac617edf790d8444d6 Author: Sean Whitton Date: Wed Mar 12 11:56:13 2025 +0800 ; Add more detail to exchange-point-and-mark docstring It didn't mention that exchange-point-and-mark-highlight-region affects C-u C-x C-x too. diff --git a/lisp/simple.el b/lisp/simple.el index 08ea5e27ab8..53658ac6d9b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7470,10 +7470,15 @@ This variable has no effect when Transient Mark mode is off." This command works even when the mark is not active, and it reactivates the mark unless `exchange-point-and-mark-highlight-region' is nil. -If Transient Mark mode is on, a prefix ARG deactivates the mark -if it is active, and otherwise avoids reactivating it. If -Transient Mark mode is off, a prefix ARG enables Transient Mark -mode temporarily." +If Transient Mark mode is on, a prefix ARG deactivates the mark if it is +active, and otherwise avoids reactivating it. However, if +`exchange-point-and-mark-highlight-region' is nil, then using a prefix +argument does reactivate the mark; effectively, when Transient Mark mode +is on, setting `exchange-point-and-mark-highlight-region' to nil swaps +the meanings of the presence and absence of a prefix argument. + +If Transient Mark mode is off, a prefix ARG enables Transient Mark mode +temporarily." (interactive "P") (let ((omark (mark t)) (region-was-active (region-active-p)) commit ad57fbc58f91837eb73c74afcc72258cef30b9d1 Author: Sean Whitton Date: Wed Mar 12 11:00:16 2025 +0800 find-function-mode-lower-precedence: Also remove the global bindings * lisp/emacs-lisp/find-func.el (find-function-mode): When find-function-mode-lower-precedence is non-nil, apply the bindings in such a way that we can also remove them when the mode is deactivated. Approach due to Stefan Monnier. diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 92cd22a544b..455095c9be6 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -854,20 +854,14 @@ See `find-function-on-key'." (if find-function-mode (make-sparse-keymap) find-function-mode-map)) - (named-let define-keys ((from find-function-mode-map) - (into (current-global-map)) - (prefix [])) - (map-keymap (lambda (event binding) - (let* ((key (vector event)) - (prefixed (vconcat prefix key))) - (if-let* (((keymapp binding)) - (ninto (lookup-key into key)) - ((keymapp ninto))) - (define-keys binding ninto prefixed) - (if find-function-mode - (global-set-key prefixed binding) - (global-unset-key prefixed))))) - from)))) + (let ((parent (keymap-parent (current-global-map)))) + (if find-function-mode + (unless (memq find-function-mode-map parent) + (setf (keymap-parent (current-global-map)) + (make-composed-keymap (list find-function-mode-map + parent)))) + (when (memq find-function-mode-map parent) + (delq find-function-mode-map parent)))))) ;;;###autoload (defun find-function-setup-keys () commit 9838b88c2e154fd4a319e06612b385f20c286177 Author: Sean Whitton Date: Wed Mar 12 10:33:55 2025 +0800 ; Document recent change to diff-apply-buffer * doc/emacs/files.texi (Diff Mode): * etc/NEWS: Document diff-apply-buffer considering an active region and its new prefix argument. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 3bc7d6ea24a..d11d7767353 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1784,7 +1784,9 @@ confirm you really want to revert and kill the hunk. You can customize @findex diff-apply-buffer @item C-c @key{RET} a Apply all the hunks in the buffer (@code{diff-apply-buffer}). If the -diffs were applied successfully, save the changed buffers. +region is active, apply all hunks that the region overlaps; otherwise, +apply all hunks. With a prefix argument, reverse-apply the hunks. +If the diffs were applied successfully, save the changed buffers. @findex diff-delete-other-hunks @item C-c @key{RET} n diff --git a/etc/NEWS b/etc/NEWS index f39daa112c7..d79080c94e8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1364,6 +1364,15 @@ It is intended to be added to the 'log-edit-done-hook' so that 'vc-cvs-checkin' behaves like invoking "cvs commit [files...]" from the command line. +** Diff mode + ++++ +*** diff-apply-buffer now considers the region and can reverse-apply. +If the region is active, this command now applies all hunks that the +region overlaps; otherwise, it applies all hunks. +With a prefix arguments, it now reverse-applies the hunks. +This matches the existing prefix argument to 'diff-apply-hunk'. + ** Package +++ commit 2aef2951c06c04c23455419283a232f8d55d5ecd Author: Sean Whitton Date: Wed Mar 12 10:24:22 2025 +0800 ; Replace "Elisp" with "Lisp" or "Emacs Lisp" in some places * configure.ac (libgccjit_not_found_err) (libgccjit_dev_not_found_err): * doc/lispref/elisp.texi (Top): * doc/lispref/functions.texi (What Is a Function): * doc/lispref/parsing.texi (Parsing Program Source) (Tree-sitter C API): * doc/misc/gnus.texi (The Gnus Registry): * etc/TODO: * lisp/auth-source.el (auth-source-search): * lisp/cedet/semantic/bovine/el.el (emacs-lisp-mode): * lisp/editorconfig.el (editorconfig-get-local-variables-functions): * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): * lisp/net/tramp-message.el (tramp-debug-font-lock-keywords): * src/frame.c (do_switch_frame): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-help-fns-examples-function-test): Say "Lisp" not "Elisp". * lisp/progmodes/peg.el (peg-translate-exp): Say "Emacs Lisp" not "Elisp". diff --git a/configure.ac b/configure.ac index 22082cf737b..253276d8de5 100644 --- a/configure.ac +++ b/configure.ac @@ -5078,16 +5078,16 @@ AC_DEFUN([libgccjit_smoke_test], [ }]])]) AC_DEFUN([libgccjit_not_found_err], [ - AC_MSG_ERROR([Elisp native compiler was requested, but libgccjit was not found. + AC_MSG_ERROR([Lisp native compiler was requested, but libgccjit was not found. Please try installing libgccjit or a similar package. -If you are sure you want Emacs be compiled without Elisp native compiler, +If you are sure you want Emacs be compiled without the Lisp native compiler, pass the --without-native-compilation option to configure.])]) AC_DEFUN([libgccjit_dev_not_found_err], [ - AC_MSG_ERROR([Elisp native compiler was requested, but libgccjit header files were + AC_MSG_ERROR([Lisp native compiler was requested, but libgccjit header files were not found. Please try installing libgccjit-dev or a similar package. -If you are sure you want Emacs be compiled without Elisp native compiler, +If you are sure you want Emacs be compiled without the Lisp native compiler, pass the --without-native-compilation option to configure.])]) AC_DEFUN([libgccjit_broken_err], [ diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index ee73d50e8ce..def50ef7c64 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -1388,7 +1388,7 @@ Parsing Program Source * Pattern Matching:: Pattern matching with query patterns. * Multiple Languages:: Parse text written in multiple languages. * Tree-sitter Major Modes:: Develop major modes using tree-sitter. -* Tree-sitter C API:: Compare the C API and the Elisp API. +* Tree-sitter C API:: Compare the C API and the Lisp API. Syntax Descriptors diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 122b6f52a8e..1279b15b819 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -219,7 +219,7 @@ function. For example: @defun compiled-function-p object This function returns @code{t} if @var{object} is a function object -that is not in the form of Elisp source code but something like +that is not in the form of Lisp source code but something like machine code or byte code instead. More specifically it returns @code{t} if the function is built-in (a.k.a.@: ``primitive'', @pxref{What Is a Function}), or byte-compiled (@pxref{Byte diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 8968eafd91b..3e8e0851f2c 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -48,7 +48,7 @@ source files that mix multiple programming languages. * User-defined Things:: User-defined ``Things'' and Navigation. * Multiple Languages:: Parse text written in multiple languages. * Tree-sitter Major Modes:: Develop major modes using tree-sitter. -* Tree-sitter C API:: Compare the C API and the Elisp API. +* Tree-sitter C API:: Compare the C API and the Lisp API. @end menu @node Language Grammar @@ -2305,8 +2305,8 @@ Null nodes are converted to @code{nil}. @end itemize Below is the correspondence between all C API functions and their -Elisp counterparts. Sometimes one Elisp function corresponds to -multiple C functions, and many C functions don't have an Elisp +Lisp counterparts. Sometimes one Lisp function corresponds to +multiple C functions, and many C functions don't have a Lisp counterpart. @example diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 0ef3afb7f7c..62909fc99f1 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -26271,7 +26271,7 @@ etc.@: backends. @item Store arbitrary data -Through a simple Elisp API, the registry can remember any data for a +Through a simple Lisp API, the registry can remember any data for a message. A built-in inverse map, when activated, allows quick lookups of all messages matching a particular set of criteria. @end enumerate diff --git a/etc/TODO b/etc/TODO index 77c1a276cd5..0700452b757 100644 --- a/etc/TODO +++ b/etc/TODO @@ -105,7 +105,7 @@ longer)." ** Do interactive mode tagging for commands Change "(interactive)" to "(interactive nil foo-mode)" for command -completion purposes. Pick a major mode or Elisp library, and check +completion purposes. Pick a major mode or Lisp library, and check all interactive commands to see if they are only relevant in one particular mode. This requires care as some commands might be useful outside of the mode they were written for. @@ -730,9 +730,9 @@ H-S-C-M-s-double-wheel-up, ... *** Support for the $ (paired delimiter) in parse-partial-sexp -*** Support for hook-chars whose effect is specified by Elisp code +*** Support for hook-chars whose effect is specified by Lisp Hook-chars could have their effect on the parsing-state specified by -Elisp code. Thus a character could both close a string and open a +Lisp code. Thus a character could both close a string and open a comment at the same time and do it in a context-sensitive way. *** Ability to add mode-specific data to the partial-parse-state diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 06f23af5b11..1d039d8b0d1 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -638,7 +638,7 @@ will ensure that any results will actually have a :secret property. :delete t means to delete any found entries. nil by default. -Use `auth-source-delete' in Elisp code instead of calling +Use `auth-source-delete' in Lisp code instead of calling `auth-source-search' directly with this parameter. :type (X Y Z) will check only those backend types. `netrc' and diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index f27bb479c48..fddb1884c9d 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el @@ -926,7 +926,7 @@ See `semantic-format-tag-prototype' for Emacs Lisp for more details." (defvar-mode-local emacs-lisp-mode semantic-stickyfunc-sticky-classes '(function type variable) "Add variables. -Elisp variables can be pretty long, so track this one too.") +Elisp variable names can be pretty long, so track this one too.") (with-suppressed-warnings ((obsolete define-child-mode)) ;; FIXME: We should handle this some other way! diff --git a/lisp/editorconfig.el b/lisp/editorconfig.el index bf29f34e2db..7cdd79fa3b0 100644 --- a/lisp/editorconfig.el +++ b/lisp/editorconfig.el @@ -604,7 +604,7 @@ This function also removes `unset' properties and calls Every function is called with one argument, a hash-table indexed by EditorConfig settings represented as symbols and whose corresponding value is represented as a string. It should return a list of (VAR . VAL) settings -where VAR is an Elisp variable and VAL is the value to which it should be set.") +where VAR is a Lisp variable and VAL is the value to which it should be set.") (defun editorconfig--get-local-variables (props) "Get variables settings according to EditorConfig PROPS." diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index c6e8db11b16..170c7828cdd 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -904,7 +904,7 @@ lexically and dynamically bound symbols actually used by FORM." (defun cconv-make-interpreted-closure (args body env docstring iform) "Make a closure for the interpreter. -This is intended to be called at runtime by the Elisp interpreter (when +This is intended to be called at runtime by the Lisp interpreter (when the code has not been compiled). FUN is the closure's source code, must be a lambda form. ENV is the runtime representation of the lexical environment, diff --git a/lisp/emacs-lisp/oclosure.el b/lisp/emacs-lisp/oclosure.el index 2574c7dac60..d38429648e6 100644 --- a/lisp/emacs-lisp/oclosure.el +++ b/lisp/emacs-lisp/oclosure.el @@ -555,7 +555,7 @@ immutable fields are indeed not mutated." (defun cconv--interactive-helper (fun if) "Add interactive \"form\" IF to FUN. Returns a new command that otherwise behaves like FUN. -IF can be an Elisp form to be interpreted or a function of no arguments." +IF can be a Lisp form to be interpreted or a function of no arguments." (oclosure-lambda (cconv--interactive-helper (fun fun) (if if)) (&rest args) (apply (if (called-interactively-p 'any) diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index 00d20e31edc..20bf720c41b 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el @@ -109,7 +109,7 @@ When it is used for regexp matching, the regexp groups are 3 for the verbosity level.") (defconst tramp-debug-font-lock-keywords - ;; FIXME: Make it a function instead of an Elisp expression, so you + ;; FIXME: Make it a function instead of a Lisp expression, so you ;; can evaluate it with `funcall' rather than `eval'! ;; Also, in `font-lock-defaults' you can specify a function name for ;; the "KEYWORDS" part, so font-lock calls it to get the actual keywords! diff --git a/lisp/progmodes/peg.el b/lisp/progmodes/peg.el index aa32624436b..f8fc7acc436 100644 --- a/lisp/progmodes/peg.el +++ b/lisp/progmodes/peg.el @@ -659,7 +659,7 @@ rulesets defined previously with `define-peg-ruleset'." ;; This is the main translation function. (defun peg-translate-exp (exp) - "Return the Elisp code to match the PE EXP." + "Return the Emacs Lisp code to match the PE EXP." ;; FIXME: This expansion basically duplicates `exp' in the output, which is ;; a serious problem because it's done recursively, so it makes the output ;; code's size exponentially larger than the input! diff --git a/src/frame.c b/src/frame.c index decb92bca21..bbff0dec2e4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1892,7 +1892,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor /* After setting `selected_frame`, we're temporarily in an inconsistent state where (selected-window) != (frame-selected-window). Until this - invariant is restored we should be very careful not to run Elisp code. + invariant is restored we should be very careful not to run any Lisp. (bug#58343) */ selected_frame = frame; diff --git a/test/lisp/emacs-lisp/shortdoc-tests.el b/test/lisp/emacs-lisp/shortdoc-tests.el index d826d596951..1cbec24a556 100644 --- a/test/lisp/emacs-lisp/shortdoc-tests.el +++ b/test/lisp/emacs-lisp/shortdoc-tests.el @@ -90,7 +90,7 @@ (shortdoc-function-examples 'string-match-p))))) (ert-deftest shortdoc-help-fns-examples-function-test () - "Test that `shortdoc-help-fns-examples-function' correctly prints Elisp function examples." + "Test that `shortdoc-help-fns-examples-function' correctly prints Lisp function examples." (with-temp-buffer (shortdoc-help-fns-examples-function 'string-fill) (should (equal "\n Examples:\n\n (string-fill \"Three short words\" 12)\n => \"Three short\\nwords\"\n (string-fill \"Long-word\" 3)\n => \"Long-word\"\n\n" commit d01a391195e4f6282a587fcc581bb6cd8b2204e1 Author: Sean Whitton Date: Wed Mar 12 10:13:07 2025 +0800 ; Touch up docs for exchange-point-and-mark-highlight-region diff --git a/etc/NEWS b/etc/NEWS index af7a5e38b73..f39daa112c7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -484,8 +484,9 @@ modal editing packages. ** New user variable 'exchange-point-and-mark-highlight-region'. When set to nil, this modifies `exchange-point-and-mark' so that it doesn't -activate mark when it is not already active. -The default value is 't' which changes nothing to previous behavior. +activate the mark if it is not already active. +The default value is t, which retains the old behavior. +This variable has no effect when Transient Mark mode is off. * Changes in Specialized Modes and Packages in Emacs 31.1 diff --git a/lisp/simple.el b/lisp/simple.el index df8f8276812..08ea5e27ab8 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7457,17 +7457,18 @@ Does not set point. Does nothing if mark ring is empty." (defcustom exchange-point-and-mark-highlight-region t "Activate region when exchanging point and mark. -When set to nil, this modifies `exchange-point-and-mark' so that it doesn't -activate mark when it is not already active." +When set to nil, this modifies `exchange-point-and-mark' so that it +doesn't activate the mark if it is not already active. + +This variable has no effect when Transient Mark mode is off." :type 'boolean :group 'editing-basics :version "31.1") (defun exchange-point-and-mark (&optional arg) "Put the mark where point is now, and point where the mark is now. -This command works even when the mark is not active, -and it reactivates the mark unless -`exchange-point-and-mark-highlight-region' is nil. +This command works even when the mark is not active, and it reactivates +the mark unless `exchange-point-and-mark-highlight-region' is nil. If Transient Mark mode is on, a prefix ARG deactivates the mark if it is active, and otherwise avoids reactivating it. If commit 22db8a2c2aacc3c6e774c0338af3863ed668d087 Merge: aa545fea2d1 20291046053 Author: Sean Whitton Date: Wed Mar 12 10:09:45 2025 +0800 Merge from origin/emacs-30 20291046053 Correct some outdated docs for hack-local-variables commit aa545fea2d10ac61c0628a5dee9a0953f4b21c58 Merge: 99852fb867e c877acc261b Author: Sean Whitton Date: Wed Mar 12 10:09:45 2025 +0800 ; Merge from origin/emacs-30 The following commit was skipped: c877acc261b ; Backport ELisp->Elisp fix to etc/NEWS to ease merging commit 99852fb867e4d7d2090cbb82ff12d86d2a6ed9cc Merge: 85b147d3210 894b0e3a2fe Author: Sean Whitton Date: Wed Mar 12 10:09:09 2025 +0800 Merge from origin/emacs-30 894b0e3a2fe ; Adapt comment in tramp.el cc87717fa07 Add keyword placeholder to tramp.el 7d0d61d8549 Rewrite ERT manual introduction b2f124f2a88 ; cperl-mode.el: Don't misinterpret exec_fcn as keyword exec 59d1aac49df Document return values of the various read-* functions commit 202910460538401ec585e9be80c05adb55279573 (refs/remotes/origin/emacs-30) Author: Sean Whitton Date: Tue Mar 11 14:35:48 2025 +0800 Correct some outdated docs for hack-local-variables * doc/lispref/variables.texi (File Local Variables): : Say that it applies directory-local variables too. Add a cross-reference. (Directory Local Variables): Document dir-local-variables-alist. * lisp/files.el (hack-local-variables): Say that it always puts into effect directory-local variables. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 7bc9243649c..bc930784262 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2014,14 +2014,21 @@ function does not look for the @samp{mode:} local variable in the @w{@samp{-*-}} line. @code{set-auto-mode} does that, also taking @code{enable-local-variables} into account (@pxref{Auto Major Mode}). -This function works by walking the alist stored in -@code{file-local-variables-alist} and applying each local variable in -turn. It calls @code{before-hack-local-variables-hook} and +This function also puts into effect directory-local variables as +specified in @file{.dir-locals.el}. If the buffer is not visiting any +file, then the directory-local variables that apply are those which +would be applicable to files in the @code{default-directory} +(@pxref{Directory Local Variables}). + +This function works by walking the alists stored in +@code{file-local-variables-alist} and @code{dir-local-variables-alist} +and applying each local variable in turn. It calls +@code{before-hack-local-variables-hook} and @code{hack-local-variables-hook} before and after applying the -variables, respectively. It only calls the before-hook if the alist -is non-@code{nil}; it always calls the other hook. This -function ignores a @samp{mode} element if it specifies the same major -mode as the buffer already has. +variables, respectively. It only calls the before-hook if +@code{file-local-variables-alist} is non-@code{nil}; it always calls the +other hook. This function ignores a @samp{mode} element if it specifies +the same major mode as the buffer already has. If the optional argument @var{handle-mode} is @code{t}, then all this function does is return a symbol specifying the major mode, if the @@ -2288,6 +2295,17 @@ modification times of the associated directory local variables file updates this list. @end defvar +@defvar dir-local-variables-alist +This buffer-local variable holds the alist of directory-local variable +settings. Each element of the alist is of the form @w{@code{(@var{var} +. @var{value})}}, where @var{var} is a symbol of the local variable and +@var{value} is its value (this is the same structure as that of +@code{file-local-variables-alist}, @pxref{File Local Variables}). When +Emacs visits a file, it collects all the directory-local variables into +this alist, and then the @code{hack-local-variables} function applies +them one by one (again, @pxref{File Local Variables}). +@end defvar + @defvar hack-dir-local-get-variables-functions This special hook holds the functions that gather the directory-local variables to use for a given buffer. By default it contains just the diff --git a/lisp/files.el b/lisp/files.el index 007fd23a5f5..79dbe5ad53e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4163,10 +4163,12 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil." (defun hack-local-variables (&optional handle-mode inhibit-locals) "Parse and put into effect this buffer's local variables spec. -For buffers visiting files, also puts into effect directory-local -variables. +Also puts into effect directory-local variables. +For buffers not visiting files, apply the directory-local variables that +would be applicable to files in `default-directory'. -Uses `hack-local-variables-apply' to apply the variables. +Uses `hack-local-variables-apply' and `hack-dir-local-variables' +to apply the variables. If `enable-local-variables' or `local-enable-local-variables' is nil, or INHIBIT-LOCALS is non-nil, this function disregards all commit c877acc261b6b7aa631e2e175d53920ef3f2104b Author: Sean Whitton Date: Wed Mar 12 09:45:34 2025 +0800 ; Backport ELisp->Elisp fix to etc/NEWS to ease merging Do not merge to master. diff --git a/etc/NEWS b/etc/NEWS index 906deb07212..dfe4c65f1dd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2390,7 +2390,7 @@ This line typically looks something like ;;; My little pony mode -*- lexical-binding: t -*- -It is needed to inform the compiler about which dialect of ELisp +It is needed to inform the compiler about which dialect of Elisp your code is using: the modern dialect with lexical binding or the old dialect with only dynamic binding. commit 85b147d32100d8da89366a19ab77f996fe011043 Author: Stefan Kangas Date: Wed Mar 12 02:42:40 2025 +0100 ; Fix :version tag Reported by Campbell Barton . diff --git a/lisp/simple.el b/lisp/simple.el index e6a8e4c3b95..7fc9f149718 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7460,7 +7460,7 @@ When set to nil, this modifies `exchange-point-and-mark' so that it doesn't activate mark when it is not already active." :type 'boolean :group 'editing-basics - :version 31.1) + :version "31.1") (defun exchange-point-and-mark (&optional arg) "Put the mark where point is now, and point where the mark is now. commit 60c0524ad28eaeae968603010831bcacca2a5180 Author: Sean Whitton Date: Wed Mar 12 09:36:25 2025 +0800 Fix capitalization ELisp -> Elisp * configure.ac (libgccjit_not_found_err) (libgccjit_dev_not_found_err): * doc/emacs/buffers.texi (List Buffers): * doc/lispref/elisp.texi (Tree-sitter C API): * doc/lispref/functions.texi (What Is a Function): * doc/lispref/parsing.texi (Parsing Program Source) (Tree-sitter C API): * doc/misc/gnus.texi (The Gnus Registry): * etc/DEBUG: * etc/NEWS: * etc/NEWS.25: * etc/NEWS.26: * etc/NEWS.28: * etc/NEWS.30: * etc/TODO: * lib-src/emacsclient.c (print_help_and_exit): * lisp/auth-source.el (auth-source-search): * lisp/cedet/semantic/bovine/el.el (emacs-lisp-mode): * lisp/cedet/semantic/wisent/comp.el (wisent-automaton-lisp-form): * lisp/cedet/srecode/el.el (srecode-semantic-apply-tag-to-dict): * lisp/editorconfig.el (editorconfig-get-local-variables-functions): * lisp/emacs-lisp/bindat.el (bindat-type): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): * lisp/emacs-lisp/cl-macs.el (cl--labels-convert): * lisp/emacs-lisp/lisp-mode.el (lisp-fdefs) (lisp-fill-paragraphs-as-doc-string): * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): * lisp/emacs-lisp/re-builder.el: * lisp/erc/erc-button.el (erc-emacswiki-lisp-url): * lisp/help-fns.el (help-fns--describe-function-or-command-prompt): * lisp/menu-bar.el (menu-bar-search-documentation-menu): * lisp/net/tramp-message.el (tramp-debug-font-lock-keywords): * lisp/org/org-capture.el (org-capture): * lisp/org/org.el (org-category, org-todo): * lisp/org/ox.el (org-export-async-start): * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): * lisp/progmodes/peg.el (peg-translate-exp): * lisp/progmodes/ruby-ts-mode.el: * lisp/woman.el (woman-mode, woman-parse-numeric-arg): * src/chartab.c (map_char_table_for_charset): * src/fns.c (extract_data_from_object): * src/frame.c (do_switch_frame): * src/keyboard.c (make_lispy_event): * test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-help-fns-examples-function-test): * test/manual/etags/c-src/emacs/src/keyboard.c (make_lispy_event): Fix capitalization ELisp -> Elisp. diff --git a/configure.ac b/configure.ac index a3fc4e9fe5b..22082cf737b 100644 --- a/configure.ac +++ b/configure.ac @@ -5078,16 +5078,16 @@ AC_DEFUN([libgccjit_smoke_test], [ }]])]) AC_DEFUN([libgccjit_not_found_err], [ - AC_MSG_ERROR([ELisp native compiler was requested, but libgccjit was not found. + AC_MSG_ERROR([Elisp native compiler was requested, but libgccjit was not found. Please try installing libgccjit or a similar package. -If you are sure you want Emacs be compiled without ELisp native compiler, +If you are sure you want Emacs be compiled without Elisp native compiler, pass the --without-native-compilation option to configure.])]) AC_DEFUN([libgccjit_dev_not_found_err], [ - AC_MSG_ERROR([ELisp native compiler was requested, but libgccjit header files were + AC_MSG_ERROR([Elisp native compiler was requested, but libgccjit header files were not found. Please try installing libgccjit-dev or a similar package. -If you are sure you want Emacs be compiled without ELisp native compiler, +If you are sure you want Emacs be compiled without Elisp native compiler, pass the --without-native-compilation option to configure.])]) AC_DEFUN([libgccjit_broken_err], [ diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 9c735f6158b..2bcf0c318b5 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -205,7 +205,7 @@ Here is an example of a buffer list: @smallexample CRM Buffer Size Mode File -. * .emacs 3294 ELisp/l ~/.emacs +. * .emacs 3294 Elisp/l ~/.emacs % *Help* 101 Help search.c 86055 C ~/cvs/emacs/src/search.c % src 20959 Dired by name ~/cvs/emacs/src/ diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index d92d82c896f..ee73d50e8ce 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -1388,7 +1388,7 @@ Parsing Program Source * Pattern Matching:: Pattern matching with query patterns. * Multiple Languages:: Parse text written in multiple languages. * Tree-sitter Major Modes:: Develop major modes using tree-sitter. -* Tree-sitter C API:: Compare the C API and the ELisp API. +* Tree-sitter C API:: Compare the C API and the Elisp API. Syntax Descriptors diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 99dfca217c2..122b6f52a8e 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -219,7 +219,7 @@ function. For example: @defun compiled-function-p object This function returns @code{t} if @var{object} is a function object -that is not in the form of ELisp source code but something like +that is not in the form of Elisp source code but something like machine code or byte code instead. More specifically it returns @code{t} if the function is built-in (a.k.a.@: ``primitive'', @pxref{What Is a Function}), or byte-compiled (@pxref{Byte diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index ade7b819756..8968eafd91b 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -48,7 +48,7 @@ source files that mix multiple programming languages. * User-defined Things:: User-defined ``Things'' and Navigation. * Multiple Languages:: Parse text written in multiple languages. * Tree-sitter Major Modes:: Develop major modes using tree-sitter. -* Tree-sitter C API:: Compare the C API and the ELisp API. +* Tree-sitter C API:: Compare the C API and the Elisp API. @end menu @node Language Grammar @@ -2305,8 +2305,8 @@ Null nodes are converted to @code{nil}. @end itemize Below is the correspondence between all C API functions and their -ELisp counterparts. Sometimes one ELisp function corresponds to -multiple C functions, and many C functions don't have an ELisp +Elisp counterparts. Sometimes one Elisp function corresponds to +multiple C functions, and many C functions don't have an Elisp counterpart. @example diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 7624f1831cc..0ef3afb7f7c 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -26271,7 +26271,7 @@ etc.@: backends. @item Store arbitrary data -Through a simple ELisp API, the registry can remember any data for a +Through a simple Elisp API, the registry can remember any data for a message. A built-in inverse map, when activated, allows quick lookups of all messages matching a particular set of criteria. @end enumerate diff --git a/etc/DEBUG b/etc/DEBUG index b95ea7e7e8c..5409be95a7f 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -260,7 +260,7 @@ from a shell prompt, like this: where Emacs-PID is the process ID of Emacs being debugged. Other useful signals to send are SIGUSR1 and SIGUSR2; see "Error Debugging" -in the ELisp manual for how to use those. +in the Elisp manual for how to use those. When Emacs is displaying on a text terminal, it is useful to have a separate terminal for the debug session. This can be done by starting @@ -805,7 +805,7 @@ not exit when it should. On GNU and Unix systems, you can also try sending Emacs SIGUSR2, which, if 'debug-on-event' has its default value, will cause Emacs to attempt to break out of its current loop and enter the Lisp -debugger. (See the node "Debugging" in the ELisp manual for the +debugger. (See the node "Debugging" in the Elisp manual for the details about the Lisp debugger.) This feature is useful when a C-level debugger is not conveniently available. diff --git a/etc/NEWS b/etc/NEWS index 468eca02d52..af7a5e38b73 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1564,7 +1564,7 @@ for writing code that can work across different Emacs versions. --- ** You can change the default value of 'lexical-binding'. -While the default is still the use dynamic binding dialect of ELisp +While the default is still the use dynamic binding dialect of Elisp in those places that don't explicitly set 'lexical-binding' you can change it globally with: diff --git a/etc/NEWS.25 b/etc/NEWS.25 index ca79b0dcbbb..0aa49c68153 100644 --- a/etc/NEWS.25 +++ b/etc/NEWS.25 @@ -275,7 +275,7 @@ to produce its authentication key. *** Successive single-char deletions are collapsed in the undo-log just like successive char insertions. Which commands invoke this behavior is controlled by the new 'undo-auto-amalgamate' function. See the node -"Undo" in the ELisp manual for more details. +"Undo" in the Elisp manual for more details. *** The heuristic used to insert 'undo-boundary' after each command has changed, so that if a command causes changes in more than just the @@ -1418,10 +1418,10 @@ continued to the next line. ** New macro 'define-advice'. ** Emacs Lisp now supports generators. -See the "Generators" section of the ELisp manual for the details. +See the "Generators" section of the Elisp manual for the details. ** New finalizer facility for running code when objects become unreachable. -See the "Finalizer Type" subsection in the ELisp manual for the +See the "Finalizer Type" subsection in the Elisp manual for the details. ** Lexical closures can use '(:documentation FORM)' to build their docstring. diff --git a/etc/NEWS.26 b/etc/NEWS.26 index 33d96571101..471c48f1eb6 100644 --- a/etc/NEWS.26 +++ b/etc/NEWS.26 @@ -309,7 +309,7 @@ explicitly yields. Global variables are shared among all threads, but a 'let' binding is thread-local. Each thread also has its own current buffer and its own match data. -See the chapter "(elisp) Threads" in the ELisp manual for full +See the chapter "(elisp) Threads" in the Elisp manual for full documentation of these facilities. ** The new user variable 'electric-quote-chars' provides a list @@ -471,7 +471,7 @@ See the doc string of 'dir-locals-file' for more information. ** Connection-local variables can be used to specify local variables with a value depending on the connected remote server. For details, -see the node "(elisp) Connection Local Variables" in the ELisp manual. +see the node "(elisp) Connection Local Variables" in the Elisp manual. ** International domain names (IDNA) are now encoded via the new puny.el library, so that one can visit Web sites with non-ASCII URLs. @@ -946,7 +946,7 @@ rotation, as well as saving the image to a file. These commands are also available in 'image-mode'. *** A new library for creating and manipulating SVG images has been -added. See the "(elisp) SVG Images" section in the ELisp reference +added. See the "(elisp) SVG Images" section in the Elisp reference manual for details. *** New setf-able function to access and set image parameters is @@ -1106,7 +1106,7 @@ environments or ANTLR programs with embedded Python code. A major mode can provide indentation context for a sub-mode. To support this, modes should use 'prog-first-column' instead of a literal zero and avoid calling 'widen' in their indentation functions. -See the node "(elisp) Mode-Specific Indent" in the ELisp manual for +See the node "(elisp) Mode-Specific Indent" in the Elisp manual for more details. ** ERC @@ -1441,7 +1441,7 @@ It has been renamed as internal function 'window--make-major-side-window', however applications should instead call 'display-buffer-in-side-window' (passing the SIDE and SLOT parameters as elements of ALIST). This approach is backwards-compatible with versions of Emacs in which the old function -exists. See the node "Displaying Buffers in Side Windows" in the ELisp +exists. See the node "Displaying Buffers in Side Windows" in the Elisp manual for more details. * Lisp Changes in Emacs 26.1 @@ -1493,13 +1493,13 @@ range of indentation. ** New function 'secure-hash-algorithms' to list the algorithms that 'secure-hash' supports. -See the node "(elisp) Checksum/Hash" in the ELisp manual for details. +See the node "(elisp) Checksum/Hash" in the Elisp manual for details. ** Emacs now exposes the GnuTLS cryptographic API with the functions 'gnutls-macs' and 'gnutls-hash-mac'; 'gnutls-digests' and 'gnutls-hash-digest'; 'gnutls-ciphers' and 'gnutls-symmetric-encrypt' and 'gnutls-symmetric-decrypt'. -See the node "(elisp) GnuTLS Cryptography" in the ELisp manual for details. +See the node "(elisp) GnuTLS Cryptography" in the Elisp manual for details. ** The function 'gnutls-available-p' now returns a list of capabilities supported by the GnuTLS library used by Emacs. @@ -1707,7 +1707,7 @@ frame's outer border. frame. **** 'parent-frame' makes a frame the child frame of another Emacs -frame. The section "(elisp) Child Frames" in the ELisp manual +frame. The section "(elisp) Child Frames" in the Elisp manual describes the intrinsics of that relationship. **** 'delete-before' triggers deletion of one frame before that of @@ -1782,12 +1782,12 @@ function 'display-buffer-in-side-window' will display its buffer in a side window. Functions for toggling all side windows on a frame, changing and reversing the layout of side windows and returning the main (major non-side) window of a frame are provided. For details -consult the section "(elisp) Side Windows" in the ELisp manual. +consult the section "(elisp) Side Windows" in the Elisp manual. *** Support for atomic windows - rectangular compositions of windows treated by 'split-window', 'delete-window' and 'delete-other-windows' like a single live window - is now official. For details consult the -section "(elisp) Atomic Windows" in the ELisp manual. +section "(elisp) Atomic Windows" in the Elisp manual. *** New 'display-buffer' alist entry 'window-parameters' allows the assignment of window parameters to the window used for displaying the @@ -1826,7 +1826,7 @@ window's body. *** The semantics of 'mouse-autoselect-window' has changed slightly. For details see the section "(elisp) Mouse Window Auto-selection" in -the ELisp manual. +the Elisp manual. *** 'select-frame-by-name' now may return a frame on another display if it does not find a suitable one on the current display. diff --git a/etc/NEWS.28 b/etc/NEWS.28 index f8f8664f00b..924003d8ed6 100644 --- a/etc/NEWS.28 +++ b/etc/NEWS.28 @@ -3906,7 +3906,7 @@ support these coding-systems. This new system is provided by the new macro 'bindat-type' and obsoletes the old data layout specifications. It supports arbitrary-size integers, recursive types, and more. See the Info node -"(elisp) Byte Packing" in the ELisp manual for more details. +"(elisp) Byte Packing" in the Elisp manual for more details. ** New macro 'with-environment-variables'. This macro allows setting environment variables temporarily when diff --git a/etc/NEWS.30 b/etc/NEWS.30 index 906deb07212..dfe4c65f1dd 100644 --- a/etc/NEWS.30 +++ b/etc/NEWS.30 @@ -2390,7 +2390,7 @@ This line typically looks something like ;;; My little pony mode -*- lexical-binding: t -*- -It is needed to inform the compiler about which dialect of ELisp +It is needed to inform the compiler about which dialect of Elisp your code is using: the modern dialect with lexical binding or the old dialect with only dynamic binding. diff --git a/etc/TODO b/etc/TODO index ecd3bc6ded4..77c1a276cd5 100644 --- a/etc/TODO +++ b/etc/TODO @@ -105,7 +105,7 @@ longer)." ** Do interactive mode tagging for commands Change "(interactive)" to "(interactive nil foo-mode)" for command -completion purposes. Pick a major mode or ELisp library, and check +completion purposes. Pick a major mode or Elisp library, and check all interactive commands to see if they are only relevant in one particular mode. This requires care as some commands might be useful outside of the mode they were written for. @@ -730,9 +730,9 @@ H-S-C-M-s-double-wheel-up, ... *** Support for the $ (paired delimiter) in parse-partial-sexp -*** Support for hook-chars whose effect is specified by ELisp code +*** Support for hook-chars whose effect is specified by Elisp code Hook-chars could have their effect on the parsing-state specified by -ELisp code. Thus a character could both close a string and open a +Elisp code. Thus a character could both close a string and open a comment at the same time and do it in a context-sensitive way. *** Ability to add mode-specific data to the partial-parse-state diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 21e8d171574..eb98ef6c6e7 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -700,7 +700,7 @@ The following OPTIONS are accepted:\n\ ", "\ -F ALIST, --frame-parameters=ALIST\n\ Set the parameters of a new frame\n\ --e, --eval Evaluate the FILE arguments as ELisp expressions\n\ +-e, --eval Evaluate the FILE arguments as Elisp expressions\n\ -n, --no-wait Don't wait for the server to return\n\ -w, --timeout=SECONDS Seconds to wait before timing out\n\ -q, --quiet Don't display messages on success\n\ diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 2d4fd396942..6d53960e9a0 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -638,7 +638,7 @@ will ensure that any results will actually have a :secret property. :delete t means to delete any found entries. nil by default. -Use `auth-source-delete' in ELisp code instead of calling +Use `auth-source-delete' in Elisp code instead of calling `auth-source-search' directly with this parameter. :type (X Y Z) will check only those backend types. `netrc' and diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index 2f1e818e079..f27bb479c48 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el @@ -926,7 +926,7 @@ See `semantic-format-tag-prototype' for Emacs Lisp for more details." (defvar-mode-local emacs-lisp-mode semantic-stickyfunc-sticky-classes '(function type variable) "Add variables. -ELisp variables can be pretty long, so track this one too.") +Elisp variables can be pretty long, so track this one too.") (with-suppressed-warnings ((obsolete define-child-mode)) ;; FIXME: We should handle this some other way! diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index ed7115a8c0e..9e41a9cd3da 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -3461,12 +3461,12 @@ Automatically called by the Emacs Lisp byte compiler as a ;; `wisent--compile-grammar' generates the actual parse table ;; we need at run-time, but in order to be able to compile the code it -;; contains, we need to "reify" it back into a piece of ELisp code +;; contains, we need to "reify" it back into a piece of Elisp code ;; which (re)builds it. ;; This is needed for 2 reasons: ;; - The parse tables include an obarray and these don't survive the print+read ;; steps involved in generating a `.elc' file and reading it back in. -;; - Within the parse table vectors/obarrays we have ELisp functions which +;; - Within the parse table vectors/obarrays we have Elisp functions which ;; we want to byte-compile, but if we were to just `quote' the table ;; we'd get them with the same non-compiled functions. (defun wisent-automaton-lisp-form (automaton) diff --git a/lisp/cedet/srecode/el.el b/lisp/cedet/srecode/el.el index 2bd8d256d02..8f2865338a4 100644 --- a/lisp/cedet/srecode/el.el +++ b/lisp/cedet/srecode/el.el @@ -89,7 +89,7 @@ Calls `srecode-semantic-apply-tag-to-dict-default' first." (let* ((tag (oref tagobj prime)) (doc (semantic-tag-docstring tag))) - ;; It is much more common to have doc on ELisp. + ;; It is much more common to have doc on Elisp. (srecode-dictionary-set-value dict "DOC" doc) (cond diff --git a/lisp/editorconfig.el b/lisp/editorconfig.el index 7ac3324e971..bf29f34e2db 100644 --- a/lisp/editorconfig.el +++ b/lisp/editorconfig.el @@ -604,7 +604,7 @@ This function also removes `unset' properties and calls Every function is called with one argument, a hash-table indexed by EditorConfig settings represented as symbols and whose corresponding value is represented as a string. It should return a list of (VAR . VAL) settings -where VAR is an ELisp variable and VAL is the value to which it should be set.") +where VAR is an Elisp variable and VAL is the value to which it should be set.") (defun editorconfig--get-local-variables (props) "Get variables settings according to EditorConfig PROPS." diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index c40cc0d53c8..5d2f206cc5c 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -883,11 +883,11 @@ controlled in the following way: - If the list of fields is preceded with `:pack-var VAR' then the object to be packed is bound to VAR when evaluating the EXPs of `:pack-val'. -All the above BITLEN, LEN, LE, COUNT, and EXP are ELisp expressions evaluated +All the above BITLEN, LEN, LE, COUNT, and EXP are Elisp expressions evaluated in the current lexical context extended with the previous fields. TYPE can additionally be one of the Bindat type macros defined with -`bindat-defmacro' (and listed below) or an ELisp expression which returns +`bindat-defmacro' (and listed below) or an Elisp expression which returns a bindat type expression." (declare (indent 0) (debug (bindat-type))) `(progn diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 9f1b796bdf2..652c79e9c93 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -172,7 +172,7 @@ Earlier variables shadow later ones with the same name.") ;; When the function comes from another file, we byte-compile ;; the inlined function first, and then inline its byte-code. ;; This also has the advantage that the final code does not - ;; depend on the order of compilation of ELisp files, making + ;; depend on the order of compilation of Elisp files, making ;; the build more reproducible. (if (eq fn localfn) ;; From the same file => same mode. diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index a91489437e9..c6e8db11b16 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -904,7 +904,7 @@ lexically and dynamically bound symbols actually used by FORM." (defun cconv-make-interpreted-closure (args body env docstring iform) "Make a closure for the interpreter. -This is intended to be called at runtime by the ELisp interpreter (when +This is intended to be called at runtime by the Elisp interpreter (when the code has not been compiled). FUN is the closure's source code, must be a lambda form. ENV is the runtime representation of the lexical environment, @@ -950,7 +950,7 @@ for the lexical bindings." (newenv (nconc (mapcar (lambda (fv) (assq fv env)) (car fvs)) (cdr fvs)))) ;; Never return a nil env, since nil means to use the dynbind - ;; dialect of ELisp. + ;; dialect of Elisp. (make-interpreted-closure args expanded-fun-body (or newenv '(t)) docstring iform))))) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2a12aa8f7b0..89319a05b27 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2060,7 +2060,7 @@ a `let' form, except that the list of symbols can be computed at run-time." (funcall (cdr found) cl--labels-magic))))) (if (and replacement (eq cl--labels-magic (car replacement))) (nth 1 replacement) - ;; FIXME: Here, we'd like to return the `&whole' form, but since ELisp + ;; FIXME: Here, we'd like to return the `&whole' form, but since Elisp ;; doesn't have that, we approximate it via `cl--labels-convert-cache'. (let ((res `(function ,f))) (setq cl--labels-convert-cache (cons f res)) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index a5769e0815e..006b713ae6e 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -513,10 +513,10 @@ This will generate compile-time constants from BINDINGS." ;; Constant values. (,(lambda (bound) (lisp-mode--search-key ":" bound)) (0 font-lock-builtin-face)) - ;; ELisp and Common Lisp `&' keywords as types. + ;; Elisp and Common Lisp `&' keywords as types. (,(lambda (bound) (lisp-mode--search-key "&" bound)) (0 font-lock-type-face)) - ;; ELisp regexp grouping constructs + ;; Elisp regexp grouping constructs (,(lambda (bound) (catch 'found ;; The following loop is needed to continue searching after matches @@ -568,10 +568,10 @@ This will generate compile-time constants from BINDINGS." ;; Constant values. (,(lambda (bound) (lisp-mode--search-key ":" bound)) (0 font-lock-builtin-face)) - ;; ELisp and Common Lisp `&' keywords as types. + ;; Elisp and Common Lisp `&' keywords as types. (,(lambda (bound) (lisp-mode--search-key "&" bound)) (0 font-lock-type-face)) - ;; ELisp regexp grouping constructs + ;; Elisp regexp grouping constructs ;; This is too general -- rms. ;; A user complained that he has functions whose names start with `do' ;; and that they get the wrong color. @@ -1433,14 +1433,14 @@ Any non-integer value means do not use a different value of :version "30.1") (defvar lisp-fill-paragraphs-as-doc-string t - "Whether `lisp-fill-paragraph' should fill strings as ELisp doc strings. + "Whether `lisp-fill-paragraph' should fill strings as Elisp doc strings. The default behavior of `lisp-fill-paragraph' is tuned for filling Emacs Lisp doc strings, with their special treatment for the first line. Specifically, strings are filled in a narrowed context to avoid filling surrounding code, which means any leading indent is disregarded, which can cause the filled string to extend passed the configured `fill-column' variable value. If you would rather fill the string in -its original context, disregarding the special conventions of ELisp doc +its original context, disregarding the special conventions of Elisp doc strings, and want to ensure the `fill-column' value is more strictly respected, set this variable to nil. Doing so makes `lisp-fill-paragraph' behave as it used to in Emacs 27 and prior diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 897a72d7485..64ec634620a 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -729,7 +729,7 @@ test of free variables in the following ways: - It does not distinguish variables from functions, so it can be used both to detect whether a given variable is used by SEXP and to detect whether a given function is used by SEXP. -- It does not actually know ELisp syntax, so it only looks for the presence +- It does not actually know Elisp syntax, so it only looks for the presence of symbols in SEXP and can't distinguish if those symbols are truly references to the given variable (or function). That can make the result include bindings which actually aren't used. diff --git a/lisp/emacs-lisp/oclosure.el b/lisp/emacs-lisp/oclosure.el index b0b8aa0ce8e..2574c7dac60 100644 --- a/lisp/emacs-lisp/oclosure.el +++ b/lisp/emacs-lisp/oclosure.el @@ -555,7 +555,7 @@ immutable fields are indeed not mutated." (defun cconv--interactive-helper (fun if) "Add interactive \"form\" IF to FUN. Returns a new command that otherwise behaves like FUN. -IF can be an ELisp form to be interpreted or a function of no arguments." +IF can be an Elisp form to be interpreted or a function of no arguments." (oclosure-lambda (cconv--interactive-helper (fun fun) (if if)) (&rest args) (apply (if (called-interactively-p 'any) diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index 6b4f6c55d7b..849442ff133 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -77,7 +77,7 @@ ;; modes. For the `rx' syntax the function `rx-to-string' is applied to ;; the evaluated expression read. So you can use quoted arguments ;; with something like '("findme") or you can construct arguments to -;; your hearts delight with a valid ELisp expression. (The compiled +;; your hearts delight with a valid Elisp expression. (The compiled ;; string form will be copied by `reb-copy') If you want to take ;; a glance at the corresponding string you can temporarily change the ;; input syntax. diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index e6ed0e2f75f..77aec20c40f 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -219,7 +219,7 @@ PAR is a number of a regexp grouping whose text will be passed to :version "28.1") (defcustom erc-emacswiki-lisp-url "https://www.emacswiki.org/elisp/" - "URL of the EmacsWiki ELisp area." + "URL of the EmacsWiki Elisp area." :type 'string) (defvar erc-button-highlight-nick-once '(QUIT PART JOIN) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 5f02b4ae777..2d0da178a4c 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -254,7 +254,7 @@ interactive command." (setq fn (intern val))) ;; These error messages are intended to be less technical for the ;; `describe-command' case, as they are directed at users that are - ;; not necessarily ELisp programmers. + ;; not necessarily Elisp programmers. (unless (and fn (symbolp fn)) (user-error (if want-command "You didn't specify a command's symbol" diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 1b2a4f21a8b..27238d5c266 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2087,7 +2087,7 @@ key, a click, or a menu-item")) '(menu-item "Look Up Key in User Manual..." Info-goto-emacs-key-command-node :help "Display manual section that describes a key")) (define-key menu [lookup-subject-in-elisp-manual] - '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search + '(menu-item "Look Up Subject in Elisp Manual..." elisp-index-search :help "Find description of a subject in Emacs Lisp manual")) (define-key menu [lookup-subject-in-emacs-manual] '(menu-item "Look Up Subject in User Manual..." emacs-index-search diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index 570f4349b92..00d20e31edc 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el @@ -109,7 +109,7 @@ When it is used for regexp matching, the regexp groups are 3 for the verbosity level.") (defconst tramp-debug-font-lock-keywords - ;; FIXME: Make it a function instead of an ELisp expression, so you + ;; FIXME: Make it a function instead of an Elisp expression, so you ;; can evaluate it with `funcall' rather than `eval'! ;; Also, in `font-lock-defaults' you can specify a function name for ;; the "KEYWORDS" part, so font-lock calls it to get the actual keywords! diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index d4ae0207c36..9f737893e6a 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -658,7 +658,7 @@ When called with a `C-0' (zero) prefix, insert a template at point. When called with a `C-1' (one) prefix, force prompting for a date when a datetree entry is made. -ELisp programs can set KEYS to a string associated with a template +Elisp programs can set KEYS to a string associated with a template in `org-capture-templates'. In this case, interactive selection will be bypassed. diff --git a/lisp/org/org.el b/lisp/org/org.el index 56a8d11e1ab..9051bf6c8c9 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -3157,16 +3157,16 @@ There are multiple ways to set the category. One way is to set it in the document property drawer. For example: :PROPERTIES: -:CATEGORY: ELisp +:CATEGORY: Elisp :END: Other ways to define it is as an Emacs file variable, for example -# -*- mode: org; org-category: \"ELisp\" +# -*- mode: org; org-category: \"Elisp\" or for the file to contain a special line: -#+CATEGORY: ELisp +#+CATEGORY: Elisp If the file does not specify a category, then file's base name is used instead.") @@ -9422,7 +9422,7 @@ With numeric prefix arg, switch to the Nth state. With a numeric prefix arg of 0, inhibit note taking for the change. With a numeric prefix arg of -1, cancel repeater to allow marking as DONE. -When called through ELisp, arg is also interpreted in the following way: +When called through Elisp, arg is also interpreted in the following way: `none' -> empty state \"\" -> switch to empty state `done' -> switch to DONE diff --git a/lisp/org/ox.el b/lisp/org/ox.el index a2a21a72c42..6b62d8bae7f 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -6660,7 +6660,7 @@ to `:default' encoding. If it fails, return S." "Call function FUN on the results returned by BODY evaluation. FUN is an anonymous function of one argument. BODY should be a valid -ELisp source expression. BODY evaluation happens in an asynchronous process, +Elisp source expression. BODY evaluation happens in an asynchronous process, from a buffer which is an exact copy of the current one. Use `org-export-add-to-stack' in FUN in order to register results diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 934f095f988..a34f29bffea 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -325,7 +325,7 @@ happens in interactive invocations." ;;;###autoload (define-derived-mode emacs-lisp-mode lisp-data-mode - `("ELisp" + `("Elisp" (lexical-binding (:propertize "/l" help-echo "Using lexical-binding mode") (:propertize "/d" diff --git a/lisp/progmodes/peg.el b/lisp/progmodes/peg.el index 405b92c53b0..aa32624436b 100644 --- a/lisp/progmodes/peg.el +++ b/lisp/progmodes/peg.el @@ -659,7 +659,7 @@ rulesets defined previously with `define-peg-ruleset'." ;; This is the main translation function. (defun peg-translate-exp (exp) - "Return the ELisp code to match the PE EXP." + "Return the Elisp code to match the PE EXP." ;; FIXME: This expansion basically duplicates `exp' in the output, which is ;; a serious problem because it's done recursively, so it makes the output ;; code's size exponentially larger than the input! diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 6fb71a75a58..1594f301641 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -35,7 +35,7 @@ ;; This file defines ruby-ts-mode which is a major mode for editing ;; Ruby files that uses Tree Sitter to parse the language. More -;; information about Tree Sitter can be found in the ELisp Info pages +;; information about Tree Sitter can be found in the Elisp Info pages ;; as well as this website: https://tree-sitter.github.io/tree-sitter/ ;; For this major mode to work, Emacs has to be compiled with diff --git a/lisp/woman.el b/lisp/woman.el index 5056d2c4dfd..a5ab82be40d 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -1861,7 +1861,7 @@ Argument EVENT is the invoking mouse event." (define-derived-mode woman-mode man-common "WoMan" "Turn on (most of) Man mode to browse a buffer formatted by WoMan. -WoMan is an ELisp emulation of much of the functionality of the Emacs +WoMan is an Elisp emulation of much of the functionality of the Emacs `man' command running the standard UN*X man and ?roff programs. WoMan author: F.J.Wright@Maths.QMW.ac.uk See `Man-mode' for additional details. @@ -3508,7 +3508,7 @@ The expression may be an argument in quotes." ((memq (setq op (following-char)) '(?& ?:)) ; Boolean and / or (forward-char) (setq value - ;; and / or are special forms, not functions, in ELisp + ;; and / or are special forms, not functions, in Elisp (if (eq op ?&) ;; and (if (> value 0) diff --git a/src/chartab.c b/src/chartab.c index dbb6a717213..3076f72c06e 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -1066,7 +1066,7 @@ map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), vector of property values (symbols nil, L, R, etc). The full list of Unicode character properties supported by Emacs is - documented in the ELisp manual, in the node "Character Properties". + documented in the Elisp manual, in the node "Character Properties". A table for Unicode character property has these characteristics: diff --git a/src/fns.c b/src/fns.c index dcbcd2aa40e..3f109a81836 100644 --- a/src/fns.c +++ b/src/fns.c @@ -6196,7 +6196,7 @@ extract_data_from_object (Lisp_Object spec, /* Format: (iv-auto REQUIRED-LENGTH). */ if (! FIXNATP (start)) - error ("Without a length, `iv-auto' can't be used; see ELisp manual"); + error ("Without a length, `iv-auto' can't be used; see Elisp manual"); else { EMACS_INT start_hold = XFIXNAT (start); diff --git a/src/frame.c b/src/frame.c index bd175c0f860..decb92bca21 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1892,7 +1892,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor /* After setting `selected_frame`, we're temporarily in an inconsistent state where (selected-window) != (frame-selected-window). Until this - invariant is restored we should be very careful not to run ELisp code. + invariant is restored we should be very careful not to run Elisp code. (bug#58343) */ selected_frame = frame; diff --git a/src/keyboard.c b/src/keyboard.c index b22814d702d..21a3b3bcf4e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6349,7 +6349,7 @@ make_lispy_event (struct input_event *event) if (NILP (item)) return Qnil; - /* ELisp manual 2.4b says (x y) are window + /* Elisp manual 2.4b says (x y) are window relative but code says they are frame-relative. */ position = list4 (event->frame_or_window, @@ -6836,7 +6836,7 @@ make_lispy_event (struct input_event *event) if (NILP (item)) return Qnil; - /* ELisp manual 2.4b says (x y) are window + /* Elisp manual 2.4b says (x y) are window relative but code says they are frame-relative. */ position = list4 (event->frame_or_window, diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 64ccdd2d1ce..b4b939d3d31 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -930,7 +930,7 @@ See Bug#57915." (cl-flet ((fn (&key x) x)) (should-error (fn :x)) (should (eq (fn :x :a) :a))) - ;; In ELisp function arguments are always statically scoped (bug#47552). + ;; In Elisp function arguments are always statically scoped (bug#47552). (let ((cl--test-a 'dyn) ;; FIXME: How do we silence the "Lexical argument shadows" warning? (f diff --git a/test/lisp/emacs-lisp/shortdoc-tests.el b/test/lisp/emacs-lisp/shortdoc-tests.el index 560221f5533..d826d596951 100644 --- a/test/lisp/emacs-lisp/shortdoc-tests.el +++ b/test/lisp/emacs-lisp/shortdoc-tests.el @@ -90,7 +90,7 @@ (shortdoc-function-examples 'string-match-p))))) (ert-deftest shortdoc-help-fns-examples-function-test () - "Test that `shortdoc-help-fns-examples-function' correctly prints ELisp function examples." + "Test that `shortdoc-help-fns-examples-function' correctly prints Elisp function examples." (with-temp-buffer (shortdoc-help-fns-examples-function 'string-fill) (should (equal "\n Examples:\n\n (string-fill \"Three short words\" 12)\n => \"Three short\\nwords\"\n (string-fill \"Long-word\" 3)\n => \"Long-word\"\n\n" diff --git a/test/manual/etags/c-src/emacs/src/keyboard.c b/test/manual/etags/c-src/emacs/src/keyboard.c index e531036f826..feb2baef4b3 100644 --- a/test/manual/etags/c-src/emacs/src/keyboard.c +++ b/test/manual/etags/c-src/emacs/src/keyboard.c @@ -5670,7 +5670,7 @@ make_lispy_event (struct input_event *event) } } - /* ELisp manual 2.4b says (x y) are window + /* Elisp manual 2.4b says (x y) are window relative but code says they are frame-relative. */ position = list4 (event->frame_or_window, commit dd1b11d34cd1389fe5ee0dd80784f9cd0d66026d Author: F. Jason Park Date: Tue Mar 11 10:41:18 2025 -0700 Add erc-compat adapter for xml-escape-string * lisp/erc/erc-compat.el (erc-compat--xml-escape-string): New macro to call `xml-escape-string' sans the NO-ERROR argument on Emacs 27. * lisp/erc/erc-desktop-notifications.el (erc-notifications-notify): Use compat macro. diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 7d5c87c4a58..4a8029d68ac 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -369,6 +369,15 @@ If START or END is negative, it counts from the end." client-final-message)) +;;;; Misc 28.1 + +(defmacro erc-compat--xml-escape-string (string &optional noerror) + "Call `xml-escape-string' with NO-ERROR if supported." + (if (>= emacs-major-version 28) + `(xml-escape-string ,string ,noerror) + `(xml-escape-string ,string))) + + ;;;; Misc 29.1 (defvar url-irc-function) diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index a8bde92686c..6ef2f0d8ea1 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -65,8 +65,11 @@ This will replace the last notification sent with this function." (dbus-ignore-errors (setq erc-notifications-last-notification (let* ((channel (if privp (erc-get-buffer nick) (current-buffer))) - (title (format "%s in %s" (xml-escape-string nick t) channel)) - (body (xml-escape-string (erc-controls-strip msg) t))) + (title (format "%s in %s" + (erc-compat--xml-escape-string nick t) + channel)) + (body (erc-compat--xml-escape-string (erc-controls-strip msg) + t))) (funcall (cond ((featurep 'android) #'android-notifications-notify) ((featurep 'haiku) commit 3db65ff5cb3d6f58b83052760b4ce04eb77db1bc Author: F. Jason Park Date: Mon Mar 10 19:02:48 2025 -0700 Suppress log module when inserting date stamps in ERC * lisp/erc/erc-log.el (erc-truncate-buffer-on-save): Use `make-obsolete-variable' because `erc-truncate-buffer-on-save' is an option, not a function. Already mentioned in etc/ERC-NEWS. (erc-logging-enabled): Return nil if `log' appears in the `erc--skip' msg prop. * lisp/erc/erc-stamp.el (erc-stamp--defer-date-insertion-on-post-modify): Add `log' to `erc--skip' msg prop. This tells the log module to defer advancing the `erc-last-saved-position' marker until after stamps have been inserted, thus ensuring they're included in logs when `erc-log-write-after-insert' is non-nil. * test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--save-buffer-in-logs/truncate-on-save): Suppress warning for `erc-truncate-buffer-on-save'. (erc-scenarios-log--write-after-insert): New test. (Bug#76875) diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index b960eaeca9d..173e6724a8f 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -124,7 +124,8 @@ custom function which returns the directory part and set (defcustom erc-truncate-buffer-on-save nil "Erase the contents of any ERC (channel, query, server) buffer when it is saved." :type 'boolean) -(make-obsolete 'erc-truncate-buffer-on-save 'erc-cmd-CLEAR "30.1") +(make-obsolete-variable 'erc-truncate-buffer-on-save + "maybe see command `erc-cmd-CLEAR'" "30.1") (defcustom erc-enable-logging t "If non-nil, ERC will log IRC conversations. @@ -322,6 +323,7 @@ is writable (it will be created as necessary) and (or buffer (setq buffer (current-buffer))) (and erc-log-channels-directory (not erc-log--save-in-progress-p) + (not (erc--memq-msg-prop 'erc--skip 'log)) (or (functionp erc-log-channels-directory) (if erc-log--check-writable-nocreate-p (file-writable-p erc-log-channels-directory) diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index 5b6550c4a88..c3ab155cb24 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -732,6 +732,9 @@ non-nil." (symbol (make-symbol "erc-stamp--insert-date")) (marker (setf (erc-stamp--date-marker data) (point-min-marker)))) (setf (erc-stamp--date-fn data) symbol) + ;; Disable logging in case `erc-log-write-after-insert' is in effect. + (when erc--msg-props + (push 'log (gethash 'erc--skip erc--msg-props))) (fset symbol (lambda (&rest _) (remove-hook hook-var symbol) diff --git a/test/lisp/erc/erc-scenarios-log.el b/test/lisp/erc/erc-scenarios-log.el index 1e95e98e073..3c95018dd26 100644 --- a/test/lisp/erc/erc-scenarios-log.el +++ b/test/lisp/erc/erc-scenarios-log.el @@ -332,18 +332,78 @@ (ert-deftest erc-scenarios-log--save-buffer-in-logs/truncate-on-save () :tags '(:expensive-test) + (with-suppressed-warnings ((obsolete erc-truncate-buffer-on-save)) + (erc-scenarios-common-with-cleanup + ((erc-scenarios-common-dialog "base/assoc/bouncer-history") + (dumb-server (erc-d-run "localhost" t 'foonet)) + (tempdir (make-temp-file "erc-tests-log." t nil nil)) + (erc-log-channels-directory tempdir) + (erc-modules (cons 'log erc-modules)) + (port (process-contact dumb-server :service)) + (erc-truncate-buffer-on-save t) + (logchan (expand-file-name (format "#chan!tester@127.0.0.1:%d.txt" + port) + tempdir)) + (erc-server-flood-penalty 0.1) + (erc-insert-timestamp-function #'erc-insert-timestamp-left) + (expect (erc-d-t-make-expecter))) + + (unless noninteractive + (add-hook 'kill-emacs-hook + (lambda () (delete-directory tempdir :recursive)))) + + (ert-info ("Connect to foonet") + (with-current-buffer (erc :server "127.0.0.1" + :port port + :nick "tester" + :password "foonet:changeme" + :full-name "tester") + (should (string= (buffer-name) (format "127.0.0.1:%d" port))))) + + (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan")) + (funcall expect 10 " [07:04:10] hi everyone") + (should-not (file-exists-p logchan)) + ;; Simulate an M-x erc-save-buffer-in-logs RET + (cl-letf (((symbol-function 'called-interactively-p) #'always)) + (call-interactively #'erc-save-buffer-in-logs)) + (should (file-exists-p logchan)) + (funcall expect 10 " bob: As't please your lordship") + (erc-save-buffer-in-logs) + ;; Not truncated when called by lisp code. + (should (> (buffer-size) 400))) + + (ert-info ("No double entries") + (with-temp-buffer + (insert-file-contents logchan) + (funcall expect 0.1 "hi everyone") + (funcall expect -0.1 "hi everyone") + (funcall expect 0.1 "Playback Complete") + (funcall expect -0.1 "Playback Complete") + (funcall expect 10 " bob: As't"))) + + (erc-log-mode -1) + (when noninteractive (delete-directory tempdir :recursive))))) + +(ert-deftest erc-scenarios-log--write-after-insert () + :tags '(:expensive-test :unstable) + (erc-scenarios-common-with-cleanup ((erc-scenarios-common-dialog "base/assoc/bouncer-history") (dumb-server (erc-d-run "localhost" t 'foonet)) (tempdir (make-temp-file "erc-tests-log." t nil nil)) (erc-log-channels-directory tempdir) - (erc-modules (cons 'log erc-modules)) + (erc-modules `(truncate log ,@erc-modules)) + (erc-max-buffer-size 512) + (erc-log-write-after-insert t) + (erc-timestamp-format-left "\n[@@DATE__STAMP@@]\n") + (erc-truncate-padding-size 512) (port (process-contact dumb-server :service)) - (erc-truncate-buffer-on-save t) (logchan (expand-file-name (format "#chan!tester@127.0.0.1:%d.txt" port) tempdir)) + (logserv (expand-file-name + (format "127.0.0.1:%d!tester@127.0.0.1:%d.txt" port port) + tempdir)) (erc-server-flood-penalty 0.1) - (erc-insert-timestamp-function #'erc-insert-timestamp-left) (expect (erc-d-t-make-expecter))) (unless noninteractive @@ -356,30 +416,48 @@ :nick "tester" :password "foonet:changeme" :full-name "tester") - (should (string= (buffer-name) (format "127.0.0.1:%d" port))))) + (should (string= (buffer-name) (format "127.0.0.1:%d" port))) + ;; File already exists because `erc-log-write-after-insert' is + ;; non-nil. + (should (file-exists-p logserv)) + (should-not (file-exists-p logchan)) + ;; Verify that truncation actually happens where it should. + (funcall expect 10 "*** MAXLIST=beI:60") + (should (= (pos-bol) 22)) + ;; Exactly two + 1 (for date stamp) newlines preserved. + (should (string-prefix-p "\n\n\n[" (buffer-string))))) + + (ert-info ("Log file ahead of truncation point") + ;; Log contains lines still present in buffer. + (with-temp-buffer + (insert-file-contents logserv) + (funcall expect 10 "@@DATE__STAMP@@") + (funcall expect 10 "*** MAXLIST=beI:60"))) (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan")) - (funcall expect 10 " [07:04:10] hi everyone") - (should-not (file-exists-p logchan)) - ;; Simulate an M-x erc-save-buffer-in-logs RET - (cl-letf (((symbol-function 'called-interactively-p) #'always)) - (call-interactively #'erc-save-buffer-in-logs)) + (funcall expect 10 "@@DATE__STAMP@@") + (funcall expect 10 "please your lordship") (should (file-exists-p logchan)) - (funcall expect 10 " bob: As't please your lordship") - (erc-save-buffer-in-logs) - ;; Not truncated when called by lisp code. - (should (> (buffer-size) 400))) + (funcall expect -0.1 "[07:04:37] alice: Here," (point-min))) - (ert-info ("No double entries") + (ert-info ("Log ahead of truncation point") (with-temp-buffer (insert-file-contents logchan) - (funcall expect 0.1 "hi everyone") - (funcall expect -0.1 "hi everyone") - (funcall expect 0.1 "Playback Complete") - (funcall expect -0.1 "Playback Complete") - (funcall expect 10 " bob: As't"))) + (funcall expect 10 "@@DATE__STAMP@@") + (funcall expect 1 "You have joined") + ;; No unwanted duplicates. + (funcall expect 1 " [07:04:37] alice: Here,") + (funcall expect -0.001 " [07:04:37] alice: Here,") + (funcall expect 1 " [07:04:42] bob: By my troth") + (funcall expect -0.001 " [07:04:42] bob: By my troth") + (funcall expect 1 "I will grant it") + + ;; Writes happen instantly because `erc-log-write-after-insert' + ;; is non-nil. Compare to `erc-scenarios-log--truncate' above. + (funcall expect 1 "loathed enemy"))) (erc-log-mode -1) + (erc-truncate-mode -1) (when noninteractive (delete-directory tempdir :recursive)))) ;;; erc-scenarios-log.el ends here commit 261205dbb57f77e3426df9f27fcc5429aae48c05 Author: Sean Whitton Date: Wed Mar 12 09:20:05 2025 +0800 ; Replace non-standard "CLisp" abbreviation for "Common Lisp" diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 30cbfaf24f3..a5769e0815e 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -513,7 +513,7 @@ This will generate compile-time constants from BINDINGS." ;; Constant values. (,(lambda (bound) (lisp-mode--search-key ":" bound)) (0 font-lock-builtin-face)) - ;; ELisp and CLisp `&' keywords as types. + ;; ELisp and Common Lisp `&' keywords as types. (,(lambda (bound) (lisp-mode--search-key "&" bound)) (0 font-lock-type-face)) ;; ELisp regexp grouping constructs @@ -568,7 +568,7 @@ This will generate compile-time constants from BINDINGS." ;; Constant values. (,(lambda (bound) (lisp-mode--search-key ":" bound)) (0 font-lock-builtin-face)) - ;; ELisp and CLisp `&' keywords as types. + ;; ELisp and Common Lisp `&' keywords as types. (,(lambda (bound) (lisp-mode--search-key "&" bound)) (0 font-lock-type-face)) ;; ELisp regexp grouping constructs commit ffb7d656a2c89f86ccd2de51379de9612c7a4aa3 Author: Stefan Kangas Date: Wed Mar 12 01:16:37 2025 +0100 lisp/emacs-lisp/track-changes.el: Make GNU ELPA release diff --git a/lisp/emacs-lisp/track-changes.el b/lisp/emacs-lisp/track-changes.el index c01d96ec6b8..bf899eebbe9 100644 --- a/lisp/emacs-lisp/track-changes.el +++ b/lisp/emacs-lisp/track-changes.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2024-2025 Free Software Foundation, Inc. ;; Author: Stefan Monnier -;; Version: 1.3 +;; Version: 1.4 ;; Package-Requires: ((emacs "24")) ;; This file is part of GNU Emacs. commit 523f7924570ae339a9661c910cc99c41676d7349 Author: Stefan Kangas Date: Wed Mar 12 01:15:07 2025 +0100 Unbreak track-changes in Emacs 24 * lisp/emacs-lisp/track-changes.el (track-changes--after): Don't use 'incf', added in Emacs 31; this :core package supports Emacs 24. diff --git a/lisp/emacs-lisp/track-changes.el b/lisp/emacs-lisp/track-changes.el index b0d753e1cbd..c01d96ec6b8 100644 --- a/lisp/emacs-lisp/track-changes.el +++ b/lisp/emacs-lisp/track-changes.el @@ -599,14 +599,14 @@ Details logged to `track-changes--error-log'") (track-changes--trace) (cl-assert track-changes--state) (let ((offset (- (- end beg) len))) - (incf track-changes--buffer-size offset) + (cl-incf track-changes--buffer-size offset) (if (and (eq track-changes--before-clean 'unset) (not track-changes--before-no)) ;; This can be a sign that a `before-change-functions' went missing, ;; or that we called `track-changes--clean-state' between ;; a `before-change-functions' and `after-change-functions'. (track-changes--before beg end) - (incf track-changes--before-end offset)) + (cl-incf track-changes--before-end offset)) (setq track-changes--before-clean nil) (if (not (or track-changes--before-no (save-restriction commit 77b7e2d37b2c68b73ad770ec680281c1f82d26f1 Author: Stefan Kangas Date: Wed Mar 12 00:04:50 2025 +0100 Automatically document when setopt is needed * lisp/help-fns.el (help--recommend-setopt): New function to automatically document the need to use `setopt` to set the values of any defcustoms with a `:set` property. (help-fns-describe-variable-functions): Add above new function to hook. * lisp/follow.el (follow-mode-prefix-key): * lisp/minibuffer.el (minibuffer-regexp-prompts): * lisp/register.el (register-use-preview): * lisp/savehist.el (savehist-autosave-interval): * lisp/saveplace.el (save-place-autosave-interval): * lisp/tab-bar.el (tab-bar-define-keys): * lisp/textmodes/text-mode.el (text-mode-ispell-word-completion): Delete now redundant text from docstrings. diff --git a/etc/NEWS b/etc/NEWS index 0c47d245bc0..468eca02d52 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -386,13 +386,22 @@ Setting this variable to a non-nil value reduces performance and leads to wrong results in some cases. We believe that it is no longer useful; please contact us if you still need it for some reason. +--- ** 'byte-compile-cond-use-jump-table' is now obsolete. + --- ** Modified settings for an enabled theme now apply immediately. Evaluating a custom-theme-set-faces or custom-theme-set-variables call for an enabled theme causes the settings to apply immediately, without a need to re-load the theme. +--- +** 'describe-variable' now automatically says if 'setopt' is needed. +If a user option has a defcustom :set function, users will normally need +to set it with 'setopt' for it to take an effect. If the docstring +doesn't already mention 'setopt', the 'describe-variable' command will +now add a note about this automatically. + * Editing Changes in Emacs 31.1 diff --git a/lisp/follow.el b/lisp/follow.el index 5364c02c7a9..91a4bec619b 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -230,10 +230,7 @@ After that, changing the prefix key requires manipulating keymaps." (make-obsolete-variable 'follow-mode-prefix 'follow-mode-prefix-key "31.1") (defcustom follow-mode-prefix-key (key-description follow-mode-prefix) - "Prefix key to use for follow commands in Follow mode. - -Setting this variable with `setq' has no effect; use either `setopt' -or `customize-option' to change its value." + "Prefix key to use for follow commands in Follow mode." :type 'string :set (lambda (symbol value) (defvar follow-mode-map) (defvar follow-mode-submap) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index cd01f973b03..5f02b4ae777 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -868,6 +868,19 @@ the C sources, too." (function-get function 'disabled)) (insert " This function is disabled.\n"))) +(add-hook 'help-fns-describe-variable-functions #'help--recommend-setopt) +(defun help--recommend-setopt (symbol) + ;; TODO: This would be better if added to the docstring itself, but I + ;; ran into `byte-compile-dynamic-docstring' and gave up. + (when (and (get symbol 'custom-set) + ;; Don't override manually written documentation. + (not (string-match (rx word-start "setopt" word-end) + (get symbol 'variable-documentation)))) + ;; FIXME: `princ` removes text properties added by s-c-k. + (princ (substitute-command-keys "\ +Setting this variable with `setq' has no effect; use either `setopt' +or \\[customize-option] to change its value.\n\n")))) + (defun help-fns--first-release-regexp (symbol) (let* ((name (symbol-name symbol)) (quoted (regexp-quote name))) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index b0ca0a2ece8..01aae53ece5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -5285,10 +5285,7 @@ and `blink-matching-paren' more user-friendly." "List of regular expressions that trigger `minibuffer-regexp-mode' features. The features of `minibuffer-regexp-mode' will be activated in a minibuffer interaction if and only if a prompt matching some regexp in this list -appears at the beginning of the minibuffer. - -Setting this variable directly with `setq' has no effect; instead, -either use \\[customize-option] interactively or use `setopt'." +appears at the beginning of the minibuffer." :type '(repeat (string :tag "Prompt")) :set (lambda (sym val) (set-default sym val) diff --git a/lisp/register.el b/lisp/register.el index a955cf96232..00f8caba67a 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -147,10 +147,7 @@ all; the preview buffer is still accessible with `help-char' (\\`C-h'). When set to `traditional' (the default), provide a more basic preview according to `register-preview-delay'; this preserves the traditional -behavior of Emacs 29 and before. - -Setting this variable with `setq' has no effect; use either `setopt' -or `customize-option' to change its value." +behavior of Emacs 29 and before." :type '(choice (const :tag "Use preview" t) (const :tag "Use preview and exit by pressing register name" insist) diff --git a/lisp/savehist.el b/lisp/savehist.el index 32985bac0e1..2a5ffb8c904 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -121,8 +121,7 @@ executes in under 5 ms on my system." (defcustom savehist-autosave-interval (* 5 60) "The interval between autosaves of minibuffer history. -If set to nil, disables timer-based autosaving. -Use `setopt' or Customize commands to set this option." +If set to nil, disables timer-based autosaving." :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds")) :set (lambda (sym val) diff --git a/lisp/saveplace.el b/lisp/saveplace.el index 0cb81ebaf55..65dbcf41be2 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el @@ -235,8 +235,7 @@ If `save-place-mode' is enabled, set the timer, otherwise cancel the timer." (defcustom save-place-autosave-interval nil "The interval between auto saves of buffer places. -If set to nil, disables timer-based auto saving. -Use `setopt' or Customize commands to set this option." +If set to nil, disables timer-based auto saving." :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds")) :version "31.1" diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index e7aa4841da0..e4c6ea5e02c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -109,9 +109,7 @@ conjunction with `tab-bar-select-tab-modifiers', which see. If \\='tab, define only TAB and SHIFT-TAB tab-selection key mappings. -If nil, do not define any key mappings. - -Customize this option, or use `setopt' to ensure it will take effect." +If nil, do not define any key mappings." :type '(choice (const :tag "All keys" t) (const :tag "Numeric tab selection keys" numeric) (const :tag "TAB and SHIFT-TAB selection keys" tab) diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 2d019f54aec..cfacb144e40 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -83,10 +83,7 @@ means that Text mode adds an Ispell word completion function to `completion-at-point-functions'. Any other non-nil value says to bind M-TAB directly to `ispell-complete-word' instead. If this is nil, Text mode neither binds M-TAB to `ispell-complete-word' -nor does it extend `completion-at-point-functions'. - -This user option only takes effect when you customize it in -Custom or with `setopt', not with `setq'." +nor does it extend `completion-at-point-functions'." :group 'text :type '(choice (const completion-at-point) boolean) :version "30.1" commit f4b20c3f768c4d833c304ace2a9cf0a028346fdb Author: Stefan Kangas Date: Tue Mar 11 23:46:15 2025 +0100 ; Delete commented out code in help-fns.el diff --git a/lisp/help-fns.el b/lisp/help-fns.el index bbc7700c49e..cd01f973b03 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -945,48 +945,6 @@ TYPE indicates the namespace and is `fun' or `var'." (when first (make-text-button first nil 'type 'help-news 'help-args place)))) -;; (defun help-fns--check-first-releases () -;; "Compare the old liberal regexp to the new more restrictive one." -;; (interactive) -;; (let* ((quoted nil) -;; (rx-fun (lambda (orig-fun symbol) -;; (if quoted -;; (funcall orig-fun symbol) -;; (format "\\_<%s\\_>" -;; (regexp-quote (symbol-name symbol)))))) -;; (count -;; (let ((count 0)) -;; (obarray-map (lambda (sym) -;; (when (or (fboundp sym) (boundp sym)) -;; (incf count))) -;; obarray) -;; count)) -;; (p (make-progress-reporter "Check first releases..." 0 count))) -;; (with-current-buffer (get-buffer-create "*Check-first-release*") -;; (unwind-protect -;; (progn -;; (advice-add 'help-fns--first-release-regexp :around rx-fun) -;; (erase-buffer) -;; (setq count 0) -;; (obarray-map -;; (lambda (sym) -;; (when (or (fboundp sym) (boundp sym)) -;; (incf count) -;; (progress-reporter-update p count) -;; (let ((vt (progn (setq quoted t) -;; (help-fns--first-release sym))) -;; (vnil (progn (setq quoted nil) -;; (help-fns--first-release sym)))) -;; (when (and vnil (not (equal vt vnil))) -;; (insert (symbol-name sym) -;; "\nnot-quoted: " (or vnil "nil") -;; "\nquoted: " (or vt "nil") -;; "\n\n"))))) -;; obarray) -;; (progress-reporter-done p)) -;; (advice-remove 'help-fns--first-release-regexp rx-fun)) -;; (display-buffer (current-buffer))))) - (add-hook 'help-fns-describe-function-functions #'help-fns--mention-first-function-release) (add-hook 'help-fns-describe-variable-functions commit 57f7d5f44a136c95958030b7920e5eca4b285309 Author: Stefan Kangas Date: Tue Mar 11 23:22:26 2025 +0100 Delete XEmacs compatibility kludge from follow.el * lisp/follow.el (follow-select-if-end-visible): Remove XEmacs compatibility kludge. diff --git a/lisp/follow.el b/lisp/follow.el index d54b504846f..5364c02c7a9 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -1,7 +1,6 @@ ;;; follow.el --- synchronize windows showing the same buffer -*- lexical-binding: t -*- -;; Copyright (C) 1995-1997, 1999, 2001-2025 Free Software Foundation, -;; Inc. +;; Copyright (C) 1995-2025 Free Software Foundation, Inc. ;; Author: Anders Lindgren ;; Maintainer: emacs-devel@gnu.org @@ -1098,13 +1097,9 @@ Return the selected window." (setq win-start-end (cdr win-start-end))) win)) -;; Lets select a window showing the end. Make sure we only select it if +;; Lets select a window showing the end. Make sure we only select it if ;; it wasn't just moved here. (I.e. M-> shall not unconditionally place ;; point in the selected window.) -;; -;; (Compatibility kludge: in Emacs `window-end' is equal to `point-max'; -;; in XEmacs, it is equal to `point-max + 1'. Should I really bother -;; checking `window-end' now when I check `end-of-buffer' explicitly?) (defun follow-select-if-end-visible (win-start-end) "Select and return a window, if end is visible in it." @@ -1115,10 +1110,7 @@ Return the selected window." ;; command. (if (and (eq (point-max) (nth 2 (car win-start-end))) (nth 3 (car win-start-end)) - ;; `window-end' might return nil. - (let ((end (window-end (car (car win-start-end))))) - (and end - (eq (point-max) (min (point-max) end))))) + (eq (point-max) (window-end (caar win-start-end)))) (progn (setq win (car (car win-start-end))) (select-window win))) commit 27b31ebeaf32de6aec2fefe2d6824e22a102de30 Author: Stefan Kangas Date: Tue Feb 25 02:58:09 2025 +0100 New user option follow-mode-prefix-key * lisp/follow.el (Commentary): Document modern keymap functions. (follow-mode-prefix): Make obsolete in favor of... (follow-mode-prefix-key): ...this new user option. Allow changing the prefix using `setopt`. (follow-mode-submap): New variable. (follow-mode-map): Define using defvar-keymap. diff --git a/etc/NEWS b/etc/NEWS index b6b290ebed8..0c47d245bc0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1438,6 +1438,12 @@ Display of tooltips on text-only terminals now happens after 'tooltip-delay' as it does on GUI terminals. To get back the old behavior, customize the value of 'tooltip-delay' to zero. +--- +*** New user option 'follow-mode-prefix-key'. +This user option replaces 'follow-mode-prefix', which had to be set +before loading Follow mode. This new option allows you to change the +prefix even after it was loaded, using 'customize-option' or 'setopt'. + --- *** cdl.el is now obsolete. Use 'shell-command' and 'shell-command-on-region' instead. diff --git a/lisp/follow.el b/lisp/follow.el index 21a48823c34..d54b504846f 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -75,7 +75,7 @@ ;; immediately below the end of the left-hand window. As long as ;; `follow-mode' is active, the two windows will follow each other! ;; -;; * Play around and enjoy! Scroll one window and watch the other. +;; * Play around and enjoy! Scroll one window and watch the other. ;; Jump to the beginning or end. Press `Cursor down' at the last ;; line of the left-hand window. Enter new lines into the ;; text. Enter long lines spanning several lines, or several @@ -90,11 +90,11 @@ ;; visible area of the current buffer. ;; ;; I recommend adding it, and `follow-mode', to hotkeys in the global -;; key map. To do so, add the following lines (replacing `[f7]' and -;; `[f8]' with your favorite keys) to the init file: +;; key map. To do so, add the following lines (replacing "" and +;; "" with your favorite keys) to your init file: ;; -;; (global-set-key [f8] #'follow-mode) -;; (global-set-key [f7] #'follow-delete-other-windows-and-split) +;; (keymap-global-set "" #'follow-mode) +;; (keymap-global-set "" #'follow-delete-other-windows-and-split) ;; There exist two system variables that control the appearance of @@ -104,8 +104,8 @@ ;; To make sure lines are never truncated, place the following lines ;; in your Init file: ;; -;; (setq truncate-lines nil) -;; (setq truncate-partial-width-windows nil) +;; (setopt truncate-lines nil) +;; (setopt truncate-partial-width-windows nil) ;; One way to configure Follow mode is to create one or more functions @@ -116,11 +116,9 @@ ;; `follow-mode'. ;; ;; Example: -;; (add-hook 'follow-mode-hook 'my-follow-mode-hook) -;; -;; (defun my-follow-mode-hook () -;; (define-key follow-mode-map "\C-ca" #'your-favorite-function) -;; (define-key follow-mode-map "\C-cb" #'another-function)) +;; (with-eval-after-load 'follow +;; (keymap-set follow-mode-map "C-c a" #'your-favorite-function) +;; (keymap-set follow-mode-map "C-c b" #'another-function)) ;; Usage: @@ -181,7 +179,7 @@ ;; be reactivated by hitting the same key again. ;; ;; Example from my ~/.emacs: -;; (global-set-key [f8] #'follow-mode) +;; (keymap-global-set "" #'follow-mode) ;; Implementation: ;; @@ -230,39 +228,54 @@ The value of this variable is checked as part of loading Follow mode. After that, changing the prefix key requires manipulating keymaps." :type 'string :group 'follow) +(make-obsolete-variable 'follow-mode-prefix 'follow-mode-prefix-key "31.1") + +(defcustom follow-mode-prefix-key (key-description follow-mode-prefix) + "Prefix key to use for follow commands in Follow mode. -(defvar follow-mode-map - (let ((mainmap (make-sparse-keymap)) - (map (make-sparse-keymap))) - (define-key map "\C-v" #'follow-scroll-up) - (define-key map "\M-v" #'follow-scroll-down) - (define-key map "v" #'follow-scroll-down) - (define-key map "1" #'follow-delete-other-windows-and-split) - (define-key map "b" #'follow-switch-to-buffer) - (define-key map "\C-b" #'follow-switch-to-buffer-all) - (define-key map "\C-l" #'follow-recenter) - (define-key map "<" #'follow-first-window) - (define-key map ">" #'follow-last-window) - (define-key map "n" #'follow-next-window) - (define-key map "p" #'follow-previous-window) - - (define-key mainmap follow-mode-prefix map) - - ;; Replace the standard `end-of-buffer', when in Follow mode. (I - ;; don't see the point in trying to replace every function that - ;; could be enhanced in Follow mode. End-of-buffer is a special - ;; case since it is very simple to define and it greatly enhances - ;; the look and feel of Follow mode.) - (define-key mainmap [remap end-of-buffer] #'follow-end-of-buffer) - - (define-key mainmap [remap scroll-bar-toolkit-scroll] #'follow-scroll-bar-toolkit-scroll) - (define-key mainmap [remap scroll-bar-drag] #'follow-scroll-bar-drag) - (define-key mainmap [remap scroll-bar-scroll-up] #'follow-scroll-bar-scroll-up) - (define-key mainmap [remap scroll-bar-scroll-down] #'follow-scroll-bar-scroll-down) - (define-key mainmap [remap mwheel-scroll] #'follow-mwheel-scroll) - - mainmap) - "Minor mode keymap for Follow mode.") +Setting this variable with `setq' has no effect; use either `setopt' +or `customize-option' to change its value." + :type 'string + :set (lambda (symbol value) + (defvar follow-mode-map) (defvar follow-mode-submap) + (keymap-unset follow-mode-map (symbol-value symbol)) + (keymap-set follow-mode-map value follow-mode-submap) + (set-default symbol value)) + :group 'follow + :version "31.1") + +(defun follow--prefix-key (key) + (concat follow-mode-prefix-key " " key)) + +(defvar-keymap follow-mode-submap + "C-v" #'follow-scroll-up + "M-v" #'follow-scroll-down + "v" #'follow-scroll-down + "1" #'follow-delete-other-windows-and-split + "b" #'follow-switch-to-buffer + "C-b" #'follow-switch-to-buffer-all + "C-l" #'follow-recenter + "<" #'follow-first-window + ">" #'follow-last-window + "n" #'follow-next-window + "p" #'follow-previous-window) + +(defvar-keymap follow-mode-map + :doc "Minor mode keymap for Follow mode." + follow-mode-prefix-key follow-mode-submap + + ;; Replace the standard `end-of-buffer' when in Follow mode. (I don't + ;; see the point in trying to replace every function that could be + ;; enhanced in Follow mode. End-of-buffer is a special case since it + ;; is very simple to define and it greatly enhances the look and feel + ;; of Follow mode.) + " " #'follow-end-of-buffer + + " " #'follow-scroll-bar-toolkit-scroll + " " #'follow-scroll-bar-drag + " " #'follow-scroll-bar-scroll-up + " " #'follow-scroll-bar-scroll-down + " " #'follow-mwheel-scroll) ;; When the mode is not activated, only one item is visible to activate ;; the mode. commit 40d8650d5177bd291747d225c7d2cf2b4ba55856 Author: Stefan Monnier Date: Tue Mar 11 17:10:30 2025 -0400 (Freplace_buffer_contents): Preserve markers more carefully Use `replace_range` rather than `delete+insert`. * src/insdel.c (replace_range): Allow NEW to specify a chunk of buffer text. * src/editfns.c (Freplace_buffer_contents): Use it. * test/src/editfns-tests.el (replace-buffer-contents-1): Remove incorrect check which happened to succeed because point was not preserved carefully enough. Make the replacement text share a bit more content to make the test a bit more strict. (editfns-tests--replace-region): Doesn't fail any more. diff --git a/src/editfns.c b/src/editfns.c index 0eeb8d4fb53..53d6cce7c82 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2050,9 +2050,10 @@ nil. */) if (early_abort) { - /* FIXME: Use 'replace_range'! */ - del_range (min_a, ZV); - Finsert_buffer_substring (source, Qnil,Qnil); + Lisp_Object src = CALLN (Fvector, source_buffer, + make_fixnum (BUF_BEGV (b)), + make_fixnum (BUF_ZV (b))); + replace_range (BEGV, ZV, src, true, false, false); SAFE_FREE_UNBIND_TO (count, Qnil); return Qnil; } @@ -2075,6 +2076,7 @@ nil. */) ptrdiff_t i = size_a; ptrdiff_t j = size_b; + Lisp_Object src = CALLN (Fvector, source_buffer, Qnil, Qnil); /* Walk backwards through the lists of changes. This was also cargo-culted from src/analyze.c in GNU Diffutils. Because we walk backwards, we don’t have to keep the positions in sync. */ @@ -2101,14 +2103,9 @@ nil. */) eassert (beg_b <= end_b); eassert (beg_a < end_a || beg_b < end_b); /* FIXME: Use 'replace_range'! */ - if (beg_a < end_a) - del_range (beg_a, end_a); - if (beg_b < end_b) - { - SET_PT (beg_a); - Finsert_buffer_substring (source, make_fixed_natnum (beg_b), - make_fixed_natnum (end_b)); - } + ASET (src, 1, make_fixed_natnum (beg_b)); + ASET (src, 2, make_fixed_natnum (end_b)); + replace_range (beg_a, end_a, src, true, false, false); } --i; --j; diff --git a/src/insdel.c b/src/insdel.c index 3617d2f0102..3707342d2c4 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1428,12 +1428,29 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, bool run_mod_hooks, bool inherit, bool adjust_match_data) { - ptrdiff_t inschars = SCHARS (new); - ptrdiff_t insbytes = SBYTES (new); + ptrdiff_t inschars; + ptrdiff_t insbeg; + struct buffer *insbuf; + if (STRINGP (new)) + { + insbuf = NULL; + insbeg = 0; + inschars = SCHARS (new); + } + else + { + CHECK_VECTOR (new); + /* Let `Faref' signal an error if it's too small. */ + Lisp_Object insend = Faref (new, make_fixnum (2)); + CHECK_BUFFER (AREF (new, 0)); + CHECK_FIXNUM (AREF (new, 1)); + CHECK_FIXNUM (insend); + insbuf = XBUFFER (AREF (new, 0)); + insbeg = XFIXNUM (AREF (new, 1)); + inschars = XFIXNUM (insend) - insbeg; + } ptrdiff_t from_byte, to_byte; ptrdiff_t nbytes_del, nchars_del; - INTERVAL intervals; - ptrdiff_t outgoing_insbytes = insbytes; Lisp_Object deletion; check_markers (); @@ -1459,17 +1476,51 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, nchars_del = to - from; nbytes_del = to_byte - from_byte; - if (nbytes_del <= 0 && insbytes == 0) + if (nbytes_del <= 0 && inschars == 0) return; + ptrdiff_t insbeg_bytes, insend_bytes; + ptrdiff_t insbytes; + unsigned char *insbeg_ptr; + bool new_is_multibyte; + if (!insbuf) + { + new_is_multibyte = STRING_MULTIBYTE (new); + insbytes = SBYTES (new); + insbeg_ptr = SDATA (new); + } + else + { + new_is_multibyte = !NILP (BVAR (insbuf, enable_multibyte_characters)); + ptrdiff_t insend = insbeg + inschars; + if (new_is_multibyte) + { + insbeg_bytes = buf_charpos_to_bytepos (insbuf, insbeg); + insend_bytes = buf_charpos_to_bytepos (insbuf, insend); + } + else + { + insbeg_bytes = insbeg; + insend_bytes = insend; + } + insbytes = insend_bytes - insbeg_bytes; + if (insbuf->text->gpt_byte > insbeg_bytes + && insbuf->text->gpt_byte < insend_bytes) + move_gap_both (insbeg, insbeg_bytes); + insbeg_ptr = BUF_BYTE_ADDRESS (insbuf, insbeg_bytes); + eassert (insbuf->text->gpt_byte <= insbeg_bytes + || insbuf->text->gpt_byte >= insend_bytes); + } + ptrdiff_t outgoing_insbytes = insbytes; + /* Make OUTGOING_INSBYTES describe the text as it will be inserted in this buffer. */ if (NILP (BVAR (current_buffer, enable_multibyte_characters))) outgoing_insbytes = inschars; - else if (! STRING_MULTIBYTE (new)) + else if (! new_is_multibyte) outgoing_insbytes - = count_size_as_multibyte (SDATA (new), insbytes); + = count_size_as_multibyte (insbeg_ptr, insbytes); /* Make sure the gap is somewhere in or next to what we are deleting. */ if (from > GPT) @@ -1504,8 +1555,8 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, /* Copy the string text into the buffer, perhaps converting between single-byte and multibyte. */ - copy_text (SDATA (new), GPT_ADDR, insbytes, - STRING_MULTIBYTE (new), + copy_text (insbeg_ptr, GPT_ADDR, insbytes, + new_is_multibyte, ! NILP (BVAR (current_buffer, enable_multibyte_characters))); #ifdef BYTE_COMBINING_DEBUG @@ -1548,7 +1599,10 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, /* Get the intervals for the part of the string we are inserting-- not including the combined-before bytes. */ - intervals = string_intervals (new); + INTERVAL intervals + = (!insbuf ? string_intervals (new) + : copy_intervals (buffer_intervals (insbuf), insbeg, inschars)); + /* Insert those intervals. */ graft_intervals_into_buffer (intervals, from, inschars, current_buffer, inherit); @@ -1571,7 +1625,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, CHARS_MODIFF = MODIFF; if (adjust_match_data) - update_search_regs (from, to, from + SCHARS (new)); + update_search_regs (from, to, from + inschars); if (run_mod_hooks) { diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 09af179a180..c3f825c6149 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -280,23 +280,25 @@ (ert-deftest replace-buffer-contents-1 () (with-temp-buffer - (insert #("source" 2 4 (prop 7))) + (insert #("source " 2 4 (prop 7))) (let ((source (current-buffer))) (with-temp-buffer (insert "before dest after") (let ((marker (set-marker (make-marker) 14))) (save-restriction - (narrow-to-region 8 12) - (replace-buffer-contents source)) + (narrow-to-region 8 13) + (goto-char 12) + (should (looking-at " \\'")) + (replace-buffer-contents source) + (should (looking-at " \\'"))) (should (equal (marker-buffer marker) (current-buffer))) (should (equal (marker-position marker) 16))) (should (equal-including-properties (buffer-string) - #("before source after" 9 11 (prop 7)))) - (should (equal (point) 9)))) + #("before source after" 9 11 (prop 7)))))) (should (equal-including-properties (buffer-string) - #("source" 2 4 (prop 7)))))) + #("source " 2 4 (prop 7)))))) (ert-deftest replace-buffer-contents-2 () (with-temp-buffer @@ -332,7 +334,7 @@ (replace-buffer-contents str-buf)))))))) (ert-deftest editfns-tests--replace-region () - :expected-result :failed + ;; :expected-result :failed (with-temp-buffer (insert "here is some text") (let ((m5n (copy-marker (+ (point-min) 5))) commit e1ceee716d7b0bb611317c455a2a49d4b0485469 Author: Stefan Kangas Date: Tue Mar 11 22:09:50 2025 +0100 ; Fix typo diff --git a/etc/NEWS b/etc/NEWS index f65a3cab6ec..b6b290ebed8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1823,7 +1823,7 @@ This function inserts the special EVENT into the input event queue. This event is sent when the device running Emacs enters or leaves the sleep state. -** Variable aliases obsolete since Emacs 23.2 have been removed: +** Function aliases obsolete since Emacs 23.2 have been removed: 'advertised-undo', 'advertised-widget-backward', and 'dired-advertised-find-file'. commit ceee1a0ae7a804fbd5307f99db4f81f3d427e40e Author: Stefan Kangas Date: Tue Mar 11 21:26:51 2025 +0100 ; Fix project-list-file on Emacs 26.1 * lisp/progmodes/project.el (project-list-file): Unbreak use of 'locate-user-emacs-file' on Emacs 26.1. Problem reported by Dmitry Gutov . diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 4eac541167a..d954b78a745 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1832,7 +1832,9 @@ Also see the `project-kill-buffers-display-buffer-list' variable." ;;; Project list (defcustom project-list-file - (locate-user-emacs-file '("projects.eld" "projects")) + (locate-user-emacs-file (if (>= emacs-major-version 31) + '("projects.eld" "projects") + "projects")) "File in which to save the list of known projects." :type 'file :version "31.1" commit b3d8e7ebb5dfb1eb9918d73571c996950026ead0 Author: Stefan Kangas Date: Tue Mar 11 03:36:22 2025 +0100 Use defvar-keymap for outline-mode-prefix-map * lisp/outline.el (outline-mode-prefix-map): Use defvar-keymap. diff --git a/lisp/outline.el b/lisp/outline.el index 1b0662fde51..0e5aff724aa 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -73,33 +73,31 @@ function should return non-nil, move point, and set match-data appropriately. When the argument LOOKING-AT is non-nil, it should imitate the function `looking-at'.") -(defvar outline-mode-prefix-map - (let ((map (make-sparse-keymap))) - (define-key map "@" 'outline-mark-subtree) - (define-key map "\C-n" 'outline-next-visible-heading) - (define-key map "\C-p" 'outline-previous-visible-heading) - (define-key map "\C-i" 'outline-show-children) - (define-key map "\C-s" 'outline-show-subtree) - (define-key map "\C-d" 'outline-hide-subtree) - (define-key map "\C-u" 'outline-up-heading) - (define-key map "\C-f" 'outline-forward-same-level) - (define-key map "\C-b" 'outline-backward-same-level) - (define-key map "\C-t" 'outline-hide-body) - (define-key map "\C-a" 'outline-show-all) - (define-key map "\C-c" 'outline-hide-entry) - (define-key map "\C-e" 'outline-show-entry) - (define-key map "\C-l" 'outline-hide-leaves) - (define-key map "\C-k" 'outline-show-branches) - (define-key map "\C-q" 'outline-hide-sublevels) - (define-key map "\C-o" 'outline-hide-other) - (define-key map "\C-^" 'outline-move-subtree-up) - (define-key map "\C-v" 'outline-move-subtree-down) - (keymap-set map "/ s" #'outline-show-by-heading-regexp) - (keymap-set map "/ h" #'outline-hide-by-heading-regexp) - (define-key map [(control ?<)] 'outline-promote) - (define-key map [(control ?>)] 'outline-demote) - (define-key map "\C-m" 'outline-insert-heading) - map)) +(defvar-keymap outline-mode-prefix-map + "@" #'outline-mark-subtree + "C-n" #'outline-next-visible-heading + "C-p" #'outline-previous-visible-heading + "C-i" #'outline-show-children + "C-s" #'outline-show-subtree + "C-d" #'outline-hide-subtree + "C-u" #'outline-up-heading + "C-f" #'outline-forward-same-level + "C-b" #'outline-backward-same-level + "C-t" #'outline-hide-body + "C-a" #'outline-show-all + "C-c" #'outline-hide-entry + "C-e" #'outline-show-entry + "C-l" #'outline-hide-leaves + "C-k" #'outline-show-branches + "C-q" #'outline-hide-sublevels + "C-o" #'outline-hide-other + "C-^" #'outline-move-subtree-up + "C-v" #'outline-move-subtree-down + "/ SPC s" #'outline-show-by-heading-regexp + "/ SPC h" #'outline-hide-by-heading-regexp + "C-<" #'outline-promote + "C->" #'outline-demote + "RET" #'outline-insert-heading) (defvar outline-mode-menu-bar-map (let ((map (make-sparse-keymap))) commit af851dd82e465a3e5e28065b35332ad35162beab Author: Stefan Kangas Date: Tue Mar 11 21:20:38 2025 +0100 Remove variable aliases obsolete since Emacs 23.2 * lisp/dired.el (dired-advertised-find-file): * lisp/simple.el (advertised-undo): * lisp/wid-edit.el (advertised-widget-backward): Remove variable aliases obsolete since Emacs 23.2. They are replaced by ':advertised-binding' properties. * lisp/arc-mode.el (archive-mode-map): * lisp/dired.el (dired-mode-map): * lisp/obsolete/landmark.el (landmark-mode-map): * lisp/play/decipher.el (decipher-mode-map): * lisp/play/gomoku.el (gomoku-mode-map): * lisp/proced.el (proced-mode-map): Don't bind above removed commands. diff --git a/etc/NEWS b/etc/NEWS index 01c522e1516..f65a3cab6ec 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1823,6 +1823,10 @@ This function inserts the special EVENT into the input event queue. This event is sent when the device running Emacs enters or leaves the sleep state. +** Variable aliases obsolete since Emacs 23.2 have been removed: +'advertised-undo', 'advertised-widget-backward', and +'dired-advertised-find-file'. + * Changes in Emacs 31.1 on Non-Free Operating Systems diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index d3f75090fab..28be1e9c617 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -444,7 +444,6 @@ be added." ;; Let mouse-1 follow the link. (define-key map [follow-link] 'mouse-face) - (define-key map [remap advertised-undo] #'archive-undo) (define-key map [remap undo] #'archive-undo) (define-key map [mouse-2] 'archive-extract) diff --git a/lisp/dired.el b/lisp/dired.el index aa766b6170e..24d76ae79be 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2439,7 +2439,6 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." "?" #'dired-summary "DEL" #'dired-unmark-backward " " #'dired-undo - " " #'dired-undo " " #'dired-vc-next-action ;; thumbnail manipulation (image-dired) "C-t d" #'image-dired-display-thumbs @@ -3026,9 +3025,6 @@ directory in another window." (concat "File no longer exists; type \\" "\\[revert-buffer] to update Dired buffer"))))))) -;; Force C-m keybinding rather than `f' or `e' in the mode doc: -(define-obsolete-function-alias 'dired-advertised-find-file - #'dired-find-file "23.2") (defun dired-find-file () "In Dired, visit the file or directory named on this line." (interactive nil dired-mode) diff --git a/lisp/emacs-lisp/float-sup.el b/lisp/emacs-lisp/float-sup.el index 7f8a4a78163..b5ee4e34dbb 100644 --- a/lisp/emacs-lisp/float-sup.el +++ b/lisp/emacs-lisp/float-sup.el @@ -30,7 +30,7 @@ (with-suppressed-warnings ((lexical pi)) (defconst pi float-pi "Obsolete since Emacs-23.3. Use `float-pi' instead.")) -(make-obsolete-variable 'pi 'float-pi "23.3") +(make-obsolete-variable 'pi 'float-pi "23.3") ; "28.1" (internal-make-var-non-special 'pi) (defconst float-e (exp 1) "The value of e (2.7182818...).") diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el index 84939934812..b94f0dc424e 100644 --- a/lisp/obsolete/landmark.el +++ b/lisp/obsolete/landmark.el @@ -206,7 +206,6 @@ (define-key map [remap beginning-of-line] #'landmark-beginning-of-line) (define-key map [remap end-of-line] #'landmark-end-of-line) (define-key map [remap undo] #'landmark-human-takes-back) - (define-key map [remap advertised-undo] #'landmark-human-takes-back) map) "Local keymap to use in Landmark mode.") diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el index ebcd50e736d..a35e7592feb 100644 --- a/lisp/play/decipher.el +++ b/lisp/play/decipher.el @@ -150,8 +150,7 @@ the tail of the list." "R" #'decipher-restore-checkpoint "U" #'decipher-undo "SPC" #'decipher-keypress - " " #'decipher-undo - " " #'decipher-undo) + " " #'decipher-undo) (let ((key ?a)) (while (<= key ?z) (keymap-set decipher-mode-map (char-to-string key) #'decipher-keypress) diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el index 798b0db78f0..0c309358631 100644 --- a/lisp/play/gomoku.el +++ b/lisp/play/gomoku.el @@ -153,8 +153,7 @@ SHOULD be at least 2 (MUST BE at least 1).") " " #'gomoku-move-down " " #'gomoku-beginning-of-line " " #'gomoku-end-of-line - " " #'gomoku-human-takes-back - " " #'gomoku-human-takes-back) + " " #'gomoku-human-takes-back) (defvar gomoku-emacs-won () diff --git a/lisp/proced.el b/lisp/proced.el index 7c605aaa192..51e6f3aca4d 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -655,7 +655,6 @@ Important: the match ends just after the marker.") "h" #'describe-mode "?" #'proced-help " " #'proced-undo - " " #'proced-undo ;; Additional keybindings are inherited from `special-mode-map' ) (put 'proced-mark :advertised-binding "m") diff --git a/lisp/simple.el b/lisp/simple.el index 1b7df13a2ac..e6a8e4c3b95 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3379,9 +3379,6 @@ the minibuffer contents." minibuffer-prompt-properties)))) -;Put this on C-x u, so we can force that rather than C-_ into startup msg -(define-obsolete-function-alias 'advertised-undo 'undo "23.2") - (defconst undo-equiv-table (make-hash-table :test 'eq :weakness t) "Table mapping redo records to the corresponding undo one. A redo record for an undo in region maps to `undo-in-region'. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index bc6479413a5..db241ca914a 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1094,12 +1094,6 @@ button end points." ;;; Keymap and Commands. -;; This alias exists only so that one can choose in doc-strings (e.g. -;; Custom-mode) which key-binding of widget-keymap one wants to refer to. -;; https://lists.gnu.org/r/emacs-devel/2008-11/msg00480.html -(define-obsolete-function-alias 'advertised-widget-backward - #'widget-backward "23.2") - ;;;###autoload (defvar widget-keymap (let ((map (make-sparse-keymap))) commit 96a704346a282fc2783e54de3d9c30cd8f9ce955 Author: Stefan Kangas Date: Tue Mar 11 21:18:24 2025 +0100 Don't recommend legacy keymap functions in documentation * doc/emacs/mule.texi (Input Methods): * doc/lispintro/emacs-lisp-intro.texi (Miscellaneous): * doc/lispref/text.texi (Clickable Text): * doc/misc/calc.texi (Defining Functions, Defining Simple Commands) (Customizing Calc): * doc/misc/efaq.texi (Matching parentheses, Modifying pull-down menus) (Deleting menus and menu options, Binding keys to commands) (Invalid prefix characters) (Terminal setup code works after Emacs has begun) (Backspace invokes help, Swapping keys, No Escape key) (Binding combinations of modifiers and function keys) (Replying to the sender of a message): * doc/misc/eudc.texi (Installation, Emacs-only Configuration) (External Configuration): * doc/misc/gnus.texi (Group Parameters, Misc Group Stuff) (Summary Buffer, Generic Marking Commands, RSS) (nnmairix tips and tricks, Oort Gnus): * doc/misc/ido.texi (Customization): * doc/misc/mairix-el.texi (Using): * doc/misc/mh-e.texi (HTML, Miscellaneous Commands and Options) (Folders, Composing): * doc/misc/octave-mode.texi (Running Octave from Within Emacs): * doc/misc/reftex.texi (Citations Outside LaTeX): * doc/misc/remember.texi (Quick Start): * doc/misc/sem-user.texi (Smart Jump): * doc/misc/viper.texi (Key Bindings, Vi Macros): * doc/misc/widget.texi (Defining New Widgets): * doc/misc/woman.texi (Word at point): Recommend 'keymap-set', 'keymap-global-set', 'keymap-global-unset', 'keymap-local-set', and 'key-translate', instead of their legacy equivalents. (Bug#55647) diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index 397315867e4..61734bd09d6 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -573,7 +573,7 @@ not when you are in the minibuffer). function that you add to the hook variable @code{quail-activate-hook}. @xref{Hooks}. For example, you can redefine some of the input method's keys by defining key bindings in the keymap returned by the -function @code{quail-translation-keymap}, using @code{define-key}. +function @code{quail-translation-keymap}, using @code{keymap-set}. @xref{Init Rebinding}. Input methods are inhibited when the text in the buffer is read-only diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 4317e399677..a3d08b17834 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -17873,10 +17873,10 @@ problem recently.) @smallexample @group ;; Translate 'C-h' to . -; (keyboard-translate ?\C-h ?\C-?) +; (key-translate "C-h" "C-?") ;; Translate to 'C-h'. -(keyboard-translate ?\C-? ?\C-h) +(key-translate "C-?" "C-h") @end group @end smallexample diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 90aa45e8501..18ed71fd1f5 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -4291,7 +4291,7 @@ bind it within the link text, using the @code{keymap} text property @example (let ((map (make-sparse-keymap))) - (define-key map [mouse-2] 'operate-this-button) + (keymap-set map "" 'operate-this-button) (put-text-property link-start link-end 'keymap map)) @end example diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 57bd16cc87d..61466b55201 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -32370,7 +32370,7 @@ has the advantage that it is quietly ignored if @code{calc-check-defines} is not yet defined because Calc has not yet been loaded. Examples of things that ought to be enclosed in a @code{calc-define} -property are @code{defmath} calls, @code{define-key} calls that modify +property are @code{defmath} calls, @code{keymap-set} calls that modify the Calc key map, and any calls that redefine things defined inside Calc. Ordinary @code{defun}s need not be enclosed with @code{calc-define}. @@ -32478,7 +32478,7 @@ there. @vindex calc-Y-help-msgs Calc reserves a special prefix key, shift-@kbd{Y}, for user-written extensions to Calc. There are no built-in commands that work with -this prefix key; you must call @code{define-key} from Lisp (probably +this prefix key; you must call @code{keymap-set} from Lisp (probably from inside a @code{calc-define} property) to add to it. Initially only @kbd{Y ?} is defined; it takes help messages from a list of strings (initially @code{nil}) in the variable @code{calc-Y-help-msgs}. All @@ -32512,9 +32512,9 @@ decreases the precision. (put 'calc-define 'inc-prec '(progn -(define-key calc-mode-map (format "Y%sI" inc-prec-base-key) +(keymap-set calc-mode-map (format "Y %s I" inc-prec-base-key) 'calc-increase-precision) -(define-key calc-mode-map (format "Y%sD" inc-prec-base-key) +(keymap-set calc-mode-map (format "Y %s D" inc-prec-base-key) 'calc-decrease-precision) (setq calc-Y-help-msgs @@ -35297,7 +35297,7 @@ The usual prefix for Calc is the key sequence @kbd{C-x *}. If you wish to use a different prefix, you can put @example -(global-set-key "NEWPREFIX" 'calc-dispatch) +(keymap-global-set "NEWPREFIX" 'calc-dispatch) @end example @noindent diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 32a83d3e774..22426c8bbd0 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -2622,7 +2622,7 @@ parenthesis, it simply inserts a % like normal. @lisp ;; By an unknown contributor -(global-set-key "%" 'match-paren) +(keymap-global-set "%" 'match-paren) (defun match-paren (arg) "Go to the matching paren if on a paren; otherwise insert %." @@ -3012,8 +3012,8 @@ new definition to the appropriate keymap. Adding a @samp{Forward Word} item to the @samp{Edit} menu thus requires the following Lisp code: @lisp -(define-key global-map - [menu-bar edit forward] +(keymap-set global-map + " " '("Forward word" . forward-word)) @end lisp @@ -3035,7 +3035,7 @@ To add a new menu, rather than a new option to an existing menu, we must define an entirely new keymap: @lisp -(define-key global-map [menu-bar words] +(keymap-set global-map " " (cons "Words" (make-sparse-keymap "Words"))) @end lisp @@ -3045,8 +3045,8 @@ The above code creates a new sparse keymap, gives it the name following code: @lisp -(define-key global-map - [menu-bar words forward] +(keymap-set global-map + " " '("Forward word" . forward-word)) @end lisp @@ -3057,26 +3057,26 @@ define menu options @samp{foo}, @samp{bar}, and @samp{baz} (in that order), the menu option @samp{baz} would appear at the top, and @samp{foo} would be at the bottom. -One way to avoid this problem is to use the function @code{define-key-after}, -which works the same as @code{define-key}, but lets you modify where items +One way to avoid this problem is to use the function @code{keymap-set-after}, +which works the same as @code{keymap-set}, but lets you modify where items appear. The following Lisp code would insert the @samp{Forward Word} item in the @samp{Edit} menu immediately following the @samp{Undo} item: @lisp -(define-key-after - (lookup-key global-map [menu-bar edit]) - [forward] +(keymap-set-after + (keymap-lookup global-map " ") + "" '("Forward word" . forward-word) 'undo) @end lisp -Note how the second and third arguments to @code{define-key-after} are -different from those of @code{define-key}, and that we have added a new +Note how the second and third arguments to @code{keymap-set-after} are +different from those of @code{keymap-set}, and that we have added a new (final) argument, the function after which our new key should be defined. To move a menu option from one position to another, simply evaluate -@code{define-key-after} with the appropriate final argument. +@code{keymap-set-after} with the appropriate final argument. More detailed information---and more examples of how to create and modify menu options---are in the @cite{Emacs Lisp Reference Manual}, under @@ -3093,7 +3093,7 @@ For example, to delete the @samp{Words} menu (@pxref{Modifying pull-down menus}), use: @lisp -(define-key global-map [menu-bar words] nil) +(keymap-set global-map " " nil) @end lisp Similarly, removing a menu option requires redefining a keymap entry to @@ -3102,7 +3102,7 @@ from the @samp{Edit} menu (we added it in @ref{Modifying pull-down menus}), use: @lisp -(define-key global-map [menu-bar edit forward] nil) +(keymap-set global-map " " nil) @end lisp @node Turning on syntax highlighting @@ -4083,11 +4083,11 @@ information is available from Keys can be bound to commands either interactively or in your init file (@pxref{Setting up a customization file}). To interactively bind -keys for all modes, type @kbd{M-x global-set-key @key{RET} @var{key} +keys for all modes, type @kbd{M-x keymap-global-set @key{RET} @var{key} @var{cmd} @key{RET}}. To bind a key just in the current major mode, type @kbd{M-x -local-set-key @key{RET} @var{key} @var{cmd} @key{RET}}. +keymap-local-set @key{RET} @var{key} @var{cmd} @key{RET}}. @xref{Key Bindings,,, emacs, The GNU Emacs Manual}. @@ -4099,7 +4099,7 @@ init file. If the key binding is global, no changes to the command are required. For example, @lisp -(global-set-key [f1] 'help-for-help) +(keymap-global-set "" 'help-for-help) @end lisp @noindent @@ -4110,7 +4110,7 @@ function. For example, in TeX mode, a local binding might be @lisp (add-hook 'tex-mode-hook (lambda () - (local-set-key [f1] 'help-for-help))) + (keymap-local-set "" 'help-for-help))) @end lisp @@ -4128,8 +4128,8 @@ bound as a complete key, then you must unbind it before the new binding. For example, if @kbd{ESC @{} is previously bound: @lisp -(global-unset-key [?\e ?@{]) ;; or -(local-unset-key [?\e ?@{]) +(keymap-global-unset "M-@{") ;; or +(keymap-local-unset "M-@{") @end lisp @item @@ -4137,8 +4137,8 @@ Aside from commands and ``lambda lists,'' a vector or string also can be bound to a key and thus treated as a macro. For example: @lisp -(global-set-key [f10] [?\C-x?\e?\e?\C-a?\C-k?\C-g]) ;; or -(global-set-key [f10] "\C-x\e\e\C-a\C-k\C-g") +(keymap-global-set "" [?\C-x?\e?\e?\C-a?\C-k?\C-g]) ;; or +(keymap-global-set "" "\C-x\e\e\C-a\C-k\C-g") @end lisp @end itemize @@ -4154,12 +4154,11 @@ character in the key sequence has been misspecified (e.g., @samp{C-f} used instead of @samp{\C-f} within a Lisp expression). In the other case, a @dfn{prefix key} in the keystroke sequence you were trying to bind was already bound as a @dfn{complete key}. Historically, the @samp{ESC [} -prefix was usually the problem, in which case you should evaluate either -of these forms before attempting to bind the key sequence: +prefix was usually the problem, in which case you should evaluate this +form before attempting to bind the key sequence: @lisp -(global-unset-key [?\e ?[]) ;; or -(global-unset-key "\e[") +(keymap-global-unset "M-[") @end lisp @node Terminal setup code works after Emacs has begun @@ -4183,7 +4182,7 @@ newer). For example, (lambda () (when (string-match "\\`vt220" (or (getenv "TERM") "")) ;; Make vt220's "Do" key behave like M-x: - (global-set-key [do] 'execute-extended-command)))) + (keymap-global-set "" 'execute-extended-command)))) @end lisp For information on what Emacs does every time it is started, see the @@ -4280,7 +4279,7 @@ It is possible to swap the @key{Backspace} and @key{DEL} keys inside Emacs: @lisp -(keyboard-translate ?\C-h ?\C-?) +(key-translate "C-h" "C-?") @end lisp @noindent @@ -4292,20 +4291,20 @@ Similarly, you could remap @key{DEL} to act as @kbd{C-d}, which by default deletes forward: @lisp -(keyboard-translate ?\C-? ?\C-d) +(key-translate "C-?" "C-d") @end lisp -@xref{Swapping keys}, for further details about @code{keyboard-translate}. +@xref{Swapping keys}, for further details about @code{key-translate}. @item Another approach is to switch key bindings and put help on @kbd{C-x h} instead: @lisp -(global-set-key "\C-h" 'delete-backward-char) +(keymap-global-set "C-h" 'delete-backward-char) ;; overrides mark-whole-buffer -(global-set-key "\C-xh" 'help-command) +(keymap-global-set "C-x h" 'help-command) @end lisp @noindent @@ -4313,7 +4312,7 @@ This method is not recommended, though: it only solves the problem for those modes which bind @key{DEL} to @code{delete-backward-char}. Modes which bind @key{DEL} to something else, such as @code{view-mode}, will not work as you expect when you press the @key{Backspace} key. For this -reason, we recommend the @code{keyboard-translate} method, shown +reason, we recommend the @code{key-translate} method, shown above. Other popular key bindings for help are @kbd{M-?} and @kbd{C-x ?}. @@ -4336,15 +4335,15 @@ Manual}. @section How do I swap two keys? @cindex Swapping keys @cindex Keys, swapping -@cindex @code{keyboard-translate} +@cindex @code{key-translate} You can swap two keys (or key sequences) by using the -@code{keyboard-translate} function. For example, to turn @kbd{C-h} +@code{key-translate} function. For example, to turn @kbd{C-h} into @key{DEL} and @key{DEL} to @kbd{C-h}, use @lisp -(keyboard-translate ?\C-h ?\C-?) ; translate 'C-h' to DEL -(keyboard-translate ?\C-? ?\C-h) ; translate DEL to 'C-h'. +(key-translate "C-h" "C-?") ; translate 'C-h' to DEL +(key-translate "C-?" "C-h") ; translate DEL to 'C-h'. @end lisp @noindent @@ -4354,7 +4353,7 @@ keymaps. However, in the specific case of @kbd{C-h} and @key{DEL}, you should toggle @code{normal-erase-is-backspace-mode} instead of calling -@code{keyboard-translate}. +@code{key-translate}. @xref{DEL Does Not Delete,,, emacs, The GNU Emacs Manual}. Keyboard translations are not the same as key bindings in keymaps. @@ -4426,7 +4425,7 @@ generates @key{ESC}. If not, the following form can be used to bind it: @lisp ;; F11 is the documented ESC replacement on DEC terminals. -(define-key function-key-map [f11] [?\e]) +(keymap-set function-key-map "" [?\e]) @end lisp @node Compose Character @@ -4450,7 +4449,7 @@ prefixes to the function key symbol. For example (from the Emacs documentation): @lisp -(global-set-key [?\C-x right] 'forward-page) +(keymap-global-set "C-x " 'forward-page) @end lisp @noindent @@ -4463,7 +4462,7 @@ represent these modifiers, prepend the strings @samp{C-}, @samp{M-}, is how to make @kbd{H-M-RIGHT} move forward a word: @lisp -(global-set-key [H-M-right] 'forward-word) +(keymap-global-set "H-M-" 'forward-word) @end lisp @itemize @bullet @@ -4821,8 +4820,8 @@ best fix I've been able to come up with: (add-hook 'rmail-mode-hook (lambda () - (define-key rmail-mode-map "r" 'rmail-reply-t) - (define-key rmail-mode-map "R" 'rmail-reply))) + (keymap-set rmail-mode-map "r" 'rmail-reply-t) + (keymap-set rmail-mode-map "R" 'rmail-reply))) @end lisp @node Automatically starting a mail or news reader diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi index 892c4ca605b..d7a31bf7b09 100644 --- a/doc/misc/eudc.texi +++ b/doc/misc/eudc.texi @@ -257,9 +257,9 @@ email composition buffers (@pxref{Inline Query Expansion}) @lisp (with-eval-after-load "message" - (define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-try-all)) + (keymap-set message-mode-map "C-c " 'eudc-expand-try-all)) (with-eval-after-load "sendmail" - (define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-try-all)) + (keymap-set mail-mode-map "C-c " 'eudc-expand-try-all)) @end lisp @menu @@ -355,7 +355,7 @@ LDAP: @vindex ldap-host-parameters-alist @lisp (with-eval-after-load "message" - (define-key message-mode-map (kbd "TAB") 'eudc-expand-try-all)) + (keymap-set message-mode-map "TAB" 'eudc-expand-try-all)) (setopt eudc-server-hotlist '(("" . bbdb) ("ldaps://ldap.gnu.org" . ldap))) @@ -412,7 +412,7 @@ configure EUDC for LDAP: @vindex ldap-host-parameters-alist @lisp (with-eval-after-load "message" - (define-key message-mode-map (kbd "TAB") 'eudc-expand-try-all)) + (keymap-set message-mode-map "TAB" 'eudc-expand-try-all)) (setopt eudc-server-hotlist '(("" . bbdb) ("ldaps://ldap.gnu.org" . ldap))) @@ -442,7 +442,7 @@ and the @file{.emacs} expressions become: @vindex ldap-host-parameters-alist @lisp (with-eval-after-load "message" - (define-key message-mode-map (kbd "TAB") 'eudc-expand-try-all)) + (keymap-set message-mode-map "TAB" 'eudc-expand-try-all)) (setopt eudc-server-hotlist '(("" . bbdb) ("" . ldap))) (setopt ldap-host-parameters-alist diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index a239a8a628b..7624f1831cc 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -3311,7 +3311,7 @@ following is added to a group parameter @lisp (gnus-summary-prepared-hook - (lambda nil (local-set-key "d" (local-key-binding "n")))) + (lambda nil (keymap-local-set "d" (local-key-binding "n")))) @end lisp when the group is entered, the 'd' key will not mark the article as @@ -4529,7 +4529,7 @@ The key @kbd{v} is reserved for users. You can bind it to some command or better use it as a prefix key. For example: @lisp -(define-key gnus-group-mode-map (kbd "v j d") +(keymap-set gnus-group-mode-map "v j d" (lambda () (interactive) (gnus-group-jump-to-group "nndraft:drafts"))) @@ -4882,7 +4882,7 @@ customize-apropos @key{RET} gnus-summary-tool-bar}. The key @kbd{v} is reserved for users. You can bind it to some command or better use it as a prefix key. For example: @lisp -(define-key gnus-summary-mode-map (kbd "v -") "LrS") ;; lower subthread +(keymap-set gnus-summary-mode-map "v -" "LrS") ;; lower subthread @end lisp @menu @@ -6654,7 +6654,7 @@ article, you could say something like: @group (add-hook 'gnus-summary-mode-hook 'my-alter-summary-map) (defun my-alter-summary-map () - (local-set-key "!" 'gnus-summary-put-mark-as-ticked-next)) + (keymap-local-set "!" 'gnus-summary-put-mark-as-ticked-next)) @end group @end lisp @@ -6663,7 +6663,7 @@ or @lisp (defun my-alter-summary-map () - (local-set-key "!" "MM!n")) + (keymap-local-set "!" "MM!n")) @end lisp @@ -17485,8 +17485,7 @@ summary buffer. (gnus-summary-scroll-up arg)))) (with-eval-after-load "gnus" - (define-key gnus-summary-mode-map - (kbd "") 'browse-nnrss-url)) + (keymap-set gnus-summary-mode-map "RET" 'browse-nnrss-url)) (add-to-list 'nnmail-extra-headers nnrss-url-field) @end lisp @@ -22498,7 +22497,7 @@ I use the following to check for mails: (nnmairix-update-groups "mairixsearch" t t) (gnus-group-list-groups)) -(define-key gnus-group-mode-map "g" 'my-check-mail-mairix-update) +(keymap-set gnus-group-mode-map "g" 'my-check-mail-mairix-update) @end lisp Instead of @samp{"mairixsearch"} use the name of your @code{nnmairix} @@ -28524,8 +28523,7 @@ enjoy the power of @acronym{MML}. The line below enables BBDB in resending a message: @lisp -(define-key message-minibuffer-local-map [(tab)] - 'bbdb-complete-name) +(keymap-set message-minibuffer-local-map "TAB" 'bbdb-complete-name) @end lisp @item diff --git a/doc/misc/ido.texi b/doc/misc/ido.texi index e8b2f78a854..a5abbf5633c 100644 --- a/doc/misc/ido.texi +++ b/doc/misc/ido.texi @@ -483,7 +483,7 @@ To modify the key bindings, use the @code{ido-setup-hook}. For example: (defun ido-my-keys () "Add my key bindings for Ido." - (define-key ido-completion-map " " 'ido-next-match)) + (keymap-set ido-completion-map "SPC" 'ido-next-match)) @end example @c @defopt ido-setup-hook diff --git a/doc/misc/mairix-el.texi b/doc/misc/mairix-el.texi index 0cdd014902d..286511a7283 100644 --- a/doc/misc/mairix-el.texi +++ b/doc/misc/mairix-el.texi @@ -199,15 +199,15 @@ might or might not collide with some other modes. Simply include them in your @file{.emacs} and adapt to your needs: @lisp -(global-set-key (kbd "C-c C-o m") 'mairix-search) -(global-set-key (kbd "C-c C-o w") 'mairix-widget-search) -(global-set-key (kbd "C-c C-o u") 'mairix-update-database) -(global-set-key (kbd "C-c C-o f") 'mairix-search-from-this-article) -(global-set-key (kbd "C-c C-o t") 'mairix-search-thread-this-article) -(global-set-key (kbd "C-c C-o b") 'mairix-widget-search-based-on-article) -(global-set-key (kbd "C-c C-o s") 'mairix-save-search) -(global-set-key (kbd "C-c C-o i") 'mairix-use-saved-search) -(global-set-key (kbd "C-c C-o e") 'mairix-edit-saved-searches) +(keymap-global-set "C-c C-o m" 'mairix-search) +(keymap-global-set "C-c C-o w" 'mairix-widget-search) +(keymap-global-set "C-c C-o u" 'mairix-update-database) +(keymap-global-set "C-c C-o f" 'mairix-search-from-this-article) +(keymap-global-set "C-c C-o t" 'mairix-search-thread-this-article) +(keymap-global-set "C-c C-o b" 'mairix-widget-search-based-on-article) +(keymap-global-set "C-c C-o s" 'mairix-save-search) +(keymap-global-set "C-c C-o i" 'mairix-use-saved-search) +(keymap-global-set "C-c C-o e" 'mairix-edit-saved-searches) @end lisp Here's a description of the available interactive functions: diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi index dbe744b44c5..cd11e6dc228 100644 --- a/doc/misc/mh-e.texi +++ b/doc/misc/mh-e.texi @@ -2646,7 +2646,7 @@ browser when clicked with @kbd{S-mouse-2}. This binding works in any buffer, including HTML buffers. @smalllisp -(global-set-key [S-mouse-2] 'browse-url-at-mouse) +(keymap-global-set "S-" 'browse-url-at-mouse) @end smalllisp @node Digests @@ -3112,7 +3112,7 @@ electric-buffer-list} to see what I mean. Before we leave this section, I'll include a function that I use as a front end to MH-E@footnote{Stephen Gildea's favorite binding is -@kbd{(global-set-key "\C-cr" 'mh-rmail)}.}. It toggles between your +@kbd{(keymap-global-set "C-c r" 'mh-rmail)}.}. It toggles between your working window configuration, which may be quite involved---windows filled with source, compilation output, man pages, and other documentation---and your MH-E window configuration. Like the rest of @@ -3153,7 +3153,7 @@ when going into mail." (set-window-configuration my-normal-screen) nil)))) ; @r{set my-mh-screen-saved to nil} -(global-set-key "\C-x\r" 'my-mh-rmail) ;@r{ call with C-x @key{RET}} +(keymap-global-set "C-x RET" 'my-mh-rmail) ;@r{ call with C-x @key{RET}} @i{Starting MH-E} @@ -3447,11 +3447,10 @@ bindings, for example: (defun my-mh-folder-mode-hook () "Hook to set key bindings in MH-Folder mode." - (if (not my-mh-init-done) ; @r{only need to bind the keys once } - (progn - (local-set-key "//" 'my-search-msg) - (local-set-key "b" 'mh-burst-digest) ; @r{better use of @kbd{b}} - (setq my-mh-init-done t)))) + (unless my-mh-init-done ; @r{only need to bind the keys once } + (keymap-local-set "/ /" 'my-search-msg) + (keymap-local-set "b" 'mh-burst-digest) ; @r{better use of @kbd{b}} + (setq my-mh-init-done t))) (add-hook 'mh-folder-mode-hook 'my-mh-folder-mode-hook) @@ -3983,8 +3982,8 @@ you would rather preserve the window layout. You may find adding the following key bindings to @file{~/.emacs} useful: @smalllisp -(global-set-key "\C-xm" 'mh-smail) -(global-set-key "\C-x4m" 'mh-smail-other-window) +(keymap-global-set "C-x m" 'mh-smail) +(keymap-global-set "C-x 4 m" 'mh-smail-other-window) @end smalllisp @cindex draft folder @@ -4054,13 +4053,13 @@ this hook. (defun my-mh-letter-mode-hook () "Prepare letter for editing." (when (not letter-mode-init-done) ; @r{only need to bind the keys once} - (local-set-key "\C-ctb" 'add-enriched-text) - (local-set-key "\C-cti" 'add-enriched-text) - (local-set-key "\C-ctf" 'add-enriched-text) - (local-set-key "\C-cts" 'add-enriched-text) - (local-set-key "\C-ctB" 'add-enriched-text) - (local-set-key "\C-ctu" 'add-enriched-text) - (local-set-key "\C-ctc" 'add-enriched-text) + (keymap-local-set "C-c t b" 'add-enriched-text) + (keymap-local-set "C-c t i" 'add-enriched-text) + (keymap-local-set "C-c t f" 'add-enriched-text) + (keymap-local-set "C-c t s" 'add-enriched-text) + (keymap-local-set "C-c t B" 'add-enriched-text) + (keymap-local-set "C-c t u" 'add-enriched-text) + (keymap-local-set "C-c t c" 'add-enriched-text) (setq letter-mode-init-done t)) (save-excursion (goto-char (point-max)) ; @r{go to end of message to} diff --git a/doc/misc/octave-mode.texi b/doc/misc/octave-mode.texi index 9c3462d93f1..6d9472c7b1b 100644 --- a/doc/misc/octave-mode.texi +++ b/doc/misc/octave-mode.texi @@ -374,9 +374,9 @@ add @lisp (add-hook 'inferior-octave-mode-hook (lambda () - (define-key inferior-octave-mode-map [up] + (keymap-set inferior-octave-mode-map "" 'comint-previous-input) - (define-key inferior-octave-mode-map [down] + (keymap-set inferior-octave-mode-map "" 'comint-next-input))) @end lisp @noindent diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi index 56d3bbb655f..8c7739b00f2 100644 --- a/doc/misc/reftex.texi +++ b/doc/misc/reftex.texi @@ -2050,7 +2050,7 @@ binding for @code{reftex-cite-format}. @lisp (add-hook 'mail-setup-hook - (lambda () (define-key mail-mode-map "\C-c[" + (lambda () (keymap-set mail-mode-map "C-c [" (lambda () (interactive) (let ((reftex-cite-format 'locally)) diff --git a/doc/misc/remember.texi b/doc/misc/remember.texi index e9f9d3c7fc4..a9fcf6e6d48 100644 --- a/doc/misc/remember.texi +++ b/doc/misc/remember.texi @@ -211,8 +211,8 @@ Here is one way to map the remember functions in your init file Manual}) to very accessible keystrokes facilities using the mode: @lisp -(define-key global-map (kbd " r") 'remember) -(define-key global-map (kbd " R") 'remember-region) +(keymap-set global-map " r" 'remember) +(keymap-set global-map " R" 'remember-region) @end lisp @cindex annotation diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi index c06cf71130d..cb3238e377e 100644 --- a/doc/misc/sem-user.texi +++ b/doc/misc/sem-user.texi @@ -870,7 +870,7 @@ event @var{event}. This command is meant to be bound to a mouse command, like this: @example -(global-set-key '[(S-mouse-1)] semantic-ia-fast-mouse-jump) +(keymap-global-set "S-" 'semantic-ia-fast-mouse-jump) @end example @end defun diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index 8079d1d0472..6932d29c296 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -1968,8 +1968,8 @@ Under the X Window System, every keyboard key emits its preferred form, so you can just type @lisp -(global-set-key [f11] 'calendar) ; L1, Stop -(global-set-key [f14] 'undo) ; L4, Undo +(keymap-global-set "" 'calendar) ; L1, Stop +(keymap-global-set "" 'undo) ; L4, Undo @end lisp @noindent @@ -2885,7 +2885,7 @@ the standard Emacs mechanism for binding function keys to commands. For instance, @example -(global-set-key [f13] 'repeat-complex-command) +(keymap-global-set "" 'repeat-complex-command) @end example @noindent @@ -2932,7 +2932,7 @@ say, @kbd{f12 \3} like this: Note that even though the macro uses the function key @kbd{f12}, the key is actually free and can still be bound to some Emacs function via -@code{define-key} or @code{global-set-key}. +@code{define-key} or @code{keymap-global-set}. Viper allows the user to define macro names that are prefixes of other macros. diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi index f84e81bce77..864489726c8 100644 --- a/doc/misc/widget.texi +++ b/doc/misc/widget.texi @@ -3088,8 +3088,8 @@ Example: @group (defvar widget-ranged-integer-map (let ((map (copy-keymap widget-keymap))) - (define-key map [up] #'widget-ranged-integer-increase) - (define-key map [down] #'widget-ranged-integer-decrease) + (keymap-set map "" #'widget-ranged-integer-increase) + (keymap-set map "" #'widget-ranged-integer-decrease) map)) @end group diff --git a/doc/misc/woman.texi b/doc/misc/woman.texi index ce0949793d7..a0af654d002 100644 --- a/doc/misc/woman.texi +++ b/doc/misc/woman.texi @@ -473,11 +473,11 @@ e.g., this key binding for @kbd{C-c w} runs WoMan on the topic at point without seeking confirmation: @lisp -(global-set-key "\C-cw" - (lambda () - (interactive) - (let ((woman-use-topic-at-point t)) - (woman)))) +(keymap-global-set "C-c w" + (lambda () + (interactive) + (let ((woman-use-topic-at-point t)) + (woman)))) @end lisp commit 0c8d30045bd92a908c0cf2067615fc1b2fbcc33d Author: Michael Heerdegen Date: Wed Mar 5 16:09:30 2025 +0100 Fix overlay-start and overlay-end gv setters This fixes Bug#76730. * lisp/emacs-lisp/gv.el (overlay-start, overlay-end): Avoid computing the set value twice. diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index b2390d65817..8e69c8d0447 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -400,9 +400,11 @@ See also `incf'." (gv-define-simple-setter match-data set-match-data 'fix) (gv-define-simple-setter overlay-get overlay-put) (gv-define-setter overlay-start (store ov) - `(progn (move-overlay ,ov ,store (overlay-end ,ov)) ,store)) + (macroexp-let2 nil store store + `(progn (move-overlay ,ov ,store (overlay-end ,ov)) ,store))) (gv-define-setter overlay-end (store ov) - `(progn (move-overlay ,ov (overlay-start ,ov) ,store) ,store)) + (macroexp-let2 nil store store + `(progn (move-overlay ,ov (overlay-start ,ov) ,store) ,store))) (gv-define-simple-setter process-buffer set-process-buffer) (gv-define-simple-setter process-filter set-process-filter) (gv-define-simple-setter process-sentinel set-process-sentinel) commit b741023070e6cfb03a178cab0f6818244af1b0e2 Author: Juri Linkov Date: Tue Mar 11 20:18:24 2025 +0200 Adapt treesit-outline-search to the recent improvements (bug#76398) * lisp/treesit.el (treesit-closest-parser-boundary): Remove temporary function. (treesit-outline-search): Use 'previous/next-single-char-property-change' with 'treesit-parser' property to find the closest parser boundary. (treesit-outline-level): Get the 'treesit-host-parser' overlay and find the parent parser node with 'treesit-node-at'. diff --git a/lisp/treesit.el b/lisp/treesit.el index 319dc5a41fc..26a3d2f7a41 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3945,18 +3945,6 @@ this variable takes priority.") (or (and current-valid current) (and next-valid (treesit-thing-at next pred))))) -(defun treesit-closest-parser-boundary (pos backward) - "Get the closest boundary of a local parser." - (when-let* ((ranges (mapcar #'treesit-parser-included-ranges - (treesit-parser-list))) - (ranges (delq nil (delete '((1 . 1)) ranges))) - (bounds (seq-filter - (lambda (p) (if backward (< p pos) (> p pos))) - (flatten-list ranges))) - (closest (when bounds - (if backward (seq-max bounds) (seq-min bounds))))) - closest)) - (defun treesit-outline-search (&optional bound move backward looking-at recursive) "Search for the next outline heading in the syntax tree. For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in @@ -3982,10 +3970,15 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in treesit-outline-predicate)) (found (or bob-pos (treesit-navigate-thing pos (if backward -1 1) 'beg pred))) - (closest (treesit-closest-parser-boundary pos backward))) + (closest (unless bob-pos + (if backward + (previous-single-char-property-change pos 'treesit-parser) + (next-single-char-property-change pos 'treesit-parser))))) ;; Handle multi-language modes - (if (and closest (not recursive) + (if (and closest + (not (eq closest (if backward (point-min) (point-max)))) + (not recursive) (or ;; Possibly was inside the local parser, and when can't find ;; more matches inside it then need to go over the closest @@ -4018,21 +4011,21 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in "Return the depth of the current outline heading." (let* ((node (treesit-outline--at-point)) (level 1) - (parser (when (and treesit-aggregated-outline-predicate node) - (treesit-node-parser node))) (pred (if treesit-aggregated-outline-predicate (alist-get (treesit-language-at (point)) treesit-aggregated-outline-predicate) treesit-outline-predicate))) (while (setq node (treesit-parent-until node pred)) (setq level (1+ level))) - (when-let* ((_ (and parser (not (eq parser treesit-primary-parser)))) - (guest-root-node (treesit-parser-root-node parser)) - (host-lang (treesit-parser-language treesit-primary-parser)) - (host-pred (alist-get host-lang treesit-aggregated-outline-predicate))) - ;; Continue from the host node that contains the guest parser. - (setq node (treesit-node-at (- (treesit-node-start guest-root-node) 2))) - (while (setq node (treesit-parent-until node host-pred)) + ;; Continue counting from the host node. + (when-let* ((parser + (when treesit-aggregated-outline-predicate + (seq-some (lambda (o) (overlay-get o 'treesit-host-parser)) + (overlays-at (point))))) + (node (treesit-node-at (point) parser)) + (lang (treesit-parser-language parser)) + (pred (alist-get lang treesit-aggregated-outline-predicate))) + (while (setq node (treesit-parent-until node pred)) (setq level (1+ level)))) level)) commit ef79c8cf3d63f510107536901925c05e37740275 Author: Thierry Volpiatto Date: Sun Mar 9 16:08:41 2025 +0100 New user variable `exchange-point-and-mark-highlight-region` When set to nil, this modifies `exchange-point-and-mark' so that it doesn't activate mark when it is not already active. * etc/NEWS: Introduce new variable exchange-point-and-mark-highlight-region. * lisp/simple.el (exchange-point-and-mark-highlight-region): New. (exchange-point-and-mark): Use it. diff --git a/etc/NEWS b/etc/NEWS index 926d426eaae..01c522e1516 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -473,6 +473,11 @@ useful for enabling or disabling the features of 'delete-selection-mode' based on the state of the buffer, such as for the different states of modal editing packages. +** New user variable 'exchange-point-and-mark-highlight-region'. +When set to nil, this modifies `exchange-point-and-mark' so that it doesn't +activate mark when it is not already active. +The default value is 't' which changes nothing to previous behavior. + * Changes in Specialized Modes and Packages in Emacs 31.1 diff --git a/lisp/simple.el b/lisp/simple.el index 32479f3c092..1b7df13a2ac 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7456,10 +7456,20 @@ Does not set point. Does nothing if mark ring is empty." (pop mark-ring)) (deactivate-mark)) +(defcustom exchange-point-and-mark-highlight-region t + "Activate region when exchanging point and mark. + +When set to nil, this modifies `exchange-point-and-mark' so that it doesn't +activate mark when it is not already active." + :type 'boolean + :group 'editing-basics + :version 31.1) + (defun exchange-point-and-mark (&optional arg) "Put the mark where point is now, and point where the mark is now. This command works even when the mark is not active, -and it reactivates the mark. +and it reactivates the mark unless +`exchange-point-and-mark-highlight-region' is nil. If Transient Mark mode is on, a prefix ARG deactivates the mark if it is active, and otherwise avoids reactivating it. If @@ -7467,15 +7477,18 @@ Transient Mark mode is off, a prefix ARG enables Transient Mark mode temporarily." (interactive "P") (let ((omark (mark t)) + (region-was-active (region-active-p)) (temp-highlight (eq (car-safe transient-mark-mode) 'only))) (if (null omark) (user-error "No mark set in this buffer")) (set-mark (point)) (goto-char omark) - (or temp-highlight - (cond ((xor arg (not (region-active-p))) - (deactivate-mark)) - (t (activate-mark)))) + (cond (temp-highlight) + ((xor arg (if exchange-point-and-mark-highlight-region + (not (region-active-p)) + (not region-was-active))) + (deactivate-mark)) + (t (activate-mark))) nil)) (defcustom shift-select-mode t commit 5e9675367ad0697f615b5168441bf6490977168c Author: Eli Zaretskii Date: Tue Mar 11 13:50:56 2025 +0200 ; * lisp/treesit.el (local-parser-overlay): Fix wording of commentary. diff --git a/lisp/treesit.el b/lisp/treesit.el index 46d1117abc0..319dc5a41fc 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -630,17 +630,17 @@ If none are valid, return nil." ;;; Range API supplement ;; (ref:local-parser-overlay) Regarding local parser overlays, we store -;; the local parser in a overlay spanning across the code block that the -;; parser is responsible of. The `treesit-parser' property stores the -;; parser, the `treesit-host-parser' property stores the host parser, +;; the local parser in an overlay spanning across the code block for +;; which the parser is responsible. The `treesit-parser' property stores +;; the parser, the `treesit-host-parser' property stores the host parser, ;; the `treesit-parser-ov-timestamp' property stores the buffer's tick ;; counter (`buffer-modified-tick') when we last updated this overlay, -;; it's used for garbage-collecting stale ranges and local parsers. +;; which is used for garbage-collecting stale ranges and local parsers. ;; ;; Besides local parsers, we also create overlays for non-local parsers, -;; just to mark the start and end of each range it parses, so that other +;; just to mark the start and end of each range they parse, so that other ;; functions can make use of this information. To differentiate the -;; overlay for local and non-local parsers, local parsers' overlay has +;; overlay for local and non-local parsers, local parsers' overlays have ;; the `treesit-parser-local-p' property set to non-nil. (defvar-local treesit-range-settings nil commit 982aeaf8a104fe4314a37237f70cad41ef6a7348 Author: Eli Zaretskii Date: Tue Mar 11 13:45:52 2025 +0200 ; * lisp/treesit.el (treesit-local-parsers-on): Doc fix. diff --git a/lisp/treesit.el b/lisp/treesit.el index 2ee34323ce7..46d1117abc0 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -877,7 +877,7 @@ PARSER." (nreverse res))) (defun treesit-local-parsers-on (&optional beg end language with-host) - "Return all the local parsers that covers the region between BEG and END. + "Return the list of local parsers that cover the region between BEG and END. BEG and END default to the beginning and end of the buffer's accessible portion. commit 942bb22c9f936a5f2f55dcf12748601ec4046deb Author: Sean Whitton Date: Tue Mar 11 19:17:04 2025 +0800 diff-apply-buffer: Operate on region, add prefix argument * lisp/vc/diff-mode.el (diff-apply-buffer): Interactively, operate on an active region. Reverse-apply hunks with a prefix argument, like C-u C-c C-a already does. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index ed531204c15..a99487b0370 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2193,12 +2193,18 @@ customize `diff-ask-before-revert-and-kill-hunk' to control that." (defun diff-apply-buffer (&optional beg end reverse) "Apply the diff in the entire diff buffer. +Interactively, if the region is active, apply all hunks that the region +overlaps; otherwise, apply all hunks. +With a prefix argument, reverse-apply the hunks. If applying all hunks succeeds, save the changed buffers. + When called from Lisp with optional arguments, restrict the application -to hunks lying between BEG and END, and reverse-apply them when REVERSE is -non-nil. Returns nil if buffers were successfully modified and saved, or -the number of failed hunk applications otherwise." - (interactive) +to hunks lying between BEG and END, and reverse-apply them when REVERSE +is non-nil. Returns nil if buffers were successfully modified and +saved, or the number of failed hunk applications otherwise." + (interactive (list (use-region-beginning) + (use-region-end) + current-prefix-arg)) (let ((buffer-edits nil) (failures 0) (diff-refine nil)) commit 3b3170244da44d3d0d76139b138df65ea6adc064 Author: Yuan Fu Date: Tue Mar 11 02:36:11 2025 -0700 Fix c-ts-common-baseline-indent-rule for lists (bug#76908) * lisp/progmodes/c-ts-common.el: (c-ts-common-baseline-indent-rule): Use the first non-comment sibling rather than first sibling. diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 66e7fad015d..71c177788a8 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -37,10 +37,14 @@ ;; ;; For indenting statements: ;; -;; - Set `c-ts-common-indent-offset', and -;; `c-ts-common-indent-type-regexp-alist', then use simple-indent -;; offset `c-ts-common-statement-offset' in -;; `treesit-simple-indent-rules'. +;; - Set `c-ts-common-indent-offset'. Use +;; `c-ts-common-baseline-indent-rule' as the fallback indent rule, and +;; add override rules to tweak the behavior. +;; +;; - There's also a node-level-based indentation algorithm, it's not as +;; good as `c-ts-common-baseline-indent-rule', but if you want to play +;; with it, set `c-ts-common-indent-type-regexp-alist' and use +;; `c-ts-common-statement-offset'. ;;; Code: @@ -709,6 +713,9 @@ The rule also handles method chaining like ((treesit-node-match-p (treesit-node-child parent 0) (rx (or "(" "["))) (let ((first-sibling (treesit-node-child parent 0 'named))) + (while (treesit-node-match-p + first-sibling c-ts-common--comment-regexp 'ignore-missing) + (setq first-sibling (treesit-node-next-sibling first-sibling 'named))) (cond ;; Closing delimiters. ((treesit-node-match-p node (rx (or ")" "]"))) commit abaff36c3c26850fe883d44fa8a3359a90322d06 Author: Yuan Fu Date: Tue Mar 11 01:34:06 2025 -0700 Make sure treesit-local-parsers-on works when BEG = END (bug#76398) (Unrelated to the topic of the bug, but mentioned in the thread.) * lisp/treesit.el (treesit-local-parsers-on): Use overlays-at when BEG = END. diff --git a/lisp/treesit.el b/lisp/treesit.el index 2d8eebbbff5..2ee34323ce7 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -877,7 +877,7 @@ PARSER." (nreverse res))) (defun treesit-local-parsers-on (&optional beg end language with-host) - "Return all the local parsers between BEG and END. + "Return all the local parsers that covers the region between BEG and END. BEG and END default to the beginning and end of the buffer's accessible portion. @@ -892,7 +892,9 @@ PARSER." (let ((res nil)) ;; Refer to (ref:local-parser-overlay) for more explanation of local ;; parser overlays. - (dolist (ov (overlays-in (or beg (point-min)) (or end (point-max)))) + (dolist (ov (if (eq beg end) + (overlays-at beg) + (overlays-in (or beg (point-min)) (or end (point-max))))) (let ((parser (overlay-get ov 'treesit-parser)) (host-parser (overlay-get ov 'treesit-host-parser)) (local-p (overlay-get ov 'treesit-parser-local-p))) commit 0bcc67c8305aa649be54e036fbe475bb82ca3a8b Author: Yuan Fu Date: Tue Mar 11 01:15:20 2025 -0700 Handle deleted parser in treesit-explore-mode (bug#76398) (Unrelated to the topic of the bug, but mentioned in the thread.) * lisp/treesit.el (treesit--explorer-refresh-1): New function. (treesit--explorer-refresh): Handle 'treesit-parser-deleted' error. diff --git a/lisp/treesit.el b/lisp/treesit.el index 36f26ea5825..2d8eebbbff5 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -4525,7 +4525,7 @@ in the region." (<= (treesit-node-end n) end)) t t))))) -(defun treesit--explorer-refresh () +(defun treesit--explorer-refresh-1 () "Update the syntax tree buffer." (when (and treesit-explore-mode (buffer-live-p treesit--explorer-buffer)) @@ -4576,6 +4576,19 @@ in the region." (set-window-start window (point)))) (set-window-point window pos))))))) +(defun treesit--explorer-refresh () + "Update the syntax tree buffer." + (condition-case nil + (treesit--explorer-refresh-1) + (treesit-parser-deleted + (when treesit--explorer-buffer + (with-current-buffer treesit--explorer-buffer + (let ((inhibit-read-only t)) + (goto-char (point-min)) + (unless (looking-at "Parser is deleted") + (insert (propertize "Parser is deleted\n" + 'face 'error))))))))) + (defun treesit--explorer-post-command (&rest _) "Post-command function that runs in the source buffer." (when treesit-explore-mode commit 894b0e3a2fe064690eecda546f3b577886638140 Author: Michael Albinus Date: Tue Mar 11 09:26:58 2025 +0100 ; Adapt comment in tramp.el diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a343a8ec517..91d0865f53e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -12,8 +12,10 @@ ;; Package-Type: multi ;; URL: https://www.gnu.org/software/tramp/ -;; This is a GNU ELPA :core package. Avoid functionality that is not +;; This is also a GNU ELPA package. Avoid functionality that is not ;; compatible with the version of Emacs recorded in trampver.el. +;; Version and Package-Requires are place holders. They are updated +;; when the GNU ELPA package is released. ;; This file is part of GNU Emacs. commit 57a213c91cdf4b1739b1068c5dc8ae85f1d5302c Author: Yuan Fu Date: Tue Mar 11 00:44:49 2025 -0700 Add overlays for non-local tree-sitter parsers too * lisp/treesit.el (treesit-local-parsers-at): (treesit-local-parsers-on): Exclude non-local parsers. (treesit--cleanup-local-range-overlays): Don't delete non-local parsers (because those are managed by the major mode). (treesit--update-ranges-non-local): Apply overlay for each ranges. (treesit--update-ranges-local): Ignore overlays with non-local parsers, and set 'treesit-parser-local-p' property to t. (treesit--update-range-1): Additionally pass modified-tick to treesit--update-ranges-non-local. (treesit-major-mode-setup): Don't delete non-local parsers. diff --git a/lisp/treesit.el b/lisp/treesit.el index c5c08f47dc3..36f26ea5825 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -629,6 +629,20 @@ If none are valid, return nil." ;;; Range API supplement +;; (ref:local-parser-overlay) Regarding local parser overlays, we store +;; the local parser in a overlay spanning across the code block that the +;; parser is responsible of. The `treesit-parser' property stores the +;; parser, the `treesit-host-parser' property stores the host parser, +;; the `treesit-parser-ov-timestamp' property stores the buffer's tick +;; counter (`buffer-modified-tick') when we last updated this overlay, +;; it's used for garbage-collecting stale ranges and local parsers. +;; +;; Besides local parsers, we also create overlays for non-local parsers, +;; just to mark the start and end of each range it parses, so that other +;; functions can make use of this information. To differentiate the +;; overlay for local and non-local parsers, local parsers' overlay has +;; the `treesit-parser-local-p' property set to non-nil. + (defvar-local treesit-range-settings nil "A list of range settings. @@ -849,12 +863,16 @@ If WITH-HOST is non-nil, return a list of (PARSER . HOST-PARSER) instead. HOST-PARSER is the host parser which created the local PARSER." (let ((res nil)) + ;; Refer to (ref:local-parser-overlay) for more explanation of local + ;; parser overlays. (dolist (ov (overlays-at (or pos (point)))) - (when-let* ((parser (overlay-get ov 'treesit-parser)) - (host-parser (overlay-get ov 'treesit-host-parser))) - (when (or (null language) - (eq (treesit-parser-language parser) - language)) + (let ((parser (overlay-get ov 'treesit-parser)) + (host-parser (overlay-get ov 'treesit-host-parser)) + (local-p (overlay-get ov 'treesit-parser-local-p))) + (when (and parser host-parser local-p + (or (null language) + (eq (treesit-parser-language parser) + language))) (push (if with-host (cons parser host-parser) parser) res)))) (nreverse res))) @@ -872,12 +890,16 @@ If WITH-HOST is non-nil, return a list of (PARSER . HOST-PARSER) instead. HOST-PARSER is the host parser which created the local PARSER." (let ((res nil)) + ;; Refer to (ref:local-parser-overlay) for more explanation of local + ;; parser overlays. (dolist (ov (overlays-in (or beg (point-min)) (or end (point-max)))) - (when-let* ((parser (overlay-get ov 'treesit-parser)) - (host-parser (overlay-get ov 'treesit-host-parser))) - (when (or (null language) - (eq (treesit-parser-language parser) - language)) + (let ((parser (overlay-get ov 'treesit-parser)) + (host-parser (overlay-get ov 'treesit-host-parser)) + (local-p (overlay-get ov 'treesit-parser-local-p))) + (when (and parser host-parser local-p + (or (null language) + (eq (treesit-parser-language parser) + language))) (push (if with-host (cons parser host-parser) parser) res)))) (nreverse res))) @@ -887,12 +909,16 @@ PARSER." For every local parser overlay between BEG and END, if its `treesit-parser-ov-timestamp' is smaller than MODIFIED-TICK, delete it." + ;; Refer to (ref:local-parser-overlay) for more explanation of local + ;; parser overlays. (dolist (ov (overlays-in beg end)) (when-let* ((ov-timestamp (overlay-get ov 'treesit-parser-ov-timestamp))) (when (< ov-timestamp modified-tick) - (when-let* ((local-parser (overlay-get ov 'treesit-parser))) - (treesit-parser-delete local-parser)) + (let ((local-parser (overlay-get ov 'treesit-parser)) + (local-p (overlay-get ov 'treesit-parser-local-p))) + (when (and local-p local-parser) + (treesit-parser-delete local-parser))) (delete-overlay ov))))) (defsubst treesit--parser-at-level (parsers level &optional include-null) @@ -910,7 +936,7 @@ is nil." (declare-function treesit-parser-embed-level "treesit.c") (defun treesit--update-ranges-non-local - ( host-parser query embed-lang embed-level + ( host-parser query embed-lang modified-tick embed-level &optional beg end offset range-fn) "Update range for non-local parsers between BEG and END under HOST-PARSER. @@ -923,6 +949,11 @@ those ranges. HOST-PARSER and QUERY must match. EMBED-LANG is either a language symbol or a function that takes a node and returns a language symbol. +When this function touches an overlay, it sets the +`treesit-parser-ov-timestamp' property of the overlay to MODIFIED-TICK. +This will help Emacs garbage-collect overlays that aren't in use +anymore. + EMBED-LEVEL is the embed level for the local parsers being created or updated. When looking for existing local parsers, only look for parsers of this level; when creating new local parsers, set their level to this @@ -954,6 +985,29 @@ Return updated parsers as a list." (treesit-parser-list nil resolved-embed-lang) embed-level 'include-null))))) (when embed-parser + ;; Lay an overlay over each range to mark the start & end of + ;; it for other functions to access (e.g., outline wants to + ;; know this). Refer to (ref:local-parser-overlay) for more + ;; explanation of local parser overlays. + (dolist (range new-ranges) + (let ((has-existing-ov nil)) + (setq has-existing-ov + (catch 'done + (dolist (ov (overlays-in (car range) (cdr range))) + (when (eq (overlay-get ov 'treesit-parser) + embed-parser) + (move-overlay ov (car range) (cdr range)) + (overlay-put ov 'treesit-parser-ov-timestamp + modified-tick) + (throw 'done t))))) + (unless has-existing-ov + (let ((ov (make-overlay (car range) (cdr range)))) + (overlay-put ov 'treesit-parser embed-parser) + (overlay-put ov 'treesit-parser-local-p nil) + (overlay-put ov 'treesit-host-parser host-parser) + (overlay-put ov 'treesit-parser-ov-timestamp + modified-tick))))) + ;; Set ranges for the embed parser. (let* ((old-ranges (treesit-parser-included-ranges embed-parser)) (set-ranges (treesit--clip-ranges @@ -1025,7 +1079,8 @@ Return the created local parsers as a list." embedded-parser)) (parser-level (treesit-parser-embed-level embedded-parser))) - (when (and (eq parser-lang embedded-lang) + (when (and (overlay-get ov 'treesit-parser-local-p) + (eq parser-lang embedded-lang) (eq embed-level parser-level)) (treesit-parser-set-included-ranges embedded-parser `((,beg . ,end))) @@ -1035,12 +1090,15 @@ Return the created local parsers as a list." (throw 'done embedded-parser))))))) (if existing-local-parser (push existing-local-parser touched-parsers) - ;; Create overlay and local parser. + ;; Create overlay and local parser. Refer to + ;; (ref:local-parser-overlay) for more explanation of + ;; local parser overlays. (let ((embedded-parser (treesit-parser-create embedded-lang nil t 'embedded)) (ov (make-overlay beg end nil nil t))) (treesit-parser-set-embed-level embedded-parser embed-level) (overlay-put ov 'treesit-parser embedded-parser) + (overlay-put ov 'treesit-parser-local-p t) (overlay-put ov 'treesit-host-parser host-parser) (overlay-put ov 'treesit-parser-ov-timestamp modified-tick) @@ -1093,8 +1151,8 @@ Function range settings in SETTINGS are ignored." (t (setq touched-parsers (append touched-parsers (treesit--update-ranges-non-local - host-parser query embed-lang embed-level - beg end offset range-fn)))))))) + host-parser query embed-lang modified-tick + embed-level beg end offset range-fn)))))))) touched-parsers)) (defun treesit-update-ranges (&optional beg end) @@ -4274,8 +4332,10 @@ before calling this function." ;; Remove existing local parsers. (dolist (ov (overlays-in (point-min) (point-max))) - (when-let* ((parser (overlay-get ov 'treesit-parser))) - (treesit-parser-delete parser) + (let ((parser (overlay-get ov 'treesit-parser)) + (local-p (overlay-get ov 'treesit-parser-local-p))) + (when (and parser local-p) + (treesit-parser-delete parser)) (delete-overlay ov)))) ;;; Helpers commit 03a6d4256f861d71e09206ac09d48f16efd52b64 Author: Yuan Fu Date: Mon Mar 10 20:15:39 2025 -0700 Remove parent-node field from tree-sitter parsers * src/treesit.c (make_treesit_parser): Remove field. (Ftreesit_parser_parent_node): (Ftreesit_parser_set_parent_node): Remove * src/treesit.h (Lisp_TS_Parser): Remove field. diff --git a/src/treesit.c b/src/treesit.c index 9622addd09b..b0979397d35 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1368,7 +1368,6 @@ make_treesit_parser (Lisp_Object buffer, TSParser *parser, lisp_parser->tag = tag; lisp_parser->last_set_ranges = Qnil; lisp_parser->embed_level = Qnil; - lisp_parser->parent_node = Qnil; lisp_parser->buffer = buffer; lisp_parser->parser = parser; lisp_parser->tree = tree; @@ -1856,35 +1855,6 @@ tree; otherwise it must be a non-negative integer. */) return level; } -DEFUN ("treesit-parser-parent-node", - Ftreesit_parser_parent_node, Streesit_parser_parent_node, - 1, 1, 0, - doc: /* Return PARSER's parent node, if one exists. - -Only embeded local parsers can have parent node. When Emacs uses a node -in the host parser to create this local parser, that node is considered -the parent node of the local parser. */) - (Lisp_Object parser) -{ - treesit_check_parser (parser); - return XTS_PARSER (parser)->parent_node; -} - -DEFUN ("treesit-parser-set-parent-node", - Ftreesit_parser_set_parent_node, Streesit_parser_set_parent_node, - 2, 2, 0, - doc: /* Make NODE be the parent node of PARSER. */) - (Lisp_Object parser, Lisp_Object node) -{ - treesit_check_parser (parser); - if (!NILP (node)) - CHECK_TS_NODE (node); - - XTS_PARSER (parser)->parent_node = node; - return node; -} - - /* Return true if PARSER is not deleted and its buffer is live. */ static bool treesit_parser_live_p (Lisp_Object parser) @@ -4642,8 +4612,6 @@ applies to LANGUAGE-A will be redirected to LANGUAGE-B instead. */); defsubr (&Streesit_parser_tag); defsubr (&Streesit_parser_embed_level); defsubr (&Streesit_parser_set_embed_level); - defsubr (&Streesit_parser_parent_node); - defsubr (&Streesit_parser_set_parent_node); defsubr (&Streesit_parser_root_node); defsubr (&Streesit_parse_string); diff --git a/src/treesit.h b/src/treesit.h index d4cfc47ee5d..0d4635f4253 100644 --- a/src/treesit.h +++ b/src/treesit.h @@ -72,20 +72,6 @@ struct Lisp_TS_Parser friends) haven't touched this parser yet, and this parser isn't part of the embed parser tree. */ Lisp_Object embed_level; - /* Some comments: Technically you could calculate embed_level by - following parent_node, but parent_node might be outdated so it's a - good idea to record embed_level separately. Embed_level and - parent_node could have been implemented as "parser properties" with - an obarray, but ultimately I think two explicit fields helps - documentation better and it's not clear to me that a property list - for a parser will be useful beyond this. And we can always convert - these to properties later, but not vice versa. */ - /* When an embedded parser is created, it's usually based on a node in - the host parser. This field saves that node so it's possible to - climb up and out of the embedded parser into the host parser. Note - that the range of the embedded parser doesn't have to match that of - the parent node. */ - Lisp_Object parent_node; /* The buffer associated with this parser. */ Lisp_Object buffer; /* The pointer to the tree-sitter parser. Never NULL. */ commit cc87717fa077b2b28319f60d6be4aa5cf57927a5 Author: Michael Albinus Date: Mon Mar 10 17:40:51 2025 +0100 Add keyword placeholder to tramp.el * lisp/net/tramp.el: Add Version, Package-Requires, Package-Type and URL keywords. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b6dc110f6a6..a343a8ec517 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -7,6 +7,10 @@ ;; Maintainer: Michael Albinus ;; Keywords: comm, processes ;; Package: tramp +;; Version: 0 +;; Package-Requires: () +;; Package-Type: multi +;; URL: https://www.gnu.org/software/tramp/ ;; This is a GNU ELPA :core package. Avoid functionality that is not ;; compatible with the version of Emacs recorded in trampver.el. commit 7d0d61d8549904f460c5711b93ed359f853fb4c3 Author: Stefan Kangas Date: Sun Mar 9 19:34:00 2025 +0100 Rewrite ERT manual introduction * doc/misc/ert.texi (Top): Rewrite for clarity. Don't give such prominent mention to to TDD or JUnit, references which now seem dated. diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index e0cc415fa93..fdf2b2b8aaf 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -46,15 +46,17 @@ modify this GNU manual.'' @insertcopying ERT is a tool for automated testing in Emacs Lisp. Its main features -are facilities for defining tests, running them and reporting the -results, and for debugging test failures interactively. - -ERT is similar to tools for other environments such as JUnit, but has -unique features that take advantage of the dynamic and interactive -nature of Emacs. Despite its name, it works well both for test-driven -development (see -@url{https://en.wikipedia.org/wiki/Test-driven_development}) and for -traditional software development methods. +are facilities for defining and running tests, reporting results, and +debugging test failures interactively. Tests are written in Emacs Lisp, +just like the code under test, making it easy to write expressive and +concise test cases. + +ERT has unique features that take advantage of the dynamic and +interactive nature of Emacs. It is unopinionated about when or how +tests are written: you can use it to verify newly written code, +reproduce known bugs, prevent regressions, or explore the behavior of +complex systems. It can be used for both unit tests and larger +integration tests. @menu * Introduction:: A simple example of an ERT test. commit b2f124f2a8887a3bf2e68ec09500361a2d4d0850 Author: Harald Jörg Date: Sun Mar 9 16:26:51 2025 +0100 ; cperl-mode.el: Don't misinterpret exec_fcn as keyword exec * lisp/progmodes/cperl-mode.el (cperl-after-block-and-statement-beg): Recognize _ as part of a Perl symbol. Fixes Bug#76851 * test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts Two new test cases around the edges of Bug#76851 diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 38015ed2acd..dc37457f530 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -5539,7 +5539,7 @@ CHARS is a string that contains good characters to have before us (however, (forward-sexp -1) (not (looking-at - "\\(map\\|grep\\|say\\|printf?\\|system\\|exec\\|tr\\|s\\)\\>"))))))) + "\\(map\\|grep\\|say\\|printf?\\|system\\|exec\\|tr\\|s\\)\\_>"))))))) (defun cperl-indent-exp () diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts b/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts index ba35b1d0690..ab00e9ce6d4 100644 --- a/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts +++ b/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts @@ -79,3 +79,22 @@ class C say "done!"; =-=-= + +Name: cperl-keyword-in-subname + +=-= +# Bug#76851 +sub exec_fcn { +} + +sub other { +} +=-=-= + +Name: cperl-keyword-without-space + +=-= +# Bug#76851, message #13 +my %h = map{$_=>1} + @ARGV; +=-=-= commit 59d1aac49dfdc49e34be5964f547db0cfa7e127b Author: Eli Zaretskii Date: Sun Mar 9 15:02:39 2025 +0200 Document return values of the various read-* functions * lisp/textmodes/string-edit.el (read-string-from-buffer): * lisp/simple.el (read-from-kill-ring, read-shell-command) (read-signal-name): * lisp/replace.el (read-regexp-case-fold-search): * lisp/auth-source.el (read-passwd): * lisp/subr.el (read-key, read-number): * lisp/minibuffer.el (read-file-name, read-no-blanks-input): * lisp/international/mule-cmds.el (read-multilingual-string): * lisp/language/japan-util.el (read-hiragana-string): * lisp/files-x.el (read-file-local-variable) (read-file-local-variable-mode, read-file-local-variable-value): * lisp/faces.el (read-face-font, read-face-name): * lisp/simple.el (read-extended-command): * lisp/env.el (read-envvar-name): * lisp/files.el (read-directory-name): * lisp/faces.el (read-color): * lisp/international/mule-diag.el (read-charset): * lisp/emacs-lisp/map-ynp.el (read-answer): * src/coding.c (Fread_coding_system) (Fread_non_nil_coding_system): * src/minibuf.c (Fread_command, Fread_from_minibuffer): * src/lread.c (Fread_char, Fread_char_exclusive, Fread_event): Doc fixes. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index d22747493b2..c72cb24cf74 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -2551,7 +2551,7 @@ Adapt also mode line." ;;;###autoload (defun read-passwd (prompt &optional confirm default) - "Read a password, prompting with PROMPT, and return it. + "Read a password, prompting with PROMPT, and return password as a string. If optional CONFIRM is non-nil, read the password twice to make sure. Optional DEFAULT is a default password to use instead of empty input. diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index 2d24f783958..5b9ffe3a03d 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -312,6 +312,7 @@ variable." (defun read-answer (question answers) "Read an answer either as a complete word or its character abbreviation. Ask user a question and accept an answer from the list of possible answers. +Return the long answer even when accepting short ones. QUESTION should end in a space; this function adds a list of answers to it. @@ -335,8 +336,6 @@ Example: When `read-answer-short' is non-nil, accept short answers. -Return a long answer even in case of accepting short ones. - When `use-dialog-box' is t, pop up a dialog window to get user input." (let* ((short (if (eq read-answer-short 'auto) (or use-short-answers diff --git a/lisp/env.el b/lisp/env.el index 288f7e224d7..9e8b7f53a11 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -38,7 +38,7 @@ (defvar read-envvar-name-history nil) (defun read-envvar-name (prompt &optional mustmatch) - "Read environment variable name, prompting with PROMPT. + "Read and return an environment variable name string, prompting with PROMPT. Optional second arg MUSTMATCH, if non-nil, means require existing envvar name. If it is also not t, RET does not exit if it does non-null completion." (completing-read prompt diff --git a/lisp/faces.el b/lisp/faces.el index 01800c4c105..bbd6bf06d03 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1102,7 +1102,7 @@ of the default face. Value is FACE." "Text string to display as the sample text for `read-face-name'.") (defun read-face-name (prompt &optional default multiple) - "Read one or more face names, prompting with PROMPT. + "Read and return one or more face names, strings, prompting with PROMPT. PROMPT should not end in a space or a colon. If DEFAULT is non-nil, it should be a face (a symbol) or a face @@ -1382,7 +1382,7 @@ of a global face. Value is the new attribute value." (pattern &optional face frame maximum width)) (defun read-face-font (face &optional frame) - "Read the name of a font for FACE on FRAME. + "Read and return the string name of the font for FACE on FRAME. If optional argument FRAME is nil or omitted, use the selected frame." (let ((completion-ignore-case t)) (completing-read (format-message @@ -1990,7 +1990,7 @@ If omitted or nil, that stands for the selected frame's display." (defun read-color (&optional prompt convert-to-RGB allow-empty-name msg foreground face) - "Read a color name or RGB triplet. + "Read a color name or RGB triplet, return a string, the color name or RGB. Completion is available for color names, but not for RGB triplets. RGB triplets have the form \"#RRGGBB\". Each of the R, G, and B diff --git a/lisp/files-x.el b/lisp/files-x.el index cdc38508c5a..82b69de7c17 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -38,7 +38,9 @@ ;;; Commands to add/delete file-local/directory-local variables. (defun read-file-local-variable (prompt) - "Read file-local variable using PROMPT and completion. + "Read the name of a file-local variable using PROMPT and completion. +Return the symbol of the variable, or nil if the user entered empty or +null name. Intended to be used in the `interactive' spec of `add-file-local-variable', `delete-file-local-variable', `add-dir-local-variable', `delete-dir-local-variable'." @@ -57,7 +59,7 @@ Intended to be used in the `interactive' spec of (and (stringp variable) (intern variable)))) (defun read-file-local-variable-value (variable) - "Read value of file-local VARIABLE using completion. + "Read and return the value of a file-local VARIABLE using completion. Intended to be used in the `interactive' spec of `add-file-local-variable' and `add-dir-local-variable'." (cond @@ -90,7 +92,9 @@ Intended to be used in the `interactive' spec of default))))) (defun read-file-local-variable-mode () - "Read per-directory file-local variable's mode using completion. + "Read the name of a per-directory file-local variable's mode using completion. +Return the symbol of the variable, or nil if the user entered empty or +null name. Intended to be used in the `interactive' spec of `add-dir-local-variable', `delete-dir-local-variable'." (let* ((default (and (symbolp major-mode) (symbol-name major-mode))) diff --git a/lisp/files.el b/lisp/files.el index 380721f1fe2..007fd23a5f5 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -885,6 +885,7 @@ Default name to DEFAULT-DIRNAME if user exits with the same non-empty string that was inserted by this function. (If DEFAULT-DIRNAME is omitted, DIR combined with INITIAL is used, or just DIR if INITIAL is nil.) +Return the directory as a string. If the user exits with an empty minibuffer, this function returns an empty string. (This can happen only if the user erased the pre-inserted contents or if `insert-default-directory' is nil.) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 4d153ea91db..24ae65c1145 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1676,6 +1676,7 @@ This is a subroutine for `describe-input-method'." (defun read-multilingual-string (prompt &optional initial-input input-method) "Read a multilingual string from minibuffer, prompting with string PROMPT. +Return the string thus read. The input method selected last time is activated in minibuffer. If optional second argument INITIAL-INPUT is non-nil, insert it in the minibuffer initially. diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 03376e876bf..44d20e39507 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -206,6 +206,7 @@ Character sets for defining other charsets, or for backward compatibility (defun read-charset (prompt &optional default-value initial-input) "Read a character set from the minibuffer, prompting with string PROMPT. It must be an Emacs character set listed in the variable `charset-list'. +Return the charset as a symbol. Optional arguments are DEFAULT-VALUE and INITIAL-INPUT. DEFAULT-VALUE, if non-nil, is the default value. diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el index c61e98c8fca..718c469d562 100644 --- a/lisp/language/japan-util.el +++ b/lisp/language/japan-util.el @@ -317,7 +317,8 @@ Optional argument KATAKANA-ONLY non-nil means to convert only KATAKANA char." ;;;###autoload (defun read-hiragana-string (prompt &optional initial-input) "Read a Hiragana string from the minibuffer, prompting with string PROMPT. -If non-nil, second arg INITIAL-INPUT is a string to insert before reading." +If non-nil, second arg INITIAL-INPUT is a string to insert before reading. +Return the string read from the minibuffer." (read-multilingual-string prompt initial-input "japanese-hiragana")) ;; diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index cfce7de8df1..f0db98cdc1d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3091,7 +3091,7 @@ with `minibuffer-local-must-match-map'." "?" #'self-insert-and-exit) (defun read-no-blanks-input (prompt &optional initial inherit-input-method) - "Read a string from the terminal, not allowing blanks. + "Read and return a string from the terminal, not allowing blanks. Prompt with PROMPT. Whitespace terminates the input. If INITIAL is non-nil, it should be a string, which is used as initial input, with point positioned at the end, so that SPACE will accept the input. @@ -3473,7 +3473,8 @@ like the `beginning-of-buffer' command." (if (listp default) default (list default))))) (defun read-file-name (prompt &optional dir default-filename mustmatch initial predicate) - "Read file name, prompting with PROMPT and completing in directory DIR. + "Read a file name, prompting with PROMPT and completing in directory DIR. +Retrun the file name as a string. The return value is not expanded---you must call `expand-file-name' yourself. diff --git a/lisp/replace.el b/lisp/replace.el index e17514215ef..beecc78c437 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -929,7 +929,7 @@ regexp from the user." (or result input)))) (defun read-regexp-case-fold-search (regexp) - "Return a value for `case-fold-search' based on REGEXP and current settings. + "Return the value for `case-fold-search' based on REGEXP and current settings. REGEXP is a string as returned by `read-regexp'." (let ((fold (get-text-property 0 'case-fold regexp))) (cond diff --git a/lisp/simple.el b/lisp/simple.el index 152a8c451ac..e1f6ae8b683 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2275,7 +2275,7 @@ This is used by the \\\\[execute-extended-comma "Minor mode used for completion in `read-extended-command'.") (defun read-extended-command (&optional prompt) - "Read command name to invoke via `execute-extended-command'. + "Read and return name of command to invoke via `execute-extended-command'. Use `read-extended-command-predicate' to determine which commands to include among completion candidates. @@ -4311,7 +4311,7 @@ after the default value." "Keymap used for completing shell commands in minibuffer.") (defun read-shell-command (prompt &optional initial-contents hist &rest args) - "Read a shell command from the minibuffer. + "Read a shell command from the minibuffer, and return it as a string. The arguments are the same as the ones of `read-from-minibuffer', except READ and KEYMAP are missing and HIST defaults to `shell-command-history'." @@ -6431,7 +6431,8 @@ variable to determine how strings should be escaped." (defvar read-from-kill-ring-history) (defun read-from-kill-ring (prompt) "Read a `kill-ring' entry using completion and minibuffer history. -PROMPT is a string to prompt with." +PROMPT is a string to prompt with. +Return the entry as a string." ;; `current-kill' updates `kill-ring' with a possible interprogram-paste (current-kill 0) (let* ((history-add-new-input nil) @@ -11193,7 +11194,9 @@ killed." (string= string "")) (defun read-signal-name () - "Read a signal number or name." + "Read a signal number or name. +Return the signal number, if the user entered a number, otherwise +the signal symbol." (let ((value (completing-read "Signal code or name: " (signal-names) diff --git a/lisp/subr.el b/lisp/subr.el index 37a3f9efe6b..42706397674 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3309,7 +3309,7 @@ miscellaneous values associated with the process." (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully. (defun read-key (&optional prompt disable-fallbacks) - "Read a key from the keyboard. + "Read a key from the keyboard, return the event thus read. Contrary to `read-event' this will not return a raw event but instead will obey the input decoding and translations usually done by `read-key-sequence'. So escape sequences and keyboard encoding are taken into account. @@ -3423,7 +3423,7 @@ with Emacs. Do not call it directly in your own packages." "The default history for the `read-number' function.") (defun read-number (prompt &optional default hist) - "Read a numeric value in the minibuffer, prompting with PROMPT. + "Read from the minibuffer and return a numeric value, prompting with PROMPT. DEFAULT specifies a default value to return if the user just types RET. For historical reasons, the value of DEFAULT is always inserted into PROMPT, so it's recommended to use `format' instead of `format-prompt' diff --git a/lisp/textmodes/string-edit.el b/lisp/textmodes/string-edit.el index 1188a965f6f..3c76db202c7 100644 --- a/lisp/textmodes/string-edit.el +++ b/lisp/textmodes/string-edit.el @@ -92,6 +92,9 @@ PROMPT will be inserted at the start of the buffer, but won't be included in the resulting string. If nil, no prompt will be inserted in the buffer. +When the user exits recursive edit, this function returns the +edited STRING. + Also see `string-edit'." (string-edit prompt diff --git a/src/coding.c b/src/coding.c index b8ed3a35957..619a362d328 100644 --- a/src/coding.c +++ b/src/coding.c @@ -8625,7 +8625,8 @@ about coding-system objects. */) DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, Sread_non_nil_coding_system, 1, 1, 0, - doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */) + doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. +Return the symbol of the coding-system. */) (Lisp_Object prompt) { Lisp_Object val; @@ -8641,6 +8642,8 @@ DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0, doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. +Return the coding-system's symbol, or nil if both the user input and +DEFAULT-CODING-SYSTEM are empty or null. Ignores case when completing coding systems (all Emacs coding systems are lower-case). */) (Lisp_Object prompt, Lisp_Object default_coding_system) diff --git a/src/lread.c b/src/lread.c index 1d41a9d5cf4..6610f82d927 100644 --- a/src/lread.c +++ b/src/lread.c @@ -859,7 +859,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required, DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0, doc: /* Read a character event from the command input (keyboard or macro). -It is returned as a number. +Return the character as a number. If the event has modifiers, they are resolved and reflected in the returned character code if possible (e.g. C-SPC yields 0 and C-a yields 97). If some of the modifiers cannot be reflected in the character code, the @@ -907,7 +907,7 @@ If `inhibit-interaction' is non-nil, this function will signal an } DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, - doc: /* Read an event object from the input stream. + doc: /* Read and return an event object from the input stream. If you want to read non-character events, consider calling `read-key' instead. `read-key' will decode events via `input-decode-map' that @@ -943,7 +943,7 @@ If `inhibit-interaction' is non-nil, this function will signal an DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0, doc: /* Read a character event from the command input (keyboard or macro). -It is returned as a number. Non-character events are ignored. +Return the character as a number. Non-character events are ignored. If the event has modifiers, they are resolved and reflected in the returned character code if possible (e.g. C-SPC yields 0 and C-a yields 97). If some of the modifiers cannot be reflected in the character code, the diff --git a/src/minibuf.c b/src/minibuf.c index 026a8f4271e..3cb7ff47030 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1292,7 +1292,7 @@ barf_if_interaction_inhibited (void) DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 7, 0, - doc: /* Read a string from the minibuffer, prompting with string PROMPT. + doc: /* Read and return a string from the minibuffer, prompting with string PROMPT. The optional second arg INITIAL-CONTENTS is an obsolete alternative to DEFAULT-VALUE. It normally should be nil in new code, except when HIST is a cons. It is discussed in more detail below. @@ -1444,7 +1444,7 @@ inherits the current input method and the setting of } DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, - doc: /* Read the name of a command and return as a symbol. + doc: /* Read the name of a command and return it as a symbol. Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element if it is a list. If DEFAULT-VALUE is omitted or nil, and the user enters null input, return a symbol whose name is an empty string. */)