From 14c707b42d9db7dd2220118ecb49df8e2a5e7b78 Mon Sep 17 00:00:00 2001 From: Jake Forster Date: Mon, 28 Apr 2025 22:22:18 +0930 Subject: [PATCH 01/11] ; Isearch: Fix key bindings in docstrings * lisp/isearch.el (isearch-allow-motion) (isearch-motion-changes-direction): Use isearch-mode-map for commands in docstrings (bug#78118). Copyright-paperwork-exempt: yes --- lisp/isearch.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 5fd91bd92d6..ee1bb676d5c 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3047,11 +3047,11 @@ See also the related option `isearch-allow-motion'." (defcustom isearch-allow-motion nil "Whether to allow movement between isearch matches by cursor motion commands. -If non-nil, the four motion commands \\[beginning-of-buffer], \\[end-of-buffer], \ -\\[scroll-up-command] and \\[scroll-down-command], when invoked during -Isearch, move respectively to the first occurrence of the current search string -in the buffer, the last one, the first one after the current window, and the -last one before the current window. +If non-nil, the four motion commands \\\\[beginning-of-buffer], \\[end-of-buffer], \ +\\[scroll-up-command] and \\[scroll-down-command], when invoked +during Isearch, move respectively to the first occurrence of the current +search string in the buffer, the last one, the first one after the current +window, and the last one before the current window. If nil, these motion commands normally exit Isearch and are executed. See also the related options `isearch-motion-changes-direction' and `isearch-allow-scroll'." @@ -3064,8 +3064,8 @@ See also the related options `isearch-motion-changes-direction' and "Whether motion commands during incremental search change search direction. If nil, the search direction (forward or backward) does not change when motion commands are used during incremental search, except when wrapping. -If non-nil, the search direction is forward after \\[beginning-of-buffer] and \ -\\[scroll-up-command], and +If non-nil, the search direction is forward after \ +\\\\[beginning-of-buffer] and \\[scroll-up-command], and backward after \\[end-of-buffer] and \\[scroll-down-command]." :type '(choice (const :tag "Off" nil) (const :tag "On" t)) From 2a8e223b8d7c8e18a10ced98f5b794c4de9737e6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 29 Apr 2025 09:05:28 +0300 Subject: [PATCH 02/11] ; Mention early-init file in Emacs FAQ for Windows * doc/misc/efaq-w32.texi (Location of init file, Init file): Mention the early-init file. Suggested by David Hedlund . --- doc/misc/efaq-w32.texi | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi index 766acb0f3ca..0a0ac539de5 100644 --- a/doc/misc/efaq-w32.texi +++ b/doc/misc/efaq-w32.texi @@ -353,6 +353,7 @@ not bundled with Emacs. @xref{Other useful ports}. @section What is my init file? @cindex .emacs @cindex init file +@cindex early init file When Emacs starts up, it attempts to load and execute the contents of a file commonly called @file{.emacs} (though it may have other names, @@ -362,22 +363,31 @@ code to your .emacs, or you can use the Customization interface accessible from the @emph{Options} menu. If the file does not exist, Emacs will start with the default settings. +In addition, Emacs 27 and later attempts to load and execute the +contents of the @file{early-init.el} file. As its name suggests, this +file, if it exists, is loaded and executed early on during the Emacs +startup sequence, before @code{.emacs}, and is intended to contain the +few initializations which must be performed before @file{.emacs} is +looked up and loaded. + @node Location of init file @section Where do I put my init file? @cindex HOME directory @cindex .emacs.d @cindex _emacs @cindex init.el +@cinde early-init.el @cindex registry, setting the HOME directory in -On Windows, the @file{.emacs} file may be called @file{_emacs} for +On Windows, the @file{.emacs} init file may be called @file{_emacs} for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name due to historical problems various Windows tools had in the past with file names that begin with a dot. The init file may also be -called @file{.emacs.d/init.el}. Many of the other files that are -created by Lisp packages are stored in the @file{.emacs.d} directory -too, which keeps all your Emacs related files in one place. +called @file{.emacs.d/init.el}. The @file{early-init.el} file and many +of the other files that are created by Lisp packages are stored in the +@file{.emacs.d} directory too, which keeps all your Emacs related files +in one place. All the files mentioned above should go in your @env{HOME} directory. The @env{HOME} directory is determined by following the steps below: From 4858d81848839c9167a523e4b566dbb253e566c6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 29 Apr 2025 09:39:34 +0300 Subject: [PATCH 03/11] ; * lisp/files.el (revert-buffer-restore-functions): Doc fix. --- lisp/files.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index 2707a4e8bbe..246b17baa3f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6995,7 +6995,14 @@ arguments and should return a lambda that can restore a previous state of the buffer. Then after reverting the buffer each of these lambdas will be called one by one in the order of the list to restore previous states of the buffer. An example of the buffer state is keeping the -buffer read-only, or keeping minor modes, etc.") +buffer read-only, or keeping minor modes, etc. + +The default value restores the buffer's read-only state to what it +was before reverting. + +Set this variable to nil to disable restoring any buffer state +attributes from before reverting. Then only the file from which the +buffer is reverted will determine the buffer's state after reverting.") (defun revert-buffer-restore-read-only () "Preserve read-only state for `revert-buffer'." From 9adb05422eaaa290a6a0542ba8862b806b34fe7c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 29 Apr 2025 10:09:54 +0300 Subject: [PATCH 04/11] ; Improve obsolescence of 'text-mode-variant' * lisp/textmodes/text-mode.el (text-mode-variant): Improve obsolescence announcement text. * doc/lispref/modes.texi (Example Major Modes): Update example. (Bug#78125). --- doc/lispref/modes.texi | 3 --- lisp/textmodes/text-mode.el | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 31d420eedb6..3a6b163c81c 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1509,9 +1509,6 @@ You can thus get the full benefit of adaptive filling (see the variable `adaptive-fill-mode'). \\@{text-mode-map@} Turning on Text mode runs the normal hook `text-mode-hook'." -@end group -@group - (setq-local text-mode-variant t) (setq-local require-final-newline mode-require-final-newline)) @end group @end smallexample diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index d918efa72c6..7507b7d80d1 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -39,7 +39,9 @@ (defvar text-mode-variant nil "Non-nil if this buffer's major mode is a variant of Text mode.") -(make-obsolete-variable 'text-mode-variant 'derived-mode-p "27.1") +(make-obsolete-variable 'text-mode-variant + "\ +Don't set it, and instead of testing its value use `derived-mode-p'." "27.1") ;; Actually defined in textconv.c. (defvar text-conversion-style) From 2838b64fc8b71d2a534fcf01e02a20066d99e2b3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 29 Apr 2025 10:47:35 +0300 Subject: [PATCH 05/11] ; * lisp/textmodes/text-mode.el (text-mode-variant): Fix last change. --- lisp/textmodes/text-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 7507b7d80d1..6318e6db8b4 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -41,7 +41,7 @@ "Non-nil if this buffer's major mode is a variant of Text mode.") (make-obsolete-variable 'text-mode-variant "\ -Don't set it, and instead of testing its value use `derived-mode-p'." "27.1") +don't set it, and instead of testing its value use `derived-mode-p'." "27.1") ;; Actually defined in textconv.c. (defvar text-conversion-style) From 79e7eeb32964ba79f0d0ef06c9c0d7c16c542f37 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 29 Apr 2025 11:19:19 +0300 Subject: [PATCH 06/11] ; Improve documentation of 'format-time-string' * doc/lispref/os.texi (Time Parsing): Fix documentation of week numbers for %U, %V and %W. (Bug#78096) --- doc/lispref/os.texi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 3f2388daeb3..0e9e3982ec5 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1938,14 +1938,18 @@ This is a synonym for @samp{%H:%M:%S}. This stands for the numeric day of week (1--7). Monday is day 1. @item %U This stands for the week of the year (01--52), assuming that weeks -start on Sunday. +start on Sunday. If January 1 is not a Sunday, the first partial week +is week zero. @item %V -This stands for the week of the year according to ISO 8601. +This stands for the week of the year according to ISO 8601. Note that, +unlike @samp{%U} and @samp{%W}, the week according to ISO 8601 does +@emph{not} roll over to 1 on January 1, but keeps its last number. @item %w This stands for the numeric day of week (0--6). Sunday is day 0. @item %W -This stands for the week of the year (01--52), assuming that weeks -start on Monday. +This stands for the week of the year (01--52), assuming that weeks start +on Monday. If January 1 is not a Monday, the first partial week is week +zero. @item %x This has a locale-specific meaning. In the default locale (named @samp{C}), it is equivalent to @samp{%D}. From 1224e5fd961ba53a5d6aba46e3c92a2fd047a165 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 29 Apr 2025 21:28:01 +0300 Subject: [PATCH 07/11] ; * lisp/files.el (revert-buffer-restore-functions): Doc fix (bug#78124). --- lisp/files.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 246b17baa3f..3828bf38d99 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6988,14 +6988,14 @@ A customized `revert-buffer-function' need not run this hook.") (defvar revert-buffer-preserve-modes) (defvar revert-buffer-restore-functions '(revert-buffer-restore-read-only) - "Functions to preserve any state during `revert-buffer'. -The value of this variable is a list of functions that are called before -reverting the buffer. Each of these functions are called without -arguments and should return a lambda that can restore a previous state -of the buffer. Then after reverting the buffer each of these lambdas -will be called one by one in the order of the list to restore previous -states of the buffer. An example of the buffer state is keeping the -buffer read-only, or keeping minor modes, etc. + "Functions to preserve buffer state during `revert-buffer'. +The value of this variable is a list of functions that are called +before reverting the buffer. Each of these functions is called without +arguments and should return a lambda form that can restore a previous +state of the buffer. After reverting the buffer, each of these lambda +forms will be called in order to restore previous states of the buffer. +An example of the buffer state is keeping the buffer read-only, or +keeping minor modes, etc. The default value restores the buffer's read-only state to what it was before reverting. From 80cbd1e31cc360ee26d462e62a253f8b54807a65 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 30 Apr 2025 09:03:17 +0300 Subject: [PATCH 08/11] ; Fix key notation in Introduction to Emacs Lisp * doc/lispintro/emacs-lisp-intro.texi (Typing Lists) (Note for Novices): Fix notation of 'M-C-\'. (Bug#78153) --- doc/lispintro/emacs-lisp-intro.texi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index b041678d8c8..07abbaf96b5 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -940,21 +940,21 @@ same time, and then press and release @kbd{t}.) Also, I often refer to one of Emacs's standard commands by listing the keys which you press to invoke the command and then giving the name of -the command in parentheses, like this: @kbd{M-C-\} +the command in parentheses, like this: @kbd{C-M-\} (@code{indent-region}). What this means is that the @code{indent-region} command is customarily invoked by typing -@kbd{M-C-\}. (You can, if you wish, change the keys that are typed to +@kbd{C-M-\}. (You can, if you wish, change the keys that are typed to invoke the command; this is called @dfn{rebinding}. @xref{Keymaps, , -Keymaps}.) The abbreviation @kbd{M-C-\} means that you type your -@key{META} key, @key{CTRL} key and @kbd{\} key all at the same time. +Keymaps}.) The abbreviation @kbd{C-M-\} means that you type your +@key{CTRL} key, @key{META} key, and @kbd{\} key all at the same time. (On many modern keyboards the @key{META} key is labeled @key{ALT}.) Sometimes a combination like this is called a keychord, since it is similar to the way you play a chord on a piano. If your keyboard does not have a @key{META} key, the @key{ESC} key prefix is used in place -of it. In this case, @kbd{M-C-\} means that you press and release your +of it. In this case, @kbd{C-M-\} means that you press and release your @key{ESC} key and then type the @key{CTRL} key and the @kbd{\} key at -the same time. But usually @kbd{M-C-\} means press the @key{CTRL} key +the same time. But usually @kbd{C-M-\} means press the @key{CTRL} key along with the key that is labeled @key{ALT} and, at the same time, press the @kbd{\} key. @@ -962,7 +962,7 @@ In addition to typing a lone keychord, you can prefix what you type with @kbd{C-u}, which is called the @dfn{universal argument}. The @kbd{C-u} keychord passes an argument to the subsequent command. Thus, to indent a region of plain text by 6 spaces, mark the region, -and then type @w{@kbd{C-u 6 M-C-\}}. (If you do not specify a number, +and then type @w{@kbd{C-u 6 C-M-\}}. (If you do not specify a number, Emacs either passes the number 4 to the command or otherwise runs the command differently than it would otherwise.) @xref{Arguments, , Numeric Arguments, emacs, The GNU Emacs Manual}. @@ -1258,7 +1258,7 @@ Interaction mode or Emacs Lisp mode, you have available to you several commands to format the Lisp expression so it is easy to read. For example, pressing the @key{TAB} key automatically indents the line the cursor is on by the right amount. A command to properly indent the -code in a region is customarily bound to @kbd{M-C-\}. Indentation is +code in a region is customarily bound to @kbd{C-M-\}. Indentation is designed so that you can see which elements of a list belong to which list---elements of a sub-list are indented more than the elements of the enclosing list. From d56e5ba97ee49bc7d82ad21e35ac8fbc21a0b0e1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 30 Apr 2025 17:12:50 +0800 Subject: [PATCH 09/11] ; * etc/DEBUG: Add link to GCC bug #78685. --- etc/DEBUG | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/DEBUG b/etc/DEBUG index 32256e1ad6f..f8186a429cd 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -20,7 +20,7 @@ such as --prefix): CFLAGS='-O0 -g3' The -O0 flag is important, as debugging optimized code can be hard, even -in the case that the -Og compiler option is used. If the problem +in the case that the -Og compiler option is used.[1] If the problem happens only with optimized code, you may need to enable optimizations. If that happens, try using -Og first instead of -O2, as -Og disables some optimizations that make debugging some code exceptionally hard. @@ -38,6 +38,9 @@ this below under "Debugging Emacs redisplay problems". Emacs needs not be installed to be debugged, you can debug the binary created in the 'src' directory. +[1] gcc's -Og has some known problems and limitations, documented here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685 + *** Configuring GDB To start GDB to debug Emacs, you can simply type "gdb ./emacs RET" at From 6c2aaedfcebb310e0c948d6972f90cc7d96193f9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 30 Apr 2025 14:06:44 +0300 Subject: [PATCH 10/11] Fix compilation errors in emacsclient.c with MinGW GCC 15 * lib-src/emacsclient.c (set_fg, get_wc): Declare using actual function signatures. (w32_give_focus): Cast return value of 'GetProcAddress' to correct pointer types. (Bug#78160) --- lib-src/emacsclient.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 2cf90f4039b..ddfe19ffbd6 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1715,8 +1715,13 @@ set_socket (bool no_exit_if_error) } #ifdef HAVE_NTGUI -FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ -FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ +typedef void (* VOIDFNPTR) (void); +typedef BOOL (WINAPI *AllowSetForegroundWindow_proc) (DWORD); +/* Pointer to AllowSetForegroundWindow. */ +static AllowSetForegroundWindow_proc set_fg; +typedef UINT (WINAPI *RealGetWindowClassA_proc) (HWND, LPSTR, UINT); +/* Pointer to RealGetWindowClassA. */ +static RealGetWindowClassA_proc get_wc; void w32_set_user_model_id (void); @@ -1794,8 +1799,8 @@ w32_give_focus (void) emacsclient can allow Emacs to grab the focus by calling the function AllowSetForegroundWindow. Unfortunately, older Windows (W95, W98 and NT) lack this function, so we have to check its availability. */ - if ((set_fg = GetProcAddress (user32, "AllowSetForegroundWindow")) - && (get_wc = GetProcAddress (user32, "RealGetWindowClassA"))) + if ((set_fg = (AllowSetForegroundWindow_proc) (VOIDFNPTR) GetProcAddress (user32, "AllowSetForegroundWindow")) + && (get_wc = (RealGetWindowClassA_proc) (VOIDFNPTR) GetProcAddress (user32, "RealGetWindowClassA"))) EnumWindows (w32_find_emacs_process, (LPARAM) 0); } #endif /* HAVE_NTGUI */ From cc5b1a01a2c20e48fc4469cf0efd2bea7731ce58 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 30 Apr 2025 14:10:25 +0300 Subject: [PATCH 11/11] ; * doc/misc/efaq-w32.texi (Location of init file): Fix a typo. --- doc/misc/efaq-w32.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi index 0a0ac539de5..e50716ff654 100644 --- a/doc/misc/efaq-w32.texi +++ b/doc/misc/efaq-w32.texi @@ -376,7 +376,7 @@ looked up and loaded. @cindex .emacs.d @cindex _emacs @cindex init.el -@cinde early-init.el +@cindex early-init.el @cindex registry, setting the HOME directory in On Windows, the @file{.emacs} init file may be called @file{_emacs} for