From 22de4b1e724da7ceadc117c0d4611ecf4bf589d1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Mar 2023 10:03:04 +0200 Subject: [PATCH 01/37] ; Describe problems with 'screen' and COLORTERM variable * etc/PROBLEMS: Describe the issue with 'screen' and COLORTERM=truecolor. (Bug#62237) --- etc/PROBLEMS | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 69c42e9bed0..3c75e81b8b9 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2293,6 +2293,33 @@ recommended way of turning on Font-lock is by typing "M-x global-font-lock-mode RET" or by customizing the variable 'global-font-lock-mode'. +** Colors are not available or messed up on TTY frames inside 'screen'. + +This can happen if you have COLORTERM=truecolor defined in the +environment when Emacs starts, but your version of 'screen' doesn't +actually support 24-bit true colors. + +The COLORTERM environment variable is supposed to be set to the value +"truecolor" only if the terminal used by Emacs actually supports true +color. Emacs does not have any means of verifying that this support +is available, it takes the fact that the variable is defined to this +value as an indication that true color support is, in fact, available, +and uses color setting commands that COLORTERM=truecolor presumes, +bypassing the usual Terminfo capabilities related to colors. + +Some text-mode terminals, such as GNOME Terminal, are known to set +this environment variable, supposedly to announce their own support +for true color; however the setting is then inherited by any other +terminal emulators started from such a terminal, even though those +other terminal emulators might not themselves support true color using +the same commands as Emacs uses when it sees COLORTERM=truecolor. + +The solution is to either upgrade to a newer version of 'screen' +(version 5.x or later reportedly supports true color), or to unset the +COLORTERM variable before starting 'screen', and let Emacs use the +color support provided by the terminal emulator as defined in the +Terminfo database. + ** Unexpected characters inserted into the buffer when you start Emacs. See e.g. From f0a2f37deec868751542f5b67fc9e545570172ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sat, 18 Mar 2023 01:47:32 +0100 Subject: [PATCH 02/37] Fix toolbar item validation in the NS port * src/nsterm.m ([EmacsView validateToolbarItem:]): Implement this NSToolbarItemValidation method, which is called by AppKit when it needs to validate an image item in a toolbar. This solves, in particular, the problem with having the "Save" icon on the tool bar enabled at Emacs startup. (Bug#62234) --- src/nsterm.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index 4180cdc9e7f..c9f955000ac 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8581,6 +8581,10 @@ ns_in_echo_area (void) return self; } +- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem +{ + return [toolbarItem isEnabled]; +} - (instancetype)toggleToolbar: (id)sender { From 19c95b141606282915ed6c1a3f2c42a6b7a4420b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Mar 2023 10:31:56 +0200 Subject: [PATCH 03/37] Allow showing prefix commands in Help buffers * lisp/help.el (describe-bindings-show-prefix-commands): New user option. (describe-map): Use it to decide whether to output prefix commands. Patch by Bob Rogers . (Bug#62279) * etc/NEWS: Document 'describe-bindings-show-prefix-commands'. --- etc/NEWS | 8 +++++--- lisp/help.el | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 0b651f7a519..d7a6cf7986d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3565,11 +3565,13 @@ font spec. In these cases, replacing ":weight 'normal" with ":weight 'medium" should fix the issue. --- -** Keymap descriptions have changed. +** Keymap descriptions by Help commands have changed. 'help--describe-command', 'C-h b' and associated functions that output keymap descriptions have changed. In particular, prefix commands are -not output at all, and instead of "??" for closures/functions, -"[closure]"/"[lambda]" is output. +not output at all, and instead of "??" for closures/functions, these +functions output "[closure]"/"[lambda]". You can get back the old +behavior of including prefix commands by customizing the new option +'describe-bindings-show-prefix-commands' to a non-nil value. --- ** 'downcase' details have changed slightly. diff --git a/lisp/help.el b/lisp/help.el index 83be85b1ee4..3e94b5046e5 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -717,6 +717,12 @@ Return nil if KEYS is nil." :group 'help :version "29.1") +(defcustom describe-bindings-show-prefix-commands nil + "Non-nil means show prefix commands in the output of `describe-bindings'." + :type 'boolean + :group 'help + :version "29.1") + (declare-function outline-hide-subtree "outline") (defun describe-bindings (&optional prefix buffer) @@ -1699,6 +1705,7 @@ in `describe-map-tree'." (setq vect (cdr vect)) (setq end (caar vect)))) (when (or (not (eq start end)) + describe-bindings-show-prefix-commands ;; Don't output keymap prefixes. (not (keymapp definition))) (when first From 930b9fdd3ab9185e2faba8a08fbae81c82fa434a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 22 Mar 2023 13:52:50 -0400 Subject: [PATCH 04/37] Fix :predicate handling in globalized minor modes * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix a thinko. (Bug#62376) --- lisp/emacs-lisp/easy-mmode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 5721470ad0d..e84207da2df 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -509,7 +509,7 @@ on if the hook has explicitly disabled it. (setq turn-on-function `(lambda () (require 'easy-mmode) - (when (easy-mmode--globalized-predicate-p ,(car predicate)) + (when (easy-mmode--globalized-predicate-p ,MODE-predicate) (funcall ,turn-on-function))))) (_ (push keyw extra-keywords) (push (pop body) extra-keywords)))) From bcd02cf5127ecfe6d6ce4ac316f881246c49db4f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Mar 2023 11:30:19 +0200 Subject: [PATCH 05/37] ; Improve documentation of :predicate in globalized minor modes * doc/lispref/modes.texi (Defining Minor Modes): * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Improve documentation of the :predicate keyword in defining globalized minor modes. --- doc/lispref/modes.texi | 36 +++++++++++++++++++++-------------- lisp/emacs-lisp/easy-mmode.el | 26 ++++++++++++++++--------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index fff1ea65b07..d011962ade7 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1775,6 +1775,8 @@ it's used to say which major modes this minor mode is useful in. Any other keyword arguments are passed directly to the @code{defcustom} generated for the variable @var{mode}. +@xref{Variable Definitions}, for the description of those keywords and +their values. The command named @var{mode} first performs the standard actions such as setting the variable named @var{mode} and then executes the @var{body} @@ -1860,9 +1862,10 @@ by visiting files, and buffers that use a major mode other than Fundamental mode; but it does not detect the creation of a new buffer in Fundamental mode. -This defines the customization option @var{global-mode} (@pxref{Customization}), -which can be toggled in the Customize interface to turn the minor mode on -and off. As with @code{define-minor-mode}, you should ensure that the +This macro defines the customization option @var{global-mode} +(@pxref{Customization}), which can be toggled via the Customize +interface to turn the minor mode on and off. As with +@code{define-minor-mode}, you should ensure that the @code{define-globalized-minor-mode} form is evaluated each time Emacs starts, for example by providing a @code{:require} keyword. @@ -1875,24 +1878,27 @@ Use @code{:variable @var{variable}} if that's not the case--some minor modes use a different variable to store this state information. Generally speaking, when you define a globalized minor mode, you should -also define a non-globalized version, so that people can use (or -disable) it in individual buffers. This also allows them to disable a +also define a non-globalized version, so that people could use it (or +disable it) in individual buffers. This also allows them to disable a globally enabled minor mode in a specific major mode, by using that mode's hook. -If given a @code{:predicate} keyword, a user option called the same as -the global mode variable, but with @code{-modes} instead of -@code{-mode} at the end will be created. The variable is used as a -predicate that specifies which major modes the minor mode should be -activated in. Valid values include @code{t} (use in all major modes, -@code{nil} (use in no major modes), or a list of mode names (or -@code{(not mode-name ...)}) elements (as well as @code{t} and -@code{nil}). +If the macro is given a @code{:predicate} keyword, it will create a +user option called the same as the global mode variable, but with +@code{-modes} instead of @code{-mode} at the end, i.e.@: +@code{@var{global-mode}s}. This variable will be used in a predicate +function that determines whether the minor mode should be activated in +a particular major mode. Valid values of @code{:predicate} include +@code{t} (use in all major modes), @code{nil} (don't use in any major +modes), or a list of mode names, optionally preceded with @code{not} +(as in @w{@code{(not @var{mode-name} @dots{})}}). These elements can +be mixed, as shown in the following examples. @example (c-mode (not mail-mode message-mode) text-mode) @end example +@noindent This means ``use in modes derived from @code{c-mode}, and not in modes derived from @code{message-mode} or @code{mail-mode}, but do use in modes derived from @code{text-mode}, and otherwise no other @@ -1902,13 +1908,15 @@ modes''. ((not c-mode) t) @end example -This means ``don't use modes derived from @code{c-mode}, but use +@noindent +This means ``don't use in modes derived from @code{c-mode}, but do use everywhere else''. @example (text-mode) @end example +@noindent This means ``use in modes derived from @code{text-mode}, but nowhere else''. (There's an implicit @code{nil} element at the end.) @end defmac diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index e84207da2df..0f6711209a5 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -449,15 +449,23 @@ No problems result if this variable is not bound. TURN-ON is a function that will be called with no args in every buffer and that should try to turn MODE on if applicable for that buffer. -Each of KEY VALUE is a pair of CL-style keyword arguments. :predicate -specifies which major modes the globalized minor mode should be switched on -in. As the minor mode defined by this function is always global, any -:global keyword is ignored. Other keywords have the same meaning as in -`define-minor-mode', which see. In particular, :group specifies the custom -group. The most useful keywords are those that are passed on to the -`defcustom'. It normally makes no sense to pass the :lighter or :keymap -keywords to `define-globalized-minor-mode', since these are usually passed -to the buffer-local version of the minor mode. +Each of KEY VALUE is a pair of CL-style keyword arguments. +The :predicate argument specifies in which major modes should the +globalized minor mode be switched on. The value should be t (meaning +switch on the minor mode in all major modes), nil (meaning don't +switch on in any major mode), a list of modes (meaning switch on only +in those modes and their descendants), or a list (not MODES...), +meaning switch on in any major mode except MODES. The value can also +mix all of these forms, see the info node `Defining Minor Modes' for +details. +As the minor mode defined by this function is always global, any +:global keyword is ignored. +Other keywords have the same meaning as in `define-minor-mode', +which see. In particular, :group specifies the custom group. +The most useful keywords are those that are passed on to the `defcustom'. +It normally makes no sense to pass the :lighter or :keymap keywords +to `define-globalized-minor-mode', since these are usually passed to +the buffer-local version of the minor mode. BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running From 1bc9dfc5bee5c69d82f9a3ed448ba2fefea82a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Tue, 21 Mar 2023 14:55:57 +0000 Subject: [PATCH 06/37] ; Minor copyedits to Eglot manual * doc/misc/eglot.texi (Troubleshooting Eglot): Minor fixes. --- doc/misc/eglot.texi | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index defdf59e865..fc5449b0e8d 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1298,9 +1298,9 @@ user. To report an Eglot bug, send e-mail to @email{bug-gnu-emacs@@gnu.org}. -Get acquainted with Emacs's bug reporting guidelines (@pxref{Bugs,,, -emacs, GNU Emacs Manual}). Then, follow this checklist specific to -Eglot bug rerpots. +To understand how to write this email, get acquainted with Emacs's bug +reporting guidelines (@pxref{Bugs,,, emacs, GNU Emacs Manual}). Then, +follow this Eglot-specific checklist: @enumerate @item @@ -1341,18 +1341,18 @@ since they are usually implicitly loaded when visiting a file in that language. ELPA packages usually live in @code{~/.emacs.d/elpa} (or what is in -@code{package-user-dir}). Please show the listing of files in that -directory as well. +@code{package-user-dir}). Including a listing of files in that +directory is a way to tell the maintainers about ELPA package +versions. @item Include a recipe to replicate the problem with @emph{a clean Emacs -run}. This means @kbd{emacs -Q -f package-initialize} invocation -which starts Emacs with no configuration and initializes the ELPA -packages. A very minimal (no more that 10 lines) @file{.emacs} -initialization file is also acceptable and good means to describe -changes to variables. +run}. The invocation @code{emacs -Q -f package-initialize} starts +Emacs with no configuration and initializes the ELPA packages. A very +minimal @file{.emacs} initialization file (10 lines or less) is also +acceptable and good means to describe changes to variables. -There is usually no need to include @kbd{require} statements in the +There is usually no need to include @code{require} statements in the recipe, as Eglot's functionality uses autoloads. Likewise, there is rarely the need to use things like @@ -1364,9 +1364,9 @@ adding to hooks with @code{add-hook}. Prefer starting Eglot with @item Make sure to double check all the above elements and re-run the recipe to see that the problem is reproducible. Following the recipe should -produce event transcript and error backtraces that are exactly the -same or very similar to the ones you included. If the problem only -happens sometimes, include this information in your bug report. +produce event transcript and error backtraces that are very similar to +the ones you included. If the problem only happens sometimes, mention +this in your report. @end enumerate Please keep in mind that some problems reported against Eglot may From 82523dc621ace104d8f379509a436fcb03c48c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 23 Mar 2023 10:25:17 +0000 Subject: [PATCH 07/37] Fix Eglot progress reporting When the server sends an "end" message, Emacs's progress reporters should also be updated. * lisp/progmodes/eglot.el (eglot-handle-notification $/progress): Rework. --- lisp/progmodes/eglot.el | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 76f70ead666..b4116dc4aaf 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2159,22 +2159,24 @@ COMMAND is a symbol naming the command." (server (_method (eql $/progress)) &key token value) "Handle $/progress notification identified by TOKEN from SERVER." (when eglot-report-progress - (cl-flet ((fmt (&rest args) (mapconcat #'identity args " "))) + (cl-flet ((fmt (&rest args) (mapconcat #'identity args " ")) + (upd (pcnt msg &optional + (pr (gethash token (eglot--progress-reporters server)))) + (when pr (progress-reporter-update pr pcnt msg)))) (eglot--dbind ((WorkDoneProgress) kind title percentage message) value (pcase kind ("begin" - (let* ((prefix (format (concat "[eglot] %s %s:" (when percentage " ")) - (eglot-project-nickname server) token)) - (pr (puthash token - (if percentage - (make-progress-reporter prefix 0 100 percentage 1 0) - (make-progress-reporter prefix nil nil nil 1 0)) - (eglot--progress-reporters server)))) - (progress-reporter-update pr percentage (fmt title message)))) - ("report" - (when-let ((pr (gethash token (eglot--progress-reporters server)))) - (progress-reporter-update pr percentage (fmt title message)))) - ("end" (remhash token (eglot--progress-reporters server)))))))) + (let ((prefix (format (concat "[eglot] %s %s:" (when percentage " ")) + (eglot-project-nickname server) token))) + (upd percentage (fmt title message) + (puthash token + (if percentage + (make-progress-reporter prefix 0 100 percentage 1 0) + (make-progress-reporter prefix nil nil nil 1 0)) + (eglot--progress-reporters server))))) + ("report" (upd percentage (fmt title message))) + ("end" (upd (or percentage 100) (fmt title message)) + (remhash token (eglot--progress-reporters server)))))))) (cl-defmethod eglot-handle-notification (_server (_method (eql textDocument/publishDiagnostics)) &key uri diagnostics From be8147c53f9dd2d896c27d5b32bf4f38b0af9b3f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 23 Mar 2023 15:33:04 +0200 Subject: [PATCH 08/37] Improve "Bugs" in the Emacs manual * doc/emacs/trouble.texi (Bugs, Known Problems) (Understanding Bug Reporting, Checklist, Sending Patches) (Contributing, Coding Standards): Improve wording, structure, markup, and indexing. (Bug#62320) --- doc/emacs/trouble.texi | 654 ++++++++++++++++++++++------------------- 1 file changed, 356 insertions(+), 298 deletions(-) diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index e168514fcb9..ded9d02cf54 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -496,8 +496,43 @@ Customization}. If you think you have found a bug in Emacs, please report it. We cannot promise to fix it, or always to agree that it is a bug, but we certainly want to hear about it. The same applies for new features -you would like to see added. The following sections will help you to -construct an effective bug report. +you would like to see added. This section will help you to determine +whether you found a bug, and if so, construct an effective bug report. + +The general procedure when you find something that could be a bug is +as follows: + +@itemize @bullet +@item +See if what you found is a known problem or a bug that was already +reported and/or fixed. @xref{Known Problems}, where you will find how +to look for known problems and bugs. + +@item +If you are unsure whether the behavior you see is a bug, see @ref{Bug +Criteria}, which tells what we consider as clear bugs in Emacs. + +@item +Once you decide you found a bug, see @ref{Understanding Bug +Reporting}, which helps you in describing what you see in the most +efficient manner, making our job of reproducing the issue and +investigating it easier. + +@item +Next, see @ref{Checklist, Checklist for Bug Reports}, where we +describe in detail how to submit a bug report and what information to +include in it. In a nutshell, you submit a bug report via electronic +mail using the Emacs command @code{report-emacs-bug}, which assists +you in doing so. Submitting a bug report starts the process of +investigating and fixing the bug, where you will receive copies of +email messages discussing the bug, in which we might ask you to +provide more information, test possible fixes, etc. + +@item +Finally, if you want to propose specific changes to Emacs, whether to +fix a bug, add a new feature, or improve our documentation, please see +@ref{Sending Patches}, for details about submitting such changes. +@end itemize @menu * Known Problems:: How to read about known problems and bugs. @@ -509,9 +544,10 @@ construct an effective bug report. @node Known Problems @subsection Reading Existing Bug Reports and Known Problems +@cindex known bugs and problems - Before reporting a bug, if at all possible please check to see if it -is already known about. Indeed, it may already have been fixed in a + Before reporting a bug, if at all possible, please check to see if +we already know about it. Indeed, it may already have been fixed in a later release of Emacs, or in the development version. Here is a list of the main places you can read about known issues: @@ -519,20 +555,26 @@ of the main places you can read about known issues: @item The @file{etc/PROBLEMS} file; type @kbd{C-h C-p} to read it. This file contains a list of particularly well-known issues that have been -encountered in compiling, installing and running Emacs. Often, there -are suggestions for workarounds and solutions. +encountered in compiling, installing and running Emacs, with special +emphasis on issues caused by other software that cannot be easily +solved in Emacs. Often, you will find there suggestions for +workarounds and solutions. @cindex bug tracker +@cindex issue tracker +@cindex search known bugs @item -The GNU Bug Tracker at @url{https://debbugs.gnu.org}. Emacs bugs are -filed in the tracker under the @samp{emacs} package. The tracker -records information about the status of each bug, the initial bug -report, and the follow-up messages by the bug reporter and Emacs -developers. You can search for bugs by subject, severity, and other -criteria. +The GNU Bug Tracker at @url{https://debbugs.gnu.org}. Emacs bugs and +issues are filed in the tracker under the @samp{emacs} package. The +tracker records information about the status of each bug, the initial +bug report, and the follow-up messages by the bug reporter and Emacs +developers who participate in discussing and fixing the bug. You can +search for bugs by subject, severity, and other criteria. For more +complex search criteria, use +@url{https://debbugs.gnu.org/cgi/search.cgi}. @cindex debbugs package -Instead of browsing the bug tracker as a webpage, you can browse it +Instead of browsing the bug tracker as a web page, you can browse it from Emacs using the @code{debbugs} package, which can be downloaded via the Package Menu (@pxref{Packages}). This package provides the command @kbd{M-x debbugs-gnu} to list bugs, and @kbd{M-x @@ -558,14 +600,14 @@ used, and is mainly of historical interest. At one time, it was used for bug reports in development (i.e., not yet released) versions of Emacs. You can read the archives for 2003 to mid 2007 at @url{https://lists.gnu.org/r/emacs-pretest-bug/}. Nowadays, -it is an alias for @samp{bug-gnu-emacs}. +email messages sent to this list are redirected to +@samp{bug-gnu-emacs}. @item The @samp{emacs-devel} mailing list. Sometimes people report bugs to this mailing list. This is not the main purpose of the list, however, and it is much better to send bug reports to the bug list. You should not feel obliged to read this list before reporting a bug. - @end itemize @@ -628,20 +670,21 @@ to begin by reporting them to the package developers. @node Understanding Bug Reporting @subsection Understanding Bug Reporting -@cindex bug reporting +@cindex bug reporting, principles @cindex report an Emacs bug, how to - When you decide that there is a bug, it is important to report it + When you decide that there is a bug, it is important to report it, and to report it in a way which is useful. What is most useful is an exact description of what commands you type, starting with the shell -command to run Emacs, until the problem happens. +command to run Emacs, until the problem happens, and the effects +produced by typing those commands. The most important principle in reporting a bug is to report @emph{facts}. Hypotheses and verbal descriptions are no substitute for the detailed raw data. Reporting the facts is straightforward, but many people strain to posit explanations and report them instead of the facts. If the explanations are based on guesses about how -Emacs is implemented, they will be useless; meanwhile, lacking the +Emacs is implemented, they night not be useful; meanwhile, lacking the facts, we will have no real information about the bug. If you want to actually @emph{debug} the problem, and report explanations that are more than guesses, that is useful---but please include the raw facts @@ -661,19 +704,23 @@ problem. There is no way we could guess that we should try visiting a file with a @samp{z} in its name. You should not even say ``visit a file'' instead of @kbd{C-x C-f}. -Similarly, rather than saying ``if I have three characters on the -line'', say ``after I type @kbd{@key{RET} A B C @key{RET} C-p}'', if -that is the way you entered the text. +That's because a file can be visited in more than one way, and there's +no certainty that all of them reproduce the problem. Similarly, +rather than saying ``if I have three characters on the line'', say +``after I type @kbd{@key{RET} A B C @key{RET} C-p}'', if that is the +way you entered the text---that is, tell us about the text which in +your case produced the problem. If possible, try quickly to reproduce the bug by invoking Emacs with @command{emacs -Q} (so that Emacs starts with no initial customizations; @pxref{Initial Options}), and repeating the steps that you took to trigger the bug. If you can reproduce the bug this way, -that rules out bugs in your personal customizations. Then your bug -report should begin by stating that you started Emacs with -@command{emacs -Q}, followed by the exact sequence of steps for -reproducing the bug. If possible, inform us of the exact contents of -any file that is needed to reproduce the bug. +that rules out bugs in your personal customizations and makes the bug +much easier to reproduce. Then your bug report should begin by +stating that you started Emacs with @command{emacs -Q}, followed by +the exact sequence of steps for reproducing the bug. If possible, +inform us of the exact contents of any file that is needed to +reproduce the bug. Some bugs are not reproducible from @command{emacs -Q}; some are not easily reproducible at all. In that case, you should report what you @@ -687,6 +734,7 @@ separate bug report for each. @subsection Checklist for Bug Reports @cindex checklist before reporting a bug @cindex bug reporting, checklist +@cindex report bugs in Emacs Before reporting a bug, first try to see if the problem has already been reported (@pxref{Known Problems}). @@ -706,7 +754,7 @@ information; you should still read and follow the guidelines below, so you can enter the other crucial information by hand before you send the message. You may feel that some of the information inserted by @kbd{M-x report-emacs-bug} is not relevant, but unless you are -absolutely sure it is best to leave it, so that the developers can +absolutely sure, it is best to leave it, so that the developers can decide for themselves. When you have finished writing your report, type @kbd{C-c C-c} and it @@ -721,24 +769,26 @@ If you cannot send mail from inside Emacs, you can copy the text of your report to your normal mail client (if your system supports it, you can type @kbd{C-c M-i} to have Emacs do this for you) and send it to that address. Or you can simply send an email to that -address describing the problem. +address describing the problem, including the necessary information +mentioned below. If you want to submit code to Emacs (to fix a problem or implement a new feature), the easiest way to do this is to send a patch to the -Emacs issue tracker. This is done with the @kbd{M-x -submit-emacs-patch} command, and works much the same as when reporting -bugs. +Emacs issue tracker. Use the @kbd{M-x submit-emacs-patch} command for +that, which works much the same as when reporting bugs; @pxref{Sending +Patches}. In any case, your report will be sent to the @samp{bug-gnu-emacs} mailing list, and stored in the GNU Bug Tracker at @url{https://debbugs.gnu.org}. Please include a valid reply email address, in case we need to ask you for more information about your report. Submissions are moderated, so there may be a delay before -your report appears. +your report actually appears on the tracker. You do not need to know how the GNU Bug Tracker works in order to -report a bug, but if you want to, you can read the tracker's online -documentation to see the various features you can use. +report a bug, but if you want to, you can read the tracker's +@uref{https://debbugs.gnu.org/Advanced.html, online documentation} to +see the various features you can use. All mail sent to the @samp{bug-gnu-emacs} mailing list is also gatewayed to the @samp{gnu.emacs.bug} newsgroup. The reverse is also @@ -749,55 +799,43 @@ tracker. If your data is more than 500,000 bytes, please don't include it directly in the bug report; instead, offer to send it on request, or -make it available online and say where. +make it available online and say where. Large attachments are best +sent compressed. The GNU Bug Tracker will assign a bug number to your report; please -use it in the following discussions. +use it in the following discussions, keeping the bug address in the +list of recipients, so that the bug discussion is recorded by the +tracker. The bug address will look like +@samp{@var{nnnnn}@@debbugs.gnu.org}, where @var{nnnnn} is the bug +number. To enable maintainers to investigate a bug, your report should include all these things: @itemize @bullet @item -The version number of Emacs. Without this, we won't know whether there is any -point in looking for the bug in the current version of GNU Emacs. +A description of what behavior you observe that you believe is +incorrect. For example, ``The Emacs process gets a fatal signal'', or, +``The resulting text is as follows, which I think is wrong.'' -@findex emacs-version -@kbd{M-x report-emacs-bug} includes this information automatically, -but if you are not using that command for your report you can get the -version number by typing @kbd{M-x emacs-version @key{RET}}. If that -command does not work, you probably have something other than GNU -Emacs, so you will have to report the bug somewhere else. +Of course, if the bug is that Emacs gets a fatal signal, then one can't +miss it. But if the bug is incorrect text, the maintainer might fail to +notice what is wrong. Why leave it to chance? -@item -The type of machine you are using, and the operating system name and -version number (again, automatically included by @w{@kbd{M-x -report-emacs-bug}}). @w{@kbd{M-x emacs-version @key{RET}}} provides -this information too. Copy its output from the @file{*Messages*} -buffer, so that you get it all and get it accurately, or use -@w{@kbd{C-u M-x emacs-version @key{RET}}} to insert the version -information into the current buffer. +Even if the problem you experience is a fatal signal, you should still +say so explicitly. Suppose something strange is going on, such as, your +copy of the source is out of sync, or you have encountered a bug in the +C library on your system. (This has happened!) Your copy might crash +and the copy here might not. If you @emph{said} to expect a crash, then +when Emacs here fails to crash, we would know that the bug was not +happening. If you don't say to expect a crash, then we would not know +whether the bug was happening---we would not be able to draw any +conclusion from our observations. -@item -The operands given to the @code{configure} command when Emacs was -installed (automatically included by @kbd{M-x report-emacs-bug}). - -@item -A complete list of any modifications you have made to the Emacs source. -(We may not have time to investigate the bug unless it happens in an -unmodified Emacs. But if you've made modifications and you don't tell -us, you are sending us on a wild goose chase.) - -Be precise about these changes. A description in English is not -enough---send a unified context diff for them. - -Adding files of your own, or porting to another machine, is a -modification of the source. - -@item -Details of any other deviations from the standard procedure for installing -GNU Emacs. +Usually, description of the behavior and of the way to reproduce the +problem needs to specify one or more of the following aspects: +@itemize @minus @item The complete text of any files needed to reproduce the bug. @@ -824,73 +862,6 @@ file until the Emacs process is killed. Be aware that sensitive information (such as passwords) may end up recorded in the dribble file. -@item -@findex open-termscript -@cindex termscript file -@vindex TERM@r{, environment variable, and display bugs} -For possible display bugs on text-mode terminals, the terminal type -(the value of environment variable @env{TERM}), the complete termcap -entry for the terminal from @file{/etc/termcap} (since that file is -not identical on all machines), and the output that Emacs actually -sent to the terminal. - -The way to collect the terminal output is to execute the Lisp expression - -@example -(open-termscript "~/termscript") -@end example - -@noindent -using @kbd{M-:} or from the @file{*scratch*} buffer just after -starting Emacs. From then on, Emacs copies all terminal output to the -specified termscript file as well, until the Emacs process is killed. -If the problem happens when Emacs starts up, put this expression into -your Emacs initialization file so that the termscript file will be -open when Emacs displays the screen for the first time. - -Be warned: it is often difficult, and sometimes impossible, to fix a -terminal-dependent bug without access to a terminal of the type that -stimulates the bug. - -@item -If non-@acronym{ASCII} text or internationalization is relevant, the locale that -was current when you started Emacs. On GNU/Linux and Unix systems, or -if you use a POSIX-style shell such as Bash, you can use this shell -command to view the relevant values: - -@smallexample -echo LC_ALL=$LC_ALL LC_COLLATE=$LC_COLLATE LC_CTYPE=$LC_CTYPE \ - LC_MESSAGES=$LC_MESSAGES LC_TIME=$LC_TIME LANG=$LANG -@end smallexample - -Alternatively, use the @command{locale} command, if your system has it, -to display your locale settings. - -You can use the @kbd{M-!} command to execute these commands from -Emacs, and then copy the output from the @file{*Messages*} buffer into -the bug report. Alternatively, @kbd{M-x getenv @key{RET} LC_ALL -@key{RET}} will display the value of @code{LC_ALL} in the echo area, and -you can copy its output from the @file{*Messages*} buffer. - -@item -A description of what behavior you observe that you believe is -incorrect. For example, ``The Emacs process gets a fatal signal'', or, -``The resulting text is as follows, which I think is wrong.'' - -Of course, if the bug is that Emacs gets a fatal signal, then one can't -miss it. But if the bug is incorrect text, the maintainer might fail to -notice what is wrong. Why leave it to chance? - -Even if the problem you experience is a fatal signal, you should still -say so explicitly. Suppose something strange is going on, such as, your -copy of the source is out of sync, or you have encountered a bug in the -C library on your system. (This has happened!) Your copy might crash -and the copy here might not. If you @emph{said} to expect a crash, then -when Emacs here fails to crash, we would know that the bug was not -happening. If you don't say to expect a crash, then we would not know -whether the bug was happening---we would not be able to draw any -conclusion from our observations. - @item If the bug is that the Emacs Manual or the Emacs Lisp Reference Manual fails to describe the actual behavior of Emacs, or that the text is @@ -906,33 +877,6 @@ To get the error message text accurately, copy it from the @file{*Messages*} buffer into the bug report. Copy all of it, not just part. -@findex toggle-debug-on-error -@pindex Edebug -To make a backtrace for the error, use @kbd{M-x toggle-debug-on-error} -before the error happens (that is to say, you must give that command -and then make the bug happen). This causes the error to start the Lisp -debugger, which shows you a backtrace. Copy the text of the -debugger's backtrace into the bug report. @xref{Edebug,, Edebug, -elisp, the Emacs Lisp Reference Manual}, for information on debugging -Emacs Lisp programs with the Edebug package. - -This use of the debugger is possible only if you know how to make the -bug happen again. If you can't make it happen again, at least copy -the whole error message. - -@vindex debug-on-quit -If Emacs appears to be stuck in an infinite loop or in a very long -operation, typing @kbd{C-g} with the variable @code{debug-on-quit} -non-@code{nil} will start the Lisp debugger and show a backtrace. -This backtrace is useful for debugging such long loops, so if you can -produce it, copy it into the bug report. - -@vindex debug-on-event -If you cannot get Emacs to respond to @kbd{C-g} (e.g., because -@code{inhibit-quit} is set), then you can try sending the signal -specified by @code{debug-on-event} (default SIGUSR2) from outside -Emacs to cause it to enter the debugger. - @item Check whether any programs you have loaded into the Lisp world, including your initialization file, set any variables that may affect @@ -960,65 +904,89 @@ code is in your version at a given line number, and we could not be certain. @item -Additional information from a C debugger such as GDB might enable -someone to find a problem on a machine which he does not have available. -If you don't know how to use GDB, please read the GDB manual---it is not -very long, and using GDB is easy. You can find the GDB distribution, -including the GDB manual in online form, in most of the same places you -can find the Emacs distribution. To run Emacs under GDB, you should -switch to the @file{src} subdirectory in which Emacs was compiled, then -do @samp{gdb emacs}. It is important for the directory @file{src} to be -current so that GDB will read the @file{.gdbinit} file in this -directory. +@findex open-termscript +@cindex termscript file +@vindex TERM@r{, environment variable, and display bugs} +For possible display bugs on text-mode terminals, the terminal type +(the value of environment variable @env{TERM}), the complete termcap +entry for the terminal from @file{/etc/termcap} (since that file is +not identical on all machines), and the output that Emacs actually +sent to the terminal. -However, you need to think when you collect the additional information -if you want it to show what causes the bug. +The way to collect the terminal output is to invoke the command +@kbd{M-x open-termscript} just after starting Emacs; it will prompt +you for the name of the file where to record all terminal output until +the Emacs process is killed. If the problem happens when Emacs starts +up, put the Lisp expression -@cindex backtrace for bug reports -For example, many people send just a C-level backtrace, but that is -not very useful by itself. A simple backtrace with arguments often -conveys little about what is happening inside GNU Emacs, because most -of the arguments listed in the backtrace are pointers to Lisp objects. -The numeric values of these pointers have no significance whatever; -all that matters is the contents of the objects they point to (and -most of the contents are themselves pointers). +@example +(open-termscript "~/termscript") +@end example -@findex debug_print -To provide useful information, you need to show the values of Lisp -objects in Lisp notation. Do this for each variable which is a Lisp -object, in several stack frames near the bottom of the stack. Look at -the source to see which variables are Lisp objects, because the debugger -thinks of them as integers. +@noindent +into your Emacs initialization file so that the termscript file will +be open when Emacs displays the screen for the first time. -To show a variable's value in Lisp syntax, first print its value, then -use the user-defined GDB command @code{pr} to print the Lisp object in -Lisp syntax. (If you must use another debugger, call the function -@code{debug_print} with the object as an argument.) The @code{pr} -command is defined by the file @file{.gdbinit}, and it works only if you -are debugging a running process (not with a core dump). +Be warned: it is often difficult, and sometimes impossible, to fix a +terminal-dependent bug without access to a terminal of the type that +stimulates the bug. +@end itemize -To make Lisp errors stop Emacs and return to GDB, put a breakpoint at -@code{Fsignal}. +@item +The version number of Emacs. Without this, we won't know whether there is any +point in looking for the bug in the current version of GNU Emacs. -For a short listing of Lisp functions running, type the GDB -command @code{xbacktrace}. +@findex emacs-version +@kbd{M-x report-emacs-bug} includes this information automatically, +but if you are not using that command for your report you can get the +version number by typing @kbd{M-x emacs-version @key{RET}}. If that +command does not work, you probably have something other than GNU +Emacs, so you will have to report the bug somewhere else. -The file @file{.gdbinit} defines several other commands that are useful -for examining the data types and contents of Lisp objects. Their names -begin with @samp{x}. These commands work at a lower level than -@code{pr}, and are less convenient, but they may work even when -@code{pr} does not, such as when debugging a core dump or when Emacs has -had a fatal signal. +@item +The type of machine you are using, and the operating system name and +version number (again, automatically included by @w{@kbd{M-x +report-emacs-bug}}). @w{@kbd{M-x emacs-version @key{RET}}} provides +this information too. Copy its output from the @file{*Messages*} +buffer, so that you get it all and get it accurately, or use +@w{@kbd{C-u M-x emacs-version @key{RET}}} to insert the version +information into the current buffer. -@cindex debugging Emacs, tricks and techniques -More detailed advice and other useful techniques for debugging Emacs -are available in the file @file{etc/DEBUG} in the Emacs distribution. -That file also includes instructions for investigating problems -whereby Emacs stops responding (many people assume that Emacs is -``hung'', whereas in fact it might be in an infinite loop). +@item +The command-line arguments given to the @code{configure} command when +Emacs was built (automatically included by @kbd{M-x +report-emacs-bug}). -To find the file @file{etc/DEBUG} in your Emacs installation, use the -directory name stored in the variable @code{data-directory}. +@item +A complete list of any modifications you have made to the Emacs source. +(We may not have time to investigate the bug unless it happens in an +unmodified Emacs. But if you've made modifications and you don't tell +us, you are sending us on a wild goose chase.) + +Be precise about these changes. A description in English is not +enough---send a unified context diff for them. + +Adding files of your own, or porting to another machine, is a +modification of the source. + +@item +Details of any other deviations from the standard procedure for installing +GNU Emacs. + +@item +If non-@acronym{ASCII} text or internationalization is relevant, the locale that +was current when you started Emacs. This is automatically included by @kbd{M-x +report-emacs-bug}; alternatively, on GNU/Linux and Unix systems, or +if you use a POSIX-style shell such as Bash, you can use this shell +command to view the relevant values: + +@smallexample +echo LC_ALL=$LC_ALL LC_COLLATE=$LC_COLLATE LC_CTYPE=$LC_CTYPE \ + LC_MESSAGES=$LC_MESSAGES LC_TIME=$LC_TIME LANG=$LANG +@end smallexample + +You can also use the @command{locale} command, if your system has it, +to display your locale settings. @end itemize Here are some things that are not necessary in a bug report: @@ -1075,17 +1043,13 @@ objects with @code{pr} (see above). A patch for the bug. A patch for the bug is useful if it is a good one. But don't omit the -other information that a bug report needs, such as the test case, on the -assumption that a patch is sufficient. We might see problems with your -patch and decide to fix the problem another way, or we might not +other information that a bug report needs, such as the test case, on +the assumption that a patch is sufficient. We might see problems with +your patch and decide to fix the problem another way, or we might not understand it at all. And if we can't understand what bug you are trying to fix, or why your patch should be an improvement, we mustn't -install it. - -@ifnottex -@xref{Sending Patches}, for guidelines on how to make it easy for us to -understand and install your patches. -@end ifnottex +install it. @xref{Sending Patches}, for guidelines on how to make it +easy for us to understand and install your patches. @item A guess about what the bug is or what it depends on. @@ -1094,6 +1058,104 @@ Such guesses are usually wrong. Even experts can't guess right about such things without first using the debugger to find the facts. @end itemize +If you are willing to debug Emacs and provide additional information +about the bug, here is some useful advice: + +@findex toggle-debug-on-error +@pindex Edebug +@itemize +@item +If the bug manifests itself as an error message, try providing a Lisp +backtrace for the error. To make a backtrace for the error, use +@kbd{M-x toggle-debug-on-error} before the error happens (that is to +say, you must give that command and then make the bug happen). This +causes the error to start the Lisp debugger, which shows you a +backtrace. Copy the text of the debugger's backtrace into the bug +report. @xref{Edebug,, Edebug, elisp, the Emacs Lisp Reference +Manual}, for information on debugging Emacs Lisp programs with the +Edebug package. + +This use of the debugger is possible only if you know how to make the +bug happen again. If you can't make it happen again, at least copy +the whole error message. + +@vindex debug-on-quit +@item +If Emacs appears to be stuck in an infinite loop or in a very long +operation, typing @kbd{C-g} with the variable @code{debug-on-quit} +non-@code{nil} will start the Lisp debugger and show a backtrace. +This backtrace is useful for debugging such long loops, so if you can +produce it, copy it into the bug report. + +@vindex debug-on-event +If you cannot get Emacs to respond to @kbd{C-g} (e.g., because +@code{inhibit-quit} is set), then you can try sending the signal +specified by @code{debug-on-event} (default SIGUSR2) from outside +Emacs to cause it to enter the debugger. + +@item +Additional information from a C debugger such as GDB might enable +someone to find a problem on a machine which he does not have available. +If you don't know how to use GDB, please read the GDB manual---it is not +very long, and using GDB is easy. You can find the GDB distribution, +including the GDB manual in online form, in most of the same places you +can find the Emacs distribution. To run Emacs under GDB, you should +switch to the @file{src} subdirectory in which Emacs was compiled, then +type @kbd{gdb ./emacs}. It is important for the directory @file{src} to be +current so that GDB will read the @file{.gdbinit} file in this +directory. (You can also tell GDB to read that file from inside GDB, +by typing @kbd{source ./.gdbinit}.) + +However, you need to think when you collect the additional information +if you want it to show what causes the bug. + +@cindex backtrace for bug reports +For example, many people send just a C-level backtrace, but that is +not very useful by itself. A simple backtrace with arguments often +conveys little about what is happening inside GNU Emacs, because most +of the arguments listed in the backtrace are pointers to Lisp objects. +The numeric values of these pointers have no significance whatever; +all that matters is the contents of the objects they point to (and +most of the contents are themselves pointers). + +@findex debug_print +To provide useful information, you need to show the values of Lisp +objects in Lisp notation. Do this for each variable which is a Lisp +object, in several stack frames near the bottom of the stack. Look at +the source to see which variables are Lisp objects, because the debugger +thinks of them as integers. + +To show a variable's value in Lisp syntax, first print its value, then +use the user-defined GDB command @code{pr} to print the Lisp object in +Lisp syntax. (If you must use another debugger, call the function +@code{debug_print} with the object as an argument.) The @code{pr} +command is defined by the file @file{.gdbinit}, and it works only if you +are debugging a running process (not with a core dump). + +To make Lisp errors stop Emacs and return to GDB, put a breakpoint at +@code{Fsignal}. + +For a backtrace of Lisp functions running, type the GDB command +@code{xbacktrace}. + +The file @file{.gdbinit} defines several other commands that are useful +for examining the data types and contents of Lisp objects. Their names +begin with @samp{x}. These commands work at a lower level than +@code{pr}, and are less convenient, but they may work even when +@code{pr} does not, such as when debugging a core dump or when Emacs has +had a fatal signal. + +@cindex debugging Emacs, tricks and techniques +More detailed advice and other useful techniques for debugging Emacs +are available in the file @file{etc/DEBUG} in the Emacs distribution. +That file also includes instructions for investigating problems +whereby Emacs stops responding (many people assume that Emacs is +``hung'', whereas in fact it might be in an infinite loop). + +To find the file @file{etc/DEBUG} in your Emacs installation, use the +directory name stored in the variable @code{data-directory}. +@end itemize + @node Sending Patches @subsection Sending Patches for GNU Emacs @@ -1108,26 +1170,29 @@ work in the best of circumstances, and we can't keep up unless you do your best to help. Every patch must have several pieces of information before we -can properly evaluate it. +can properly evaluate it. They are described below. -When you have all these pieces, bundle them up in a mail message and -send it to the developers. Sending it to -@email{bug-gnu-emacs@@gnu.org} (which is the bug/feature list) is -recommended, because that list is coupled to a tracking system that -makes it easier to locate patches. If your patch is not complete and -you think it needs more discussion, you might want to send it to -@email{emacs-devel@@gnu.org} instead. If you revise your patch, -send it as a followup to the initial topic. +When you have all these pieces, use the @kbd{M-x submit-emacs-patch} +command to send the patch. The command will prompt you for the +Subject of the patch and a patch file. It will then create and +display a Message mode buffer with the patch file as an attachment, +display the buffer, and let you explain more about the patch and add +any other information as requested below. When you are done, type +@kbd{C-c C-c} to send the patch via email to the developers. It will +be sent to the GNU Bug Tracker at @url{https://debbugs.gnu.org}. The +tracker will assign a number to your submission, just like it does +with bug reports. The developers will usually respond, perhaps asking +you for more details or any additional information, so be sure to +include a valid reply email address. -We prefer to get the patches as plain text, either inline (be careful -your mail client does not change line breaks) or as MIME attachments. +Here's what we ask you to provide as part of your patch submissions: @itemize @bullet @item -Include an explanation with your changes of what problem they fix or what -improvement they bring about. +An explanation of what problem you are fixing or what improvement will +the patches bring about: -@itemize +@itemize @minus @item For a fix for an existing bug, it is best to reply to the relevant discussion on the @samp{bug-gnu-emacs} @@ -1140,26 +1205,28 @@ implementation. @item For a new bug, include a proper bug report for the problem you think -you have fixed. We need to convince ourselves that the change is -right before installing it. Even if it is correct, we might have -trouble understanding it if we don't have a way to reproduce the -problem. +you have fixed; @pxref{Checklist, Checklist for Bug Reports}. We need +to convince ourselves that the change is right before installing it. +Even if it is correct, we might have trouble understanding it if we +don't have a way to reproduce the problem it tries to fix. @end itemize @item -Include all the comments that are appropriate to help people reading the -source in the future understand why this change was needed. +Include in your code changes all the comments that are appropriate to +help people reading the source in the future understand why this +change was needed. @item Don't mix together changes made for different reasons. Send them @emph{individually}. -If you make two changes for separate reasons, then we might not want to -install them both. We might want to install just one. If you send them -all jumbled together in a single set of diffs, we have to do extra work -to disentangle them---to figure out which parts of the change serve -which purpose. If we don't have time for this, we might have to ignore -your changes entirely. +If you make two changes for separate reasons, then we might not want +to install them both. We might want to install just one, or install +each one in a different versions of Emacs. If you send them all +jumbled together in a single set of diffs, we have to do extra work to +disentangle them---to figure out which parts of the change serve which +purpose. If we don't have time for this, we might have to postpone +inclusion of your patches for a long time. If you send each change as soon as you have written it, with its own explanation, then two changes never get tangled up, and we can consider @@ -1176,52 +1243,46 @@ right away. That gives us the option of installing it immediately if it is important. @item -The patch itself. - -Use @samp{diff -u} to make your diffs. Diffs without context are hard -to install reliably. More than that, they are hard to study; we must -always study a patch to decide whether we want to install it. Context -format is better than contextless diffs, but we prefer the unified -format. - -If you have GNU diff, use @samp{diff -u -F'^[_a-zA-Z0-9$]\+ *('} when -making diffs of C code. This shows the name of the function that each -change occurs in. +The patch itself. This can be produced in one of the following ways: +@itemize @minus +@item If you are using the Emacs repository, make sure your copy is up-to-date (e.g., with @code{git pull}). You can commit your changes to a private branch and generate a patch from the master version by -using @code{git format-patch master}. Or you can leave your changes -uncommitted and use @code{git diff}. +using @code{git format-patch master}. (This is the preferred method, +as it makes our job of applying the patch easier.) Or you can leave +your changes uncommitted and use @code{git diff}, as described below. @item -Avoid any ambiguity as to which is the old version and which is the new. -Please make the old version the first argument to diff, and the new -version the second argument. And please give one version or the other a -name that indicates whether it is the old version or your new changed -one. +Use @kbd{diff -u} to make your diffs. If you have GNU diff, use +@w{@kbd{diff -u -F'^[_a-zA-Z0-9$]\+ *('}} when making diffs of C code. +This shows the name of the function that each change occurs in. + +When producing the diffs, avoid any ambiguity as to which is the old +version and which is the new. Please make the old version the first +argument to diff, and the new version the second argument. And please +give one version or the other a name that indicates whether it is the +old version or your new changed one. +@end itemize @item Write the commit log entries for your changes. This is both to save us the extra work of writing them, and to help explain your changes so we can understand them. -The purpose of the commit log is to show people where to find what was -changed. So you need to be specific about what functions you changed; -in large functions, it's often helpful to indicate where within the -function the change was. +The purpose of the commit log is to explain the rationale of the +changes, the way the modified code solves whatever problems your patch +is trying to fix, and also show people where to find what was changed. +So you need to be specific about what functions you changed and why. +For the details about our style and requirements for good commit log +messages, please see the ``Commit messages'' section of the file +@file{CONTRIBUTE} in the Emacs source tree. -On the other hand, once you have shown people where to find the change, -you need not explain its purpose in the change log. Thus, if you add a -new function, all you need to say about it is that it is new. If you -feel that the purpose needs explaining, it probably does---but put the -explanation in comments in the code. It will be more useful there. - -Please look at the commit log entries of recent commits to see what -sorts of information to put in, and to learn the style that we use. -Note that, unlike some other projects, we do require commit logs for -documentation, i.e., Texinfo files. -@xref{Change Log}, +Please also look at the commit log entries of recent commits to see +what sorts of information to put in, and to learn the style that we +use. Note that, unlike some other projects, we do require commit logs +for documentation, i.e., Texinfo files. @xref{Change Log}, @ifset WWW_GNU_ORG see @url{https://www.gnu.org/prep/standards/html_node/Change-Log-Concepts.html}, @@ -1232,7 +1293,7 @@ Change Log Concepts, standards, GNU Coding Standards}. @item When you write the fix, keep in mind that we can't install a change that would break other systems. Please think about what effect your change -will have if compiled on another type of system. +will have if compiled and/or used on another type of system. Sometimes people send fixes that @emph{might} be an improvement in general---but it is hard to be sure of this. It's hard to install @@ -1240,9 +1301,10 @@ such changes because we have to study them very carefully. Of course, a good explanation of the reasoning by which you concluded the change was correct can help convince us. -The safest changes are changes to the configuration files for a -particular machine. These are safe because they can't create new bugs -on other machines. +The safest changes are changes to the files or portions of files that +are only used for a particular machine or a particular system. These +are safe because they can't create new bugs on other machines or +systems. Please help us keep up with the workload by designing the patch in a form that is clearly safe to install. @@ -1259,7 +1321,7 @@ There are many ways to contribute to Emacs: @itemize @item -find and report bugs; @xref{Bugs}. +find and report bugs; @pxref{Bugs}. @item answer questions on the Emacs user mailing list @@ -1326,15 +1388,15 @@ before you start; it might be possible to suggest ways to make your extension fit in better with the rest of Emacs. When implementing a feature, please follow the Emacs coding standards; -@xref{Coding Standards}. In addition, non-trivial contributions -require a copyright assignment to the FSF; @xref{Copyright Assignment}. +@pxref{Coding Standards}. In addition, substantial contributions +require a copyright assignment to the FSF; @pxref{Copyright Assignment}. The development version of Emacs can be downloaded from the repository where it is actively maintained by a group of developers. See the Emacs project page @url{https://savannah.gnu.org/projects/emacs/} for access details. -It is important to write your patch based on the current working +It is important to write your patches based on the current working version. If you start from an older version, your patch may be outdated (so that maintainers will have a hard time applying it), or changes in Emacs may have made your patch unnecessary. After you have @@ -1397,7 +1459,7 @@ the Emacs Lisp Reference Manual @node Coding Standards @subsection Coding Standards -@cindex coding standards +@cindex coding standards for Emacs submissions Contributed code should follow the GNU Coding Standards @url{https://www.gnu.org/prep/standards/}. This may also be available @@ -1432,10 +1494,6 @@ to be included in Emacs. @item Remove all trailing whitespace in all source and text files. -@item -Emacs has no convention on whether to use tabs in source code; please -don't change whitespace in the files you edit. - @item Use @code{?\s} instead of @code{? } in Lisp code for a space character. @@ -1455,7 +1513,7 @@ packages stored in GNU ELPA, we require that the copyright be assigned to the FSF@. For the reasons behind this, see @url{https://www.gnu.org/licenses/why-assign.html}. -Copyright assignment is a simple process. Residents of some countries +Copyright assignment is a simple process. Residents of many countries can do it entirely electronically. We can help you get started, including sending you the forms you should fill, and answer any questions you may have (or point you to the people with the answers), From d93a439846f03dfb2be28d6b5c2e963ef6be0c22 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 23 Mar 2023 13:43:45 -0400 Subject: [PATCH 09/37] * lisp/help-fns.el (find-lisp-object-file-name): Fix bug#62376 part2 Nowadays `loaddefs.el` are byte-compiled, so adjust pattern accordingly --- lisp/help-fns.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a81051cee03..a1fc2267564 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -437,7 +437,7 @@ the C sources, too." (setq file-name (locate-file file-name load-path '(".el" ".elc") 'readable))) ((and (stringp file-name) - (string-match "[.]*loaddefs.el\\'" file-name)) + (string-match "[.]*loaddefs.elc?\\'" file-name)) ;; An autoloaded variable or face. Visit loaddefs.el in a buffer ;; and try to extract the defining file. The following form is ;; from `describe-function-1' and `describe-variable'. From 33d436eefa16dfd4cf53bd53fdd764b2896c649c Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 24 Mar 2023 00:17:10 -0700 Subject: [PATCH 10/37] Fix treesit_ensure_parsed (bug#62333) * src/treesit.c (treesit_ensure_parsed): Check for need_reparse after treesit_sync_visible_region runs, because as the comment says, treesit_sync_visible_region might modify need_reparse. --- src/treesit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/treesit.c b/src/treesit.c index 5a4fe3e8803..1bb52888f4b 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1016,11 +1016,6 @@ treesit_call_after_change_functions (TSTree *old_tree, TSTree *new_tree, static void treesit_ensure_parsed (Lisp_Object parser) { - /* Make sure this comes before everything else, see comment - (ref:notifier-inside-ensure-parsed) for more detail. */ - if (!XTS_PARSER (parser)->need_reparse) - return; - struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer); /* Before we parse, catch up with the narrowing situation. */ @@ -1029,6 +1024,11 @@ treesit_ensure_parsed (Lisp_Object parser) because it might set the flag to true. */ treesit_sync_visible_region (parser); + /* Make sure this comes before everything else, see comment + (ref:notifier-inside-ensure-parsed) for more detail. */ + if (!XTS_PARSER (parser)->need_reparse) + return; + TSParser *treesit_parser = XTS_PARSER (parser)->parser; TSTree *tree = XTS_PARSER (parser)->tree; TSInput input = XTS_PARSER (parser)->input; From accb3871668201a1d7b9c54713b94b814c879271 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 24 Mar 2023 14:10:30 +0300 Subject: [PATCH 11/37] Fix system time sampling on MS-Windows * src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally call tzset to make sure we pick up all the changes of time zone, working around the MS CRT caching. --- src/timefns.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/timefns.c b/src/timefns.c index b3132e7bc34..87971cf4563 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -180,6 +180,15 @@ static timezone_t const utc_tz = 0; static struct tm * emacs_localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) { +#ifdef WINDOWSNT + /* The Windows CRT functions are "optimized for speed", so they don't + check for timezone and DST changes if they were last called less + than 1 minute ago (see http://support.microsoft.com/kb/821231). + So all Emacs features that repeatedly call time functions (e.g., + display-time) are in real danger of missing timezone and DST + changes. Calling tzset before each localtime call fixes that. */ + tzset (); +#endif tm = localtime_rz (tz, t, tm); if (!tm && errno == ENOMEM) memory_full (SIZE_MAX); From 08fbc133756be38c02f04f64dbe0e2c9c1d0f228 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 24 Mar 2023 13:30:25 +0100 Subject: [PATCH 12/37] Adapt Tramp manual * doc/misc/tramp.texi (Default Method): OpenSSH for MS Windows can be used. (Ssh setup): Extend for MS Windows and ssh. --- doc/misc/tramp.texi | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index cbd8d202650..468bdfdbcba 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -1493,8 +1493,10 @@ access and it has the most reasonable security protocols, use @end example If @option{ssh} is unavailable for whatever reason, look for other -obvious options. For MS Windows, try the @option{plink} method. For -Kerberos, try @option{krlogin}. +obvious options. For MS Windows, try the @option{plink} +method@footnote{This shouldn't be needed with recent @code{OpenSSH} +versions for MS Windows. Use method @option{sshx}.}. For Kerberos, +try @option{krlogin}. For editing local files as @option{su} or @option{sudo} methods, try the shortened syntax of @samp{root}: @@ -2837,11 +2839,19 @@ When @value{tramp} uses direct remote copying, password caches are not consulted. -@subsection Issues with Cygwin ssh +@subsection Issues with Cygwin and MS Windows ssh @cindex cygwin, issues +@cindex ms Windows, issues This section is incomplete. Please share your solutions. +@cindex ms windows and @command{ssh} +@cindex ms windows and @command{ssh-agent} + +MS Windows' @command{ssh} does not open a remote TTY@. Use the method +@option{sshx} or @option{scpx} instead. Furthermore, it cannot read a +passphrase for ssh private keys. Use the MS @code{ssh-agent}. + @cindex method @option{sshx} with cygwin @cindex @option{sshx} method with cygwin @@ -2881,13 +2891,15 @@ Windows file names to Cygwin file names. @cindex @env{SSH_AUTH_SOCK} and emacs on ms windows @vindex SSH_AUTH_SOCK@r{, environment variable} -When using the @command{ssh-agent} on MS Windows for password-less -interaction, @option{ssh} methods depend on the environment variable -@env{SSH_AUTH_SOCK}. But this variable is not set when Emacs is -started from a Desktop shortcut and authentication fails. +When using the cygwin @command{ssh-agent} on MS Windows for +password-less interaction, @option{ssh} methods depend on the +environment variable @env{SSH_AUTH_SOCK}. But this variable is not +set when Emacs is started from a Desktop shortcut and authentication +fails. -One workaround is to use an MS Windows based SSH Agent, such as -@command{Pageant}. It is part of the PuTTY Suite of tools. +One workaround is to use an MS Windows based SSH Agent, such as the +native MS @command{ssh-agent} or @command{Pageant}. The latter is +part of the PuTTY Suite of tools. The fallback is to start Emacs from a shell. From 90fc6b987ad8f6531834906749be4d159fc1184f Mon Sep 17 00:00:00 2001 From: "Aaron L. Zeng" Date: Tue, 21 Mar 2023 16:07:54 -0400 Subject: [PATCH 13/37] * lisp/savehist.el (savehist-save): Preserve shared structure This avoids ballooning the size of variables that contain large text properties, such as the 'yank-handler' installed by 'evil-yank-rectangle', which contains a list of lines in the string. * lisp/savehist.el (savehist-save): Enable 'print-circle'. (Bug#62364) Copyright-paperwork-exempt: yes --- lisp/savehist.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/savehist.el b/lisp/savehist.el index b532668f8a4..ea8968c771b 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -232,8 +232,9 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved, savehist-coding-system)) (run-hooks 'savehist-save-hook) (let ((print-length nil) - (print-level nil) - (print-quoted t)) + (print-level nil) + (print-quoted t) + (print-circle t)) ;; Save the minibuffer histories, along with the value of ;; savehist-minibuffer-history-variables itself. (when savehist-save-minibuffer-history From 64a2b0d36fe9152641fe2017d36d5fc4ee2b7fc6 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Fri, 24 Mar 2023 11:35:40 -0400 Subject: [PATCH 14/37] Fix failure of fns-tests-collate-strings on Cygwin * test/src/fns-tests.el (fns-tests-collate-strings): Use en_XY.UTF-8 instead of en_DE.UTF-8 as an example of an invalid locale; en_DE.UTF-8 is actually a valid locale on Cygwin. Note: The test will still fail on Cygwin releases < 3.5 because of a Cygwin bug. (Bug#62420) --- test/src/fns-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index e0d6c96b360..c36b5e3f41b 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -253,8 +253,8 @@ ;; Ignore case. (should (string-collate-equalp "xyzzy" "XYZZY" nil t)) - ;; Locale must be valid. - (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_DE.UTF-8"))) + ;; Locale must be valid. This test will fail on Cygwin releases < 3.5. + (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8"))) ;; There must be a check for valid codepoints. (Check not implemented yet) ; (should-error From 875e77a66a66d7a5ab755af7f7cf6a9ba1e17c01 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 25 Mar 2023 17:33:33 +0100 Subject: [PATCH 15/37] * test/infra/Dockerfile.emba (emacs-native-comp): Add zlib1g-dev. --- test/infra/Dockerfile.emba | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index d4d80d3c751..593756aba3b 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -78,7 +78,7 @@ FROM emacs-base as emacs-native-comp # The libgccjit version must correspond to the gcc version. RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ - libgccjit-10-dev \ + libgccjit-10-dev zlib1g-dev \ && rm -rf /var/lib/apt/lists/* FROM emacs-native-comp as emacs-native-comp-speed0 From c4d490490dc24c76fbead7941518ad503672d216 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 25 Mar 2023 12:54:23 -0400 Subject: [PATCH 16/37] ; * test/src/fns-tests.el: Fix last change --- test/src/fns-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index c36b5e3f41b..b84d39a063d 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -253,7 +253,7 @@ ;; Ignore case. (should (string-collate-equalp "xyzzy" "XYZZY" nil t)) - ;; Locale must be valid. This test will fail on Cygwin releases < 3.5. + ;; Locale must be valid. (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8"))) ;; There must be a check for valid codepoints. (Check not implemented yet) From 8f42db010d15efa21fb9007e61daedbe1e2dfa53 Mon Sep 17 00:00:00 2001 From: kobarity Date: Sat, 25 Mar 2023 22:59:05 +0900 Subject: [PATCH 17/37] Improve indenting "case" in Python * lisp/progmodes/python.el (python-info-dedenter-statement-p): Do not consider the first "case" in the block as dedenter. * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-7) (python-info-dedenter-statement-p-6): New tests. (Bug#62092) --- lisp/progmodes/python.el | 9 ++++++- test/lisp/progmodes/python-tests.el | 38 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2fe88323c35..bbabce80b4d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5854,7 +5854,14 @@ statement." (save-excursion (python-nav-beginning-of-statement) (when (and (not (python-syntax-context-type)) - (looking-at (python-rx dedenter))) + (looking-at (python-rx dedenter)) + ;; Exclude the first "case" in the block. + (not (and (string= (match-string-no-properties 0) + "case") + (save-excursion + (back-to-indentation) + (python-util-forward-comment -1) + (equal (char-before) ?:))))) (point)))) (defun python-info-line-ends-backslash-p (&optional line-number) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index ed4a08da6ab..50153e66da5 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5940,6 +5940,26 @@ def func(): (equal (list (python-tests-look-at "if (" -1 t)) (python-info-dedenter-opening-block-positions))))) +(ert-deftest python-info-dedenter-opening-block-positions-7 () + "Test case blocks." + (python-tests-with-temp-buffer + " +match a: + case 1: + match b: + case 2: + something() + case 3: +" + (python-tests-look-at "case 1:") + (should-not (python-info-dedenter-opening-block-positions)) + (python-tests-look-at "case 2:") + (should-not (python-info-dedenter-opening-block-positions)) + (python-tests-look-at "case 3:") + (equal (list (python-tests-look-at "case 2:" -1) + (python-tests-look-at "case 1:" -1 t)) + (python-info-dedenter-opening-block-positions)))) + (ert-deftest python-info-dedenter-opening-block-message-1 () "Test dedenters inside strings are ignored." (python-tests-with-temp-buffer @@ -6125,6 +6145,24 @@ elif b: (point)) (python-info-dedenter-statement-p))))) +(ert-deftest python-info-dedenter-statement-p-6 () + "Test case keyword." + (python-tests-with-temp-buffer + " +match a: # Comment + case 1: + match b: + case 2: + something() + case 3: +" + (python-tests-look-at "case 1:") + (should-not (python-info-dedenter-statement-p)) + (python-tests-look-at "case 2:") + (should-not (python-info-dedenter-statement-p)) + (python-tests-look-at "case 3:") + (should (= (point) (python-info-dedenter-statement-p))))) + (ert-deftest python-info-line-ends-backslash-p-1 () (python-tests-with-temp-buffer " From 9cfae822fb36dc4beb4d397c36c447d059c18ca7 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 14 Aug 2022 22:34:41 +1200 Subject: [PATCH 18/37] * src/buffer.c (mode-line-format): Remove docs for obsolete %t construct This documentation had been previously removed in 1999 in [1] but was subsequently restored again in a different form in 2006 in [2] as the construct was still supported on some systems. However it looks like it hasn't done what that documentation indicated since [3] in 2011, and the final remnant of this functionality was removed in [4] in 2013; so it seems clear that it's no longer supported and shouldn't be documented now. [1] commit 08de62001945d4dd32a3d6af44da05804cb296d5 [2] commit dafbe726b89a36010f3f24bb1efe4ace0a5f7f0f [3] commit 05c652517317d10690aaf0a6aa0bc876382b9d82 [4] commit 8549f9e89bd9288c4c709d183a5bf8f07dbeed3d --- src/buffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index df1f5206668..3bcd387f0c5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5143,7 +5143,6 @@ A string is printed verbatim in the mode line except for %-constructs: %P -- print percent of buffer above bottom of window, perhaps plus Top, or print Bottom or All. %n -- print Narrow if appropriate. - %t -- visited file is text or binary (if OS supports this distinction). %z -- print mnemonics of keyboard, terminal, and buffer coding systems. %Z -- like %z, but including the end-of-line format. %e -- print error message about full memory. From 207176e6b1c162dddebddcfb1ba7efd270d48b01 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 14 Aug 2022 23:11:43 +1200 Subject: [PATCH 19/37] * src/buffer.c (mode-line-format): Document %o and %q constructs Missed from commit b0b02ca7f3e06d0f092df6f81babd1277bf93b0f. --- src/buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/buffer.c b/src/buffer.c index 3bcd387f0c5..0c740775e5b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5139,9 +5139,12 @@ A string is printed verbatim in the mode line except for %-constructs: %C -- Like %c, but the leftmost column is displayed as one. %i -- print the size of the buffer. %I -- like %i, but use k, M, G, etc., to abbreviate. + %o -- print percent of window travel through buffer, or Top, Bot or All. %p -- print percent of buffer above top of window, or Top, Bot or All. %P -- print percent of buffer above bottom of window, perhaps plus Top, or print Bottom or All. + %q -- print percent of buffer above both the top and the bottom of the + window, separated by β€˜-’, or β€˜All’. %n -- print Narrow if appropriate. %z -- print mnemonics of keyboard, terminal, and buffer coding systems. %Z -- like %z, but including the end-of-line format. From 59b7086838e3f82c76977ae0f79b862ab2e7a782 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 14 Aug 2022 23:14:51 +1200 Subject: [PATCH 20/37] Improve docs for global-mode-string / %M construct * src/xdisp.c (global-mode-string): Update docstring. * doc/lispref/modes.texi: Update manual. --- doc/lispref/modes.texi | 25 +++++++++++++++---------- src/xdisp.c | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index d011962ade7..610ea696e74 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2357,18 +2357,19 @@ enabled separately in each buffer. @defvar global-mode-string This variable holds a mode line construct that, by default, appears in -the mode line just after the @code{which-function-mode} minor mode if -set, else after @code{mode-line-modes}. Elements that are added to -this construct should normally end in a space (to ensure that -consecutive @code{global-mode-string} elements display properly). For -instance, the command @code{display-time} sets -@code{global-mode-string} to refer to the variable -@code{display-time-string}, which holds a string containing the time -and load information. +the mode line as part of @code{mode-line-misc-info}, just after the +@code{which-function-mode} information if that minor mode is enabled, +else after @code{mode-line-modes}. Elements that are added to this +construct should normally end in a space (to ensure that consecutive +@code{global-mode-string} elements display properly). For instance, +the command @code{display-time} sets @code{global-mode-string} to +refer to the variable @code{display-time-string}, which holds a string +containing the time and load information. The @samp{%M} construct substitutes the value of -@code{global-mode-string}, but that is obsolete, since the variable is -included in the mode line from @code{mode-line-format}. +@code{global-mode-string}. This construct is not used by the default +mode line, as the variable itself is used in +@code{mode-line-misc-info}. @end defvar Here is a simplified version of the default value of @@ -2448,6 +2449,10 @@ abbreviate. The current line number of point, counting within the accessible portion of the buffer. +@item %M +The value of @code{global-mode-string} (which is part of +@code{mode-line-misc-info} by default). + @item %n @samp{Narrow} when narrowing is in effect; nothing otherwise (see @code{narrow-to-region} in @ref{Narrowing}). diff --git a/src/xdisp.c b/src/xdisp.c index 6219bb9ec6e..0b190529404 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -36470,7 +36470,7 @@ This is used for internal purposes. */); Vinhibit_redisplay = Qnil; DEFVAR_LISP ("global-mode-string", Vglobal_mode_string, - doc: /* String (or mode line construct) included (normally) in `mode-line-format'. */); + doc: /* String (or mode line construct) included (normally) in `mode-line-misc-info'. */); Vglobal_mode_string = Qnil; DEFVAR_LISP ("overlay-arrow-position", Voverlay_arrow_position, From 9107b2dec1f7cab9062b65013b02c8601d205015 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 14 Aug 2022 23:16:48 +1200 Subject: [PATCH 21/37] * doc/lispref/modes.texi: Improve docs for obsolete '%m' construct Bug #57080. --- doc/lispref/modes.texi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 610ea696e74..deaed31aed0 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2523,13 +2523,16 @@ The character @samp{%}---this is how to include a literal @samp{%} in a string in which @code{%}-constructs are allowed. @end table -The following @code{%}-construct is still supported, but it is -obsolete, since you can get the same result using the variable -@code{mode-name}. +@subsubheading Obsolete @code{%}-Constructs + + The following constructs should no longer be used. @table @code @item %m -The value of @code{mode-name}. +Obsolete; use the @code{mode-name} variable instead. The @code{%m} +construct is inadequate, as it produces an empty string if the value +of @code{mode-name} is a non-string mode-line construct (as in +@code{emacs-lisp-mode}, for example). @end table @node Properties in Mode From 564c26bdbeb1ebc1dcf00fb02d605140408a5be5 Mon Sep 17 00:00:00 2001 From: Matus Goljer Date: Sun, 26 Mar 2023 13:20:19 +0200 Subject: [PATCH 22/37] ; Fix edebug spec for 'gv-define-simple-setter' (bug#62256) --- lisp/emacs-lisp/gv.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index e307776252a..6adba6c342f 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -271,7 +271,7 @@ instead the assignment is turned into something equivalent to (SETTER ARGS... temp) temp) so as to preserve the semantics of `setf'." - (declare (debug (sexp (&or symbolp lambda-expr) &optional sexp))) + (declare (debug (sexp [&or symbolp lambda-expr] &optional sexp))) (when (eq 'lambda (car-safe setter)) (message "Use `gv-define-setter' or name %s's setter function" name)) `(gv-define-setter ,name (val &rest args) From e19b7da7b09ed44bf08b06be082abdfc23d44e6f Mon Sep 17 00:00:00 2001 From: Xi Lu Date: Sat, 25 Mar 2023 21:38:48 +0800 Subject: [PATCH 23/37] Add 'eww-default-download-directory'. * lisp/net/eww.el (eww-default-download-directory): New defcustom. (eww--download-directory): Use it. (Bug#62435) --- lisp/net/eww.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 859a9b44bcb..9552138bb6e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -64,16 +64,21 @@ The action to be taken can be further customized via :version "28.1" :type 'regexp) +(defcustom eww-default-download-directory "~/Downloads/" + "The default directory where downloaded files will be saved." + :version "30.1" + :group 'eww + :type 'string) + (defun eww--download-directory () - "Return the name of the download directory. -If ~/Downloads/ exists, that will be used, and if not, the -DOWNLOAD XDG user directory will be returned. If that's -undefined, ~/Downloads/ is returned anyway." - (or (and (file-exists-p "~/Downloads/") - "~/Downloads/") + "Return the name of the download directory based on the value of +`eww-default-download-directory'. If the specified directory exists, it + will be used. Otherwise, the DOWNLOAD XDG user directory will be returned." + (or (and (file-exists-p eww-default-download-directory) + eww-default-download-directory) (when-let ((dir (xdg-user-dir "DOWNLOAD"))) (file-name-as-directory dir)) - "~/Downloads/")) + eww-default-download-directory)) (defcustom eww-download-directory 'eww--download-directory "Directory where files will downloaded. From d941666d8593bbee5a50262b2c4177ffa2010e56 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 26 Mar 2023 14:56:57 +0300 Subject: [PATCH 24/37] ; Fix last change * lisp/net/eww.el (eww-download-directory): Rename from 'eww-default-download-directory'. All users changed. Change :type to be a directory. Doc fix. (Bug#62435) --- lisp/net/eww.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 9552138bb6e..52951074bea 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -64,21 +64,22 @@ The action to be taken can be further customized via :version "28.1" :type 'regexp) -(defcustom eww-default-download-directory "~/Downloads/" - "The default directory where downloaded files will be saved." +(defcustom eww-download-directory "~/Downloads/" + "Default directory where `eww' saves downloaded files." :version "30.1" :group 'eww - :type 'string) + :type 'directory) (defun eww--download-directory () - "Return the name of the download directory based on the value of -`eww-default-download-directory'. If the specified directory exists, it - will be used. Otherwise, the DOWNLOAD XDG user directory will be returned." - (or (and (file-exists-p eww-default-download-directory) - eww-default-download-directory) + "Return the name of the EWW download directory. +The default is specified by `eww-download-directory'; however, +if that directory doesn't exist and the DOWNLOAD XDG user directory +is defined, use the latter instead." + (or (and (file-exists-p eww-download-directory) + eww-download-directory) (when-let ((dir (xdg-user-dir "DOWNLOAD"))) (file-name-as-directory dir)) - eww-default-download-directory)) + eww-download-directory)) (defcustom eww-download-directory 'eww--download-directory "Directory where files will downloaded. From b08bf8286059cb75166401c8cad01e3661cb8833 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 26 Mar 2023 14:58:40 +0300 Subject: [PATCH 25/37] ; Fix :version of the new defcustom --- lisp/net/eww.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 52951074bea..9451083f396 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -66,7 +66,7 @@ The action to be taken can be further customized via (defcustom eww-download-directory "~/Downloads/" "Default directory where `eww' saves downloaded files." - :version "30.1" + :version "29.1" :group 'eww :type 'directory) From a952bdd6af081ef78f25f20d0a6cde612ce10df0 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Mon, 27 Mar 2023 01:06:52 +1300 Subject: [PATCH 26/37] Fix primary selection modification during `term-mouse-paste' (bug#58608) * lisp/term.el (term-mouse-paste): Prevent the primary selection from being changed in the process of sending it to the inferior process. --- lisp/term.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/term.el b/lisp/term.el index 3e4907e8bfc..2e719567058 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1372,7 +1372,13 @@ Entry to this mode runs the hooks on `term-mode-hook'." (run-hooks 'mouse-leave-buffer-hook) (setq this-command 'yank) (mouse-set-point click) - (term-send-raw-string (gui-get-primary-selection))) + ;; As we have moved point, bind `select-active-regions' to prevent + ;; the `deactivate-mark' call in `term-send-raw-string' from + ;; changing the primary selection (resulting in consecutive calls to + ;; `term-mouse-paste' each sending different text). (bug#58608). + ;; FIXME: Why does this command change point at all? + (let ((select-active-regions nil)) + (term-send-raw-string (gui-get-primary-selection)))) (defun term-paste () "Insert the last stretch of killed text at point." From 8b4a494d8d4413ae6d566f6478f84e319aeaacdd Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 26 Mar 2023 14:20:05 +0200 Subject: [PATCH 27/37] Fix GNUSTEP tests on EMBA * configure.ac (LIBS_GNUSTEP): Adapt CPPFLAGS and CFLAGS. (Bug#62210) Proposed by Po Lu . * test/infra/gitlab-ci.yml (build-image-gnustep) (test-gnustep): Uncomment jobs. --- configure.ac | 4 ++-- test/infra/gitlab-ci.yml | 32 +++++++++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index c818343a5ad..aa78c7a16dc 100644 --- a/configure.ac +++ b/configure.ac @@ -2059,8 +2059,8 @@ if test "${with_ns}" != no; then GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}" test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \ GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}" - CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" - CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" + CPPFLAGS="$CPPFLAGS -isystem ${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" + CFLAGS="$CFLAGS -isystem ${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}" LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread" dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1. diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 41778321773..de1148460aa 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -229,24 +229,22 @@ test-filenotify-gio: # This is needed in order to get a JUnit test report. make_params: '-k -C test check-expensive LOGFILES="lisp/autorevert-tests.log lisp/filenotify-tests.log"' -# The next two jobs are commented out due to bug#62210. +build-image-gnustep: + stage: platform-images + extends: [.job-template, .build-template, .gnustep-template] + variables: + target: emacs-gnustep -# build-image-gnustep: -# stage: platform-images -# extends: [.job-template, .build-template, .gnustep-template] -# variables: -# target: emacs-gnustep - -# test-gnustep: -# # This tests the GNUstep build process. -# stage: platforms -# extends: [.job-template, .gnustep-template] -# needs: -# - job: build-image-gnustep -# optional: true -# variables: -# target: emacs-gnustep -# make_params: install +test-gnustep: + # This tests the GNUstep build process. + stage: platforms + extends: [.job-template, .gnustep-template] + needs: + - job: build-image-gnustep + optional: true + variables: + target: emacs-gnustep + make_params: install # The next two jobs are commented out due to high workload on # emba.gnu.org. From 45b16bfb496025d9f21f7cdccb6a25a0be83a26f Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 25 Mar 2023 16:37:51 -0400 Subject: [PATCH 28/37] Skip failing tests on Cygwin with native compilation (bug#62450) * test/Makefile.in (TEST_NATIVE_COMP): New variable, used to determine whether to run tests tagged with :nativecomp. Set it to "no" on Cygwin and to $(HAVE_NATIVE_COMP) otherwise. * test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): Skip on Cygwin with native-compilation. --- test/Makefile.in | 9 ++++++++- test/lisp/emacs-lisp/benchmark-tests.el | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/Makefile.in b/test/Makefile.in index fd21695f5bc..e8edf7739b7 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -124,7 +124,14 @@ test_module_dir := src/emacs-module-resources all: check -ifeq ($(HAVE_NATIVE_COMP),yes) +SYSTEM_TYPE = @SYSTEM_TYPE@ +TEST_NATIVE_COMP = $(HAVE_NATIVE_COMP) +# Avoid fork failures on Cygwin. See bug#62450 and etc/PROBLEMS +# ("Fork failures in a build with native compilation"). +ifeq ($(SYSTEM_TYPE),cygwin) +TEST_NATIVE_COMP = no +endif +ifeq ($(TEST_NATIVE_COMP),yes) SELECTOR_DEFAULT = (not (or (tag :expensive-test) (tag :unstable))) SELECTOR_EXPENSIVE = (not (tag :unstable)) SELECTOR_ALL = t diff --git a/test/lisp/emacs-lisp/benchmark-tests.el b/test/lisp/emacs-lisp/benchmark-tests.el index 31357f24a0d..99b5b142c37 100644 --- a/test/lisp/emacs-lisp/benchmark-tests.el +++ b/test/lisp/emacs-lisp/benchmark-tests.el @@ -23,6 +23,10 @@ (require 'ert) (ert-deftest benchmark-tests () + ;; Avoid fork failures on Cygwin. See bug#62450 and etc/PROBLEMS + ;; ("Fork failures in a build with native compilation"). + (skip-unless (not (and (eq system-type 'cygwin) + (featurep 'native-compile)))) (let (str t-long t-short m) (should (consp (benchmark-run nil (setq m (1+ 0))))) (should (consp (benchmark-run 1 (setq m (1+ 0))))) From a8c23677d3939b8af1bcddb63244fe7b5bb384a4 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 26 Mar 2023 17:01:14 -0400 Subject: [PATCH 29/37] Update to Org 9.6.2 --- etc/refcards/orgcard.tex | 2 +- lisp/org/org-version.el | 4 ++-- lisp/org/org.el | 2 +- lisp/org/ox-texinfo.el | 11 +++++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index dc222719b7e..0ef05353341 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{9.6.1} +\def\orgversionnumber{9.6.2} \def\versionyear{2023} % latest update \input emacsver.tex diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 20636a3dd04..fd75f4785d6 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of Org. Inserted by installing Org mode or when a release is made." - (let ((org-release "9.6.1")) + (let ((org-release "9.6.2")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.6.1-48-g92471e")) + (let ((org-git-version "release_9.6.2")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 2fbb825015f..1649722ab0c 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -9,7 +9,7 @@ ;; URL: https://orgmode.org ;; Package-Requires: ((emacs "26.1")) -;; Version: 9.6.1 +;; Version: 9.6.2 ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index 4ff482cc3f5..f822f3d110c 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el @@ -2037,10 +2037,13 @@ Once computed, the results remain cached." "\n"))) (with-temp-file input-file (insert input-content)) - (let* ((output-file (org-texinfo-compile input-file)) - (output-content (with-temp-buffer - (insert-file-contents output-file) - (buffer-string)))) + (when-let* ((output-file + ;; If compilation fails, consider math to + ;; be not supported. + (ignore-errors (org-texinfo-compile input-file))) + (output-content (with-temp-buffer + (insert-file-contents output-file) + (buffer-string)))) (let ((result (string-match-p (regexp-quote math-example) output-content))) (delete-file input-file) From 0337131bfa194856234ddfe70ee38b3165d66289 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 26 Mar 2023 23:53:03 +0200 Subject: [PATCH 30/37] Update to Transient v0.3.7-218-g3dbb22a --- doc/misc/transient.texi | 14 ++++++++++++++ lisp/transient.el | 17 +++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi index 850930a290f..33d689cc01b 100644 --- a/doc/misc/transient.texi +++ b/doc/misc/transient.texi @@ -2566,6 +2566,20 @@ currently exist. Yes, see @code{transient-display-buffer-action} in @ref{Configuration}. +@anchor{How can I copy text from the popup buffer?} +@appendixsec How can I copy text from the popup buffer? + +To be able to mark text in any transient popup buffer using the mouse, +you have to add the following binding. Note that the region won't be +visualized, while doing so. After you have quit the transient popup, +you will be able to yank it another buffer. + +@lisp +(keymap-set transient-predicate-map + "" + #'transient--do-stay) +@end lisp + @anchor{Why did some of the key bindings change?} @appendixsec Why did some of the key bindings change? diff --git a/lisp/transient.el b/lisp/transient.el index 96e711e950c..4affc414fa6 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2516,17 +2516,22 @@ prefix argument and pivot to `transient-update'." (defun transient--invalid (msg) (ding) - (message "%s: `%s' (Use `%s' to abort, `%s' for help) [%s]" + (message "%s: `%s' (Use `%s' to abort, `%s' for help)%s" msg (propertize (key-description (this-single-command-keys)) 'face 'font-lock-warning-face) (propertize "C-g" 'face 'transient-key) (propertize "?" 'face 'transient-key) - ;; `this-command' is `transient--undefined' or similar at this - ;; point. Show the command the user actually tried to invoke. - (propertize (symbol-name (transient--suffix-symbol - this-original-command)) - 'face 'font-lock-warning-face)) + ;; `this-command' is `transient-undefined' or `transient-inapt'. + ;; Show the command (`this-original-command') the user actually + ;; tried to invoke. For an anonymous inapt command that is a + ;; lambda expression, which cannot be mapped to a symbol, so + ;; forgo displaying the command. + (if-let ((cmd (ignore-errors + (symbol-name (transient--suffix-symbol + this-original-command))))) + (format " [%s]" (propertize cmd 'face 'font-lock-warning-face)) + "")) (unless (and transient--transient-map (memq transient--transient-map overriding-terminal-local-map)) (let ((transient--prefix (or transient--prefix 'sic))) From f631c90e791ef94b27c5ea4c9c1d865a498ad476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sun, 26 Mar 2023 12:09:41 +0200 Subject: [PATCH 31/37] ; Use string-search instead of string-match[-p] in ruby-ts-mode.el * lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-chain): Use the much faster string-search when just searching for a substring. (cherry picked from commit 0724c6dbdaef2c549409836ba4f7999e05aa31fe) --- lisp/progmodes/ruby-ts-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index da2a0a6c852..cefd76feeec 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -469,7 +469,7 @@ non-nil." (let* (first-call ) (while (and parent (setq first-call (treesit-node-parent parent)) - (string-match-p "call" (treesit-node-type first-call))) + (string-search "call" (treesit-node-type first-call))) (setq parent first-call)) (treesit-node-start (treesit-search-subtree parent "\\." nil t)))) From a0d5fba74a638aa320aefa0a6583d233bbcee99f Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 27 Mar 2023 02:11:16 +0300 Subject: [PATCH 32/37] (ruby-ts--align-chain): Use 'equal' to check for an exact match * lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-chain): Use 'equal' to check for an exact match rather than substring. --- lisp/progmodes/ruby-ts-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index cefd76feeec..0915c29881d 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -469,7 +469,7 @@ non-nil." (let* (first-call ) (while (and parent (setq first-call (treesit-node-parent parent)) - (string-search "call" (treesit-node-type first-call))) + (equal "call" (treesit-node-type first-call))) (setq parent first-call)) (treesit-node-start (treesit-search-subtree parent "\\." nil t)))) From cbef1422fe3ba5d3327835f3952a0f42f7881716 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 27 Mar 2023 03:49:13 +0300 Subject: [PATCH 33/37] ruby-ts-mode: Fix/simplify Imenu index generation * lisp/progmodes/ruby-ts-mode.el (ruby-ts--full-name): Drop '#' from the end of resulting string when the node is not a method. Support 'singleton_method' nodes. (ruby-ts--imenu-helper): Simplify, to create a "flat" list of entries, rather than a nested one. The previous implementation had problems (like producing a nested structure of full-qualified names, thus creating a lot of textual repetition), seems easier to just follow ruby-mode's example here, at least for Emacs 29's release. * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-imenu-index): New test. --- lisp/progmodes/ruby-ts-mode.el | 46 +++++++++++------------ test/lisp/progmodes/ruby-ts-mode-tests.el | 25 ++++++++++++ 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 0915c29881d..91d65a2777b 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -883,32 +883,24 @@ a statement container is a node that matches "Return the fully qualified name of NODE." (let* ((name (ruby-ts--get-name node)) (delimiter "#")) + (when (equal (treesit-node-type node) "singleton_method") + (setq delimiter "." + name (treesit-node-text (treesit-node-child-by-field-name node "name")))) (while (setq node (treesit-parent-until node #'ruby-ts--class-or-module-p)) - (setq name (concat (ruby-ts--get-name node) delimiter name)) + (if name + (setq name (concat (ruby-ts--get-name node) delimiter name)) + (setq name (ruby-ts--get-name node))) (setq delimiter "::")) name)) -(defun ruby-ts--imenu-helper (node) - "Convert a treesit sparse tree NODE in an imenu list. -Helper for `ruby-ts--imenu' which converts a treesit sparse -NODE into a list of imenu ( name . pos ) nodes" - (let* ((ts-node (car node)) - (subtrees (mapcan #'ruby-ts--imenu-helper (cdr node))) - (name (when ts-node - (ruby-ts--full-name ts-node))) - (marker (when ts-node - (set-marker (make-marker) - (treesit-node-start ts-node))))) - (cond - ((or (null ts-node) (null name)) subtrees) - ;; Don't include the anonymous "class" and "module" nodes - ((string-match-p "(\"\\(class\\|module\\)\")" - (treesit-node-string ts-node)) - nil) - (subtrees - `((,name ,(cons name marker) ,@subtrees))) - (t - `((,name . ,marker)))))) +(defun ruby-ts--imenu-helper (tree) + "Convert a treesit sparse tree NODE in a flat imenu list." + (if (cdr tree) + ;; We only use the "leaf" values in the tree. It does include a + ;; leaf node for every class or module body. + (cl-mapcan #'ruby-ts--imenu-helper (cdr tree)) + (list (cons (ruby-ts--full-name (car tree)) + (treesit-node-start (car tree)))))) ;; For now, this is going to work like ruby-mode and return a list of ;; class, modules, def (methods), and alias. It is likely that this @@ -916,8 +908,14 @@ NODE into a list of imenu ( name . pos ) nodes" (defun ruby-ts--imenu () "Return Imenu alist for the current buffer." (let* ((root (treesit-buffer-root-node)) - (nodes (treesit-induce-sparse-tree root "^\\(method\\|alias\\|class\\|module\\)$"))) - (ruby-ts--imenu-helper nodes))) + (tree (treesit-induce-sparse-tree root + (rx bol (or "singleton_method" + "method" + "alias" + "class" + "module") + eol)))) + (ruby-ts--imenu-helper tree))) (defun ruby-ts--arrow-up-start (arg) "Move to the start ARG levels up or out." diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index e0d9f1b5c50..11125dc5cd3 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el @@ -281,6 +281,31 @@ The whitespace before and including \"|\" on each line is removed." (file-truename (expand-file-name (format "ruby-mode-resources/%s" ,file)))))) +(ert-deftest ruby-ts-imenu-index () + (ruby-ts-with-temp-buffer + (ruby-ts-test-string + "module Foo + | class Blub + | def hi + | 'Hi!' + | end + | + | def bye + | 'Bye!' + | end + | + | private def self.hiding + | 'You can't see me' + | end + | end + |end") + (should (equal (mapcar #'car (ruby-ts--imenu)) + '("Foo" + "Foo::Blub" + "Foo::Blub#hi" + "Foo::Blub#bye" + "Foo::Blub.hiding"))))) + (defmacro ruby-ts-deftest-indent (file) `(ert-deftest ,(intern (format "ruby-ts-indent-test/%s" file)) () ;; :tags '(:expensive-test) From edc460e3b6c38eee97dde847987b2c29dd134653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 27 Mar 2023 12:25:16 +0100 Subject: [PATCH 34/37] Fix accidental backward-incompatible change (bug#62417) This code used to work, but with the change of 59ecf25fc860 it stopped working: (defun foop (buffer-name _alist) (string-match "foop" buffer-name)) (add-to-list 'display-buffer-alist '(foop . display-buffer-other-frame)) This change makes it work again, restoring compatibility. * lisp/subr.el (buffer-match-p): Fix and adjust docstring. * lisp/window.el (display-buffer-alist): Adjust docstring. (display-buffer-assq-regexp): Make good on promise of display-buffer-alist. --- lisp/subr.el | 6 +++--- lisp/window.el | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index c73643f6d2b..8d27c831c96 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -7069,7 +7069,7 @@ CONDITION is either: - the symbol t, to always match, - the symbol nil, which never matches, - a regular expression, to match a buffer name, -- a predicate function that takes a buffer object and ARG as +- a predicate function that takes BUFFER-OR-NAME and ARG as arguments, and returns non-nil if the buffer matches, - a cons-cell, where the car describes how to interpret the cdr. The car can be one of the following: @@ -7095,8 +7095,8 @@ CONDITION is either: (string-match-p condition (buffer-name buffer))) ((pred functionp) (if (eq 1 (cdr (func-arity condition))) - (funcall condition buffer) - (funcall condition buffer arg))) + (funcall condition buffer-or-name) + (funcall condition buffer-or-name arg))) (`(major-mode . ,mode) (eq (buffer-local-value 'major-mode buffer) diff --git a/lisp/window.el b/lisp/window.el index f6ddae854ad..4bdc26571f5 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7501,8 +7501,8 @@ Its value takes effect before processing the ACTION argument of If non-nil, this is an alist of elements (CONDITION . ACTION), where: - CONDITION is passed to `buffer-match-p', along with the buffer - that is to be displayed and the ACTION argument of + CONDITION is passed to `buffer-match-p', along with the name of + the buffer that is to be displayed and the ACTION argument of `display-buffer', to check if ACTION should be used. ACTION is a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is an @@ -7559,12 +7559,16 @@ all fail. It should never be set by programs or users. See (defun display-buffer-assq-regexp (buffer-or-name alist action) "Retrieve ALIST entry corresponding to buffer specified by BUFFER-OR-NAME. This returns the cdr of the alist entry ALIST if the entry's -key (its car) and BUFFER-OR-NAME satisfy `buffer-match-p', using -the key as CONDITION argument of `buffer-match-p'. ACTION should -have the form of the action argument passed to `display-buffer'." +key (its car) and the name of the buffer designated by +BUFFER-OR-NAME satisfy `buffer-match-p', using the key as +CONDITION argument of `buffer-match-p'. ACTION should have the +form of the action argument passed to `display-buffer'." (catch 'match (dolist (entry alist) - (when (buffer-match-p (car entry) buffer-or-name action) + (when (buffer-match-p (car entry) (if (stringp buffer-or-name) + buffer-or-name + (buffer-name buffer-or-name)) + action) (throw 'match (cdr entry)))))) (defvar display-buffer--same-window-action From 0bd2bbc0c2cb06cd254bf67f75d284f4c16f45a8 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 27 Mar 2023 15:46:44 +0200 Subject: [PATCH 35/37] Fix Tramp error messages * lisp/net/tramp.el: * lisp/net/tramp-cmds.el: * lisp/net/tramp-crypt.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-smb.el: Fix error messages. --- lisp/net/tramp-cmds.el | 10 +++++----- lisp/net/tramp-crypt.el | 12 ++++++------ lisp/net/tramp-gvfs.el | 2 +- lisp/net/tramp-sh.el | 10 +++++----- lisp/net/tramp-smb.el | 2 +- lisp/net/tramp.el | 10 +++++----- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index b0cfdb1ebba..1a9d8003530 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -319,7 +319,7 @@ The remote connection identified by SOURCE is flushed by (read-file-name-function #'read-file-name-default) source target) (if (null connections) - (tramp-user-error nil "There are no remote connections.") + (tramp-user-error nil "There are no remote connections") (setq source ;; Likely, the source remote connection is broken. So we ;; shall avoid any action on it. @@ -367,15 +367,15 @@ The remote connection identified by SOURCE is flushed by (list source target))) (unless (tramp-tramp-file-p source) - (tramp-user-error nil "Source %s must be remote." source)) + (tramp-user-error nil "Source %s must be remote" source)) (when (null target) (or (setq target (tramp-default-rename-file source)) (tramp-user-error nil (concat "There is no target specified. " - "Check `tramp-default-rename-alist' for a proper entry.")))) + "Check `tramp-default-rename-alist' for a proper entry")))) (when (tramp-equal-remote source target) - (tramp-user-error nil "Source and target must have different remote.")) + (tramp-user-error nil "Source and target must have different remote")) ;; Append local file name if none is specified. (when (string-equal (file-remote-p target) target) @@ -461,7 +461,7 @@ For details, see `tramp-rename-files'." nil (substitute-command-keys (concat "Current buffer is not remote. " - "Consider `\\[tramp-rename-files]' instead."))) + "Consider `\\[tramp-rename-files]' instead"))) (setq target (when (null current-prefix-arg) ;; The source remote connection shall not trigger any action. diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index 116c2b143e9..4d15695ccbf 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -436,7 +436,7 @@ Otherwise, return NAME." crypt-vec (if (eq op 'encrypt) "encode" "decode") tramp-compat-temporary-file-directory localname) (tramp-error - crypt-vec 'file-error "%s of file name %s failed." + crypt-vec 'file-error "%s of file name %s failed" (if (eq op 'encrypt) "Encoding" "Decoding") name)) (with-current-buffer (tramp-get-connection-buffer crypt-vec) (goto-char (point-min)) @@ -471,7 +471,7 @@ Raise an error if this fails." (file-name-directory infile) (concat "/" (file-name-nondirectory infile))) (tramp-error - crypt-vec 'file-error "%s of file %s failed." + crypt-vec 'file-error "%s of file %s failed" (if (eq op 'encrypt) "Encrypting" "Decrypting") infile)) (with-current-buffer (tramp-get-connection-buffer crypt-vec) (write-region nil nil outfile))))) @@ -495,11 +495,11 @@ directory. File names will be also encrypted." ;; (declare (completion tramp-crypt-command-completion-p)) (interactive "DRemote directory name: ") (unless tramp-crypt-enabled - (tramp-user-error nil "Feature is not enabled.")) + (tramp-user-error nil "Feature is not enabled")) (unless (and (tramp-tramp-file-p name) (file-directory-p name)) - (tramp-user-error nil "%s must be an existing remote directory." name)) + (tramp-user-error nil "%s must be an existing remote directory" name)) (when (file-name-quoted-p name) - (tramp-user-error nil "%s must not be quoted." name)) + (tramp-user-error nil "%s must not be quoted" name)) (setq name (file-name-as-directory (expand-file-name name))) (unless (member name tramp-crypt-directories) (setq tramp-crypt-directories (cons name tramp-crypt-directories))) @@ -518,7 +518,7 @@ kept in their encrypted form." ;; (declare (completion tramp-crypt-command-completion-p)) (interactive "DRemote directory name: ") (unless tramp-crypt-enabled - (tramp-user-error nil "Feature is not enabled.")) + (tramp-user-error nil "Feature is not enabled")) (setq name (file-name-as-directory (expand-file-name name))) (when (and (member name tramp-crypt-directories) (delete diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index c84f96d3c61..f925d2f3da5 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1115,7 +1115,7 @@ file names." (goto-char (point-min)) (tramp-error-with-buffer nil v 'file-error - "%s failed, see buffer `%s' for details." + "%s failed, see buffer `%s' for details" msg-operation (buffer-name))) ;; Some WebDAV server, like the one from QNAP, do diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 401cec0e28d..2ef97d540a0 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1147,8 +1147,8 @@ Operations not mentioned here will be handled by the normal Emacs functions.") (unless (tramp-get-remote-ln v) (tramp-error v 'file-error - (concat "Making a symbolic link. " - "ln(1) does not exist on the remote host.")))) + (concat "Making a symbolic link: " + "ln(1) does not exist on the remote host")))) (tramp-skeleton-handle-make-symbolic-link target linkname ok-if-already-exists (and (tramp-send-command-and-check @@ -2150,7 +2150,7 @@ the uid and gid from FILENAME." cmd-result) (tramp-error-with-buffer nil v 'file-error - "Copying directly failed, see buffer `%s' for details." + "Copying directly failed, see buffer `%s' for details" (buffer-name))))) ;; We are on the local host. @@ -2205,7 +2205,7 @@ the uid and gid from FILENAME." "%s %s %s" cmd (tramp-shell-quote-argument localname1) (tramp-shell-quote-argument tmpfile)) - "Copying directly failed, see buffer `%s' for details." + "Copying directly failed, see buffer `%s' for details" (tramp-get-buffer v)) ;; We must change the ownership as remote user. ;; Since this does not work reliable, we also @@ -2238,7 +2238,7 @@ the uid and gid from FILENAME." "cp -f -p %s %s" (tramp-shell-quote-argument tmpfile) (tramp-shell-quote-argument localname2)) - "Copying directly failed, see buffer `%s' for details." + "Copying directly failed, see buffer `%s' for details" (tramp-get-buffer v))) (t1 (tramp-run-real-handler diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 740841c24db..add230e2720 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -692,7 +692,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; "rmdir" does not report an error. So we check ourselves. (when (file-exists-p directory) - (tramp-error v 'file-error "`%s' not removed." directory))))) + (tramp-error v 'file-error "`%s' not removed" directory))))) (defun tramp-smb-handle-delete-file (filename &optional trash) "Like `delete-file' for Tramp files." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 6eff5b2ca60..defdb2bd546 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1722,11 +1722,11 @@ default values are used." (unless (or nodefault non-essential (assoc method tramp-methods)) (tramp-user-error - v "Method `%s' is not known." method)) + v "Method `%s' is not known" method)) ;; Only some methods from tramp-sh.el do support multi-hops. (unless (or (null hop) nodefault non-essential (tramp-multi-hop-p v)) (tramp-user-error - v "Method `%s' is not supported for multi-hops." method))))))) + v "Method `%s' is not supported for multi-hops" method))))))) (put #'tramp-dissect-file-name 'tramp-suppress-trace t) @@ -1755,7 +1755,7 @@ See `tramp-dissect-file-name' for details." ;; Only some methods from tramp-sh.el do support multi-hops. (unless (or nodefault non-essential (tramp-multi-hop-p v)) (tramp-user-error - v "Method `%s' is not supported for multi-hops." + v "Method `%s' is not supported for multi-hops" (tramp-file-name-method v))) ;; Return result. v)) @@ -3936,7 +3936,7 @@ Let-bind it when necessary.") ;; Some handlers for `tramp-get-remote-uid' return nil if they ;; can't get the UID; always return -1 in this case for ;; consistency. - -1))) + tramp-unknown-id-integer))) (defun tramp-handle-access-file (filename string) "Like `access-file' for Tramp files." @@ -4896,7 +4896,7 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") (unless (tramp-multi-hop-p item) (setq tramp-default-proxies-alist saved-tdpa) (tramp-user-error - vec "Method `%s' is not supported for multi-hops." + vec "Method `%s' is not supported for multi-hops" (tramp-file-name-method item))))) ;; Some methods ("su", "sg", "sudo", "doas", "ksu") do not use the From afbb9b426cec216dfa303a46fb0ece59b2dd45f8 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 27 Mar 2023 18:32:49 +0200 Subject: [PATCH 36/37] * test/infra/Dockerfile.emba (emacs-eglot): Adapt software selection. --- test/infra/Dockerfile.emba | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 163fc582e6f..0fa642d983b 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -64,7 +64,7 @@ FROM emacs-base as emacs-eglot RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ - snapd wget lsb_release add-apt-repository gpg \ + snapd wget lsb-release software-properties-common gpg \ && rm -rf /var/lib/apt/lists/* # A recent clangd. It must be at least clangd 14, which is in Debian @@ -73,8 +73,8 @@ RUN bash -c "$(wget --no-check-certificate -O - https://apt.llvm.org/llvm.sh)" # A recent pylsp. Since Debian bookworm there is the package # python3-pylsp. -RUN snap install core -RUN snap install pylsp +# RUN snap install core +# RUN snap install pylsp COPY . /checkout WORKDIR /checkout From 66b4394461589d0db8690b7971000f687bd3ad57 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sun, 26 Mar 2023 15:02:30 -0400 Subject: [PATCH 37/37] Enable ASLR for dynamic libraries on Cygwin This seems to avoid the fork failures described in etc/PROBLEMS ("Fork failures in a build with native compilation"). * lisp/treesit.el (treesit--install-language-grammar-1): * lisp/emacs-lisp/comp.el (native-comp-driver-options): Add the linker flag "-Wl,-dynamicbase" on Cygwin. --- lisp/emacs-lisp/comp.el | 5 +++-- lisp/treesit.el | 16 +++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 7d9832f588f..3c57ca79b12 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -186,8 +186,9 @@ and above." :type '(repeat string) :version "28.1") -(defcustom native-comp-driver-options (when (eq system-type 'darwin) - '("-Wl,-w")) +(defcustom native-comp-driver-options + (cond ((eq system-type 'darwin) '("-Wl,-w")) + ((eq system-type 'cygwin) '("-Wl,-dynamicbase"))) "Options passed verbatim to the native compiler's back-end driver. Note that not all options are meaningful; typically only the options affecting the assembler and linker are likely to be useful. diff --git a/lisp/treesit.el b/lisp/treesit.el index 2b0eca7f5c2..e3c7d569ea6 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3056,11 +3056,17 @@ function signals an error." (apply #'treesit--call-process-signal (if (file-exists-p "scanner.cc") c++ cc) nil t nil - `("-fPIC" "-shared" - ,@(directory-files - default-directory nil - (rx bos (+ anychar) ".o" eos)) - "-o" ,lib-name)) + (if (eq system-type 'cygwin) + `("-shared" "-Wl,-dynamicbase" + ,@(directory-files + default-directory nil + (rx bos (+ anychar) ".o" eos)) + "-o" ,lib-name) + `("-fPIC" "-shared" + ,@(directory-files + default-directory nil + (rx bos (+ anychar) ".o" eos)) + "-o" ,lib-name))) ;; Copy out. (unless (file-exists-p out-dir) (make-directory out-dir t))