commit 28a9438169f379cea6d79fb480a85fc56ad666f4 (HEAD, refs/remotes/origin/master) Author: Jim Porter Date: Mon Mar 27 20:58:55 2023 -0700 Fix expansion of globs that contain a ~USER reference This regressed from the fix to bug#28064, and was discovered here: . * lisp/eshell/em-dirs.el (eshell-expand-user-reference): Let FILE be a list, and move the implementation to... (eshell-expand-user-reference-1): ... here. * lisp/eshell/em-glob.el (eshell-add-glob-modifier): Remove special handling for expanding user references; it's better to keep it in "em-dirs.el". diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 4bc6342d422..5284df9ab59 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -253,12 +253,21 @@ eshell-dirs-substitute-cd (throw 'eshell-replace-command (eshell-parse-command "cd" (flatten-tree args))))) -(defun eshell-expand-user-reference (file) +(defun eshell-expand-user-reference-1 (file) "Expand a user reference in FILE to its real directory name." (replace-regexp-in-string (rx bos (group "~" (*? anychar)) (or "/" eos)) #'expand-file-name file)) +(defun eshell-expand-user-reference (file) + "Expand a user reference in FILE to its real directory name. +FILE can be either a string or a list of strings to expand." + ;; If the argument was a glob pattern, then FILE is a list, so + ;; expand each element of the glob's resulting list. + (if (listp file) + (mapcar #'eshell-expand-user-reference-1 file) + (eshell-expand-user-reference-1 file))) + (defun eshell-parse-user-reference () "An argument beginning with ~ is a filename to be expanded." (when (and (not eshell-current-argument) diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 8a2ba13b2ad..9402df43065 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -145,16 +145,6 @@ eshell-no-command-globbing (defun eshell-add-glob-modifier () "Add `eshell-extended-glob' to the argument modifier list." - (when (memq 'expand-file-name eshell-current-modifiers) - (setq eshell-current-modifiers - (delq 'expand-file-name eshell-current-modifiers)) - ;; if this is a glob pattern than needs to be expanded, then it - ;; will need to expand each member of the resulting glob list - (add-to-list 'eshell-current-modifiers - (lambda (list) - (if (listp list) - (mapcar 'expand-file-name list) - (expand-file-name list))))) (add-to-list 'eshell-current-modifiers 'eshell-extended-glob)) (defun eshell-parse-glob-chars () commit 66b4394461589d0db8690b7971000f687bd3ad57 Author: Ken Brown Date: Sun Mar 26 15:02:30 2023 -0400 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. 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 @@ native-comp-compiler-options :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 @@ treesit--install-language-grammar-1 (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)) commit eb166287f3de74ab918e66e5e394554fb7acb9af Merge: b0d5f5168c1 edc460e3b6c Author: Stefan Monnier Date: Mon Mar 27 17:16:59 2023 -0400 Merge from origin/emacs-29 edc460e3b6c Fix accidental backward-incompatible change (bug#62417) cbef1422fe3 ruby-ts-mode: Fix/simplify Imenu index generation a0d5fba74a6 (ruby-ts--align-chain): Use 'equal' to check for an exact... commit b0d5f5168c1f4c3a321de8186858ff806fc5d720 Merge: 47bce04e875 f631c90e791 Author: Stefan Monnier Date: Mon Mar 27 17:16:59 2023 -0400 ; Merge from origin/emacs-29 The following commit was skipped: f631c90e791 ; Use string-search instead of string-match[-p] in ruby-t... commit 47bce04e875bdaf4a9e2bb33dc14794d373b676f Merge: 2b4e14e3abd 0337131bfa1 Author: Stefan Monnier Date: Mon Mar 27 17:16:59 2023 -0400 Merge from origin/emacs-29 0337131bfa1 Update to Transient v0.3.7-218-g3dbb22a a8c23677d39 Update to Org 9.6.2 45b16bfb496 Skip failing tests on Cygwin with native compilation (bug... 8b4a494d8d4 Fix GNUSTEP tests on EMBA # Conflicts: # test/infra/gitlab-ci.yml commit 2b4e14e3abd5be08ee2a4e832b5dbe8172869e24 Merge: dfa4fb9a2ab a952bdd6af0 Author: Stefan Monnier Date: Mon Mar 27 17:16:58 2023 -0400 ; Merge from origin/emacs-29 The following commit was skipped: a952bdd6af0 Fix primary selection modification during `term-mouse-pas... commit dfa4fb9a2ab5863a8fc903d0544c4d46d4b8e140 Merge: 701de494a05 b08bf828605 Author: Stefan Monnier Date: Mon Mar 27 17:16:58 2023 -0400 Merge from origin/emacs-29 b08bf828605 ; Fix :version of the new defcustom d941666d859 ; Fix last change e19b7da7b09 Add 'eww-default-download-directory'. 564c26bdbeb ; Fix edebug spec for 'gv-define-simple-setter' (bug#62256) commit 701de494a05f6bac5f1e791be88bfacdc1a98728 Merge: 616b22b5b95 9107b2dec1f Author: Stefan Monnier Date: Mon Mar 27 17:16:58 2023 -0400 ; Merge from origin/emacs-29 The following commits were skipped: 9107b2dec1f * doc/lispref/modes.texi: Improve docs for obsolete '%m' ... 59b7086838e Improve docs for global-mode-string / %M construct 207176e6b1c * src/buffer.c (mode-line-format): Document %o and %q con... 9cfae822fb3 * src/buffer.c (mode-line-format): Remove docs for obsole... commit 616b22b5b95ce442ee343a18bfbf9ef18d8bb04f Merge: cd62dc0dd2d 8f42db010d1 Author: Stefan Monnier Date: Mon Mar 27 17:16:58 2023 -0400 Merge from origin/emacs-29 8f42db010d1 Improve indenting "case" in Python c4d490490dc ; * test/src/fns-tests.el: Fix last change 875e77a66a6 * test/infra/Dockerfile.emba (emacs-native-comp): Add zli... 64a2b0d36fe Fix failure of fns-tests-collate-strings on Cygwin 90fc6b987ad * lisp/savehist.el (savehist-save): Preserve shared struc... 08fbc133756 Adapt Tramp manual accb3871668 Fix system time sampling on MS-Windows 33d436eefa1 Fix treesit_ensure_parsed (bug#62333) d93a439846f * lisp/help-fns.el (find-lisp-object-file-name): Fix bug#... be8147c53f9 Improve "Bugs" in the Emacs manual commit cd62dc0dd2d371f45e6e0b4f031b7deb674edf39 Merge: 624416a2aed 82523dc621a Author: Stefan Monnier Date: Mon Mar 27 17:16:58 2023 -0400 ; Merge from origin/emacs-29 The following commit was skipped: 82523dc621a Fix Eglot progress reporting commit 624416a2aedad6392b1c5c27d322bf26730d6a03 Merge: afbb9b426ce 1bc9dfc5bee Author: Stefan Monnier Date: Mon Mar 27 17:14:27 2023 -0400 Merge commit '1bc9dfc5bee' commit afbb9b426cec216dfa303a46fb0ece59b2dd45f8 Author: Michael Albinus Date: Mon Mar 27 18:32:49 2023 +0200 * test/infra/Dockerfile.emba (emacs-eglot): Adapt software selection. 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 commit 0bd2bbc0c2cb06cd254bf67f75d284f4c16f45a8 Author: Michael Albinus Date: Mon Mar 27 15:46:44 2023 +0200 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. 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 @@ tramp-rename-files (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 @@ tramp-rename-files (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 @@ tramp-rename-these-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 @@ tramp-crypt-do-encrypt-or-decrypt-file-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 @@ tramp-crypt-do-encrypt-or-decrypt-file (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 @@ tramp-crypt-add-directory ;; (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 @@ tramp-crypt-remove-directory ;; (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 @@ tramp-gvfs-do-copy-or-rename-file (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 @@ tramp-sh-handle-make-symbolic-link (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 @@ tramp-do-copy-or-rename-file-directly 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 @@ tramp-do-copy-or-rename-file-directly "%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 @@ tramp-do-copy-or-rename-file-directly "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 @@ tramp-smb-handle-delete-directory ;; "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 @@ tramp-dissect-file-name (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 @@ tramp-dissect-hop-name ;; 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 @@ tramp-handle-file-user-uid ;; 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 @@ tramp-compute-multi-hops (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 commit edc460e3b6c38eee97dde847987b2c29dd134653 (refs/remotes/origin/emacs-29) Author: João Távora Date: Mon Mar 27 12:25:16 2023 +0100 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. 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 @@ buffer-match-p - 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 @@ buffer-match-p (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 @@ display-buffer-alist 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 @@ display-buffer-fallback-action (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 commit cbef1422fe3ba5d3327835f3952a0f42f7881716 Author: Dmitry Gutov Date: Mon Mar 27 03:49:13 2023 +0300 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. 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 @@ ruby-ts--full-name "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 @@ ruby-ts--imenu-helper (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 @@ ruby-ts-resource-file (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) commit a0d5fba74a638aa320aefa0a6583d233bbcee99f Author: Dmitry Gutov Date: Mon Mar 27 02:11:16 2023 +0300 (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. 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 @@ ruby-ts--align-chain (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)))) commit f631c90e791ef94b27c5ea4c9c1d865a498ad476 Author: Mattias Engdegård Date: Sun Mar 26 12:09:41 2023 +0200 ; 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) 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 @@ ruby-ts--align-chain (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)))) commit 0337131bfa194856234ddfe70ee38b3165d66289 Author: Jonas Bernoulli Date: Sun Mar 26 23:53:03 2023 +0200 Update to Transient v0.3.7-218-g3dbb22a 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 @@ FAQ 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 @@ transient-inapt (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))) commit a8c23677d3939b8af1bcddb63244fe7b5bb384a4 Author: Kyle Meyer Date: Sun Mar 26 17:01:14 2023 -0400 Update to Org 9.6.2 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 @@ org-texinfo-supports-math-p "\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) commit 45b16bfb496025d9f21f7cdccb6a25a0be83a26f Author: Ken Brown Date: Sat Mar 25 16:37:51 2023 -0400 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. 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 @@ .PHONY: 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))))) commit 8b4a494d8d4413ae6d566f6478f84e319aeaacdd Author: Michael Albinus Date: Sun Mar 26 14:20:05 2023 +0200 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. diff --git a/configure.ac b/configure.ac index c818343a5ad..aa78c7a16dc 100644 --- a/configure.ac +++ b/configure.ac @@ -2059,8 +2059,8 @@ AC_DEFUN 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. commit a952bdd6af081ef78f25f20d0a6cde612ce10df0 Author: Phil Sainty Date: Mon Mar 27 01:06:52 2023 +1300 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. 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 @@ term-mouse-paste (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." commit b08bf8286059cb75166401c8cad01e3661cb8833 Author: Eli Zaretskii Date: Sun Mar 26 14:58:40 2023 +0300 ; Fix :version of the new defcustom 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 @@ eww-use-browse-url (defcustom eww-download-directory "~/Downloads/" "Default directory where `eww' saves downloaded files." - :version "30.1" + :version "29.1" :group 'eww :type 'directory) commit d941666d8593bbee5a50262b2c4177ffa2010e56 Author: Eli Zaretskii Date: Sun Mar 26 14:56:57 2023 +0300 ; 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) 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 @@ eww-use-browse-url :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. commit e19b7da7b09ed44bf08b06be082abdfc23d44e6f Author: Xi Lu Date: Sat Mar 25 21:38:48 2023 +0800 Add 'eww-default-download-directory'. * lisp/net/eww.el (eww-default-download-directory): New defcustom. (eww--download-directory): Use it. (Bug#62435) 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 @@ eww-use-browse-url :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. commit 564c26bdbeb1ebc1dcf00fb02d605140408a5be5 Author: Matus Goljer Date: Sun Mar 26 13:20:19 2023 +0200 ; Fix edebug spec for 'gv-define-simple-setter' (bug#62256) 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 @@ gv-define-simple-setter (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) commit 9107b2dec1f7cab9062b65013b02c8601d205015 Author: Phil Sainty Date: Sun Aug 14 23:16:48 2022 +1200 * doc/lispref/modes.texi: Improve docs for obsolete '%m' construct Bug #57080. 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 @@ %-Constructs 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 commit 59b7086838e3f82c76977ae0f79b862ab2e7a782 Author: Phil Sainty Date: Sun Aug 14 23:14:51 2022 +1200 Improve docs for global-mode-string / %M construct * src/xdisp.c (global-mode-string): Update docstring. * doc/lispref/modes.texi: Update manual. 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 @@ Mode Line Variables @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 @@ %-Constructs 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 @@ syms_of_xdisp (void) 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, commit 207176e6b1c162dddebddcfb1ba7efd270d48b01 Author: Phil Sainty Date: Sun Aug 14 23:11:43 2022 +1200 * src/buffer.c (mode-line-format): Document %o and %q constructs Missed from commit b0b02ca7f3e06d0f092df6f81babd1277bf93b0f. 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 @@ syms_of_buffer (void) %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. commit 9cfae822fb36dc4beb4d397c36c447d059c18ca7 Author: Phil Sainty Date: Sun Aug 14 22:34:41 2022 +1200 * 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 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 @@ syms_of_buffer (void) %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. commit 8f42db010d15efa21fb9007e61daedbe1e2dfa53 Author: kobarity Date: Sat Mar 25 22:59:05 2023 +0900 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) 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 @@ python-info-dedenter-statement-p (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 @@ python-info-dedenter-opening-block-positions-6 (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 @@ python-info-dedenter-statement-p-5 (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 " commit c4d490490dc24c76fbead7941518ad503672d216 Author: Ken Brown Date: Sat Mar 25 12:54:23 2023 -0400 ; * test/src/fns-tests.el: Fix last change 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 @@ fns-tests-collate-strings ;; 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) commit 875e77a66a66d7a5ab755af7f7cf6a9ba1e17c01 Author: Michael Albinus Date: Sat Mar 25 17:33:33 2023 +0100 * test/infra/Dockerfile.emba (emacs-native-comp): Add zlib1g-dev. 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 commit 64a2b0d36fe9152641fe2017d36d5fc4ee2b7fc6 Author: Ken Brown Date: Fri Mar 24 11:35:40 2023 -0400 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) 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 @@ fns-tests-collate-strings ;; 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 commit 90fc6b987ad8f6531834906749be4d159fc1184f Author: Aaron L. Zeng Date: Tue Mar 21 16:07:54 2023 -0400 * 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 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 @@ savehist-save 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 commit 08fbc133756be38c02f04f64dbe0e2c9c1d0f228 Author: Michael Albinus Date: Fri Mar 24 13:30:25 2023 +0100 Adapt Tramp manual * doc/misc/tramp.texi (Default Method): OpenSSH for MS Windows can be used. (Ssh setup): Extend for MS Windows and ssh. 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 @@ Default Method @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 @@ Ssh setup 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 @@ Ssh setup @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. commit accb3871668201a1d7b9c54713b94b814c879271 Author: Eli Zaretskii Date: Fri Mar 24 14:10:30 2023 +0300 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. 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 @@ tm_diff (struct tm *a, struct tm *b) 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); commit 33d436eefa16dfd4cf53bd53fdd764b2896c649c Author: Yuan Fu Date: Fri Mar 24 00:17:10 2023 -0700 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. 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; commit d93a439846f03dfb2be28d6b5c2e963ef6be0c22 Author: Stefan Monnier Date: Thu Mar 23 13:43:45 2023 -0400 * lisp/help-fns.el (find-lisp-object-file-name): Fix bug#62376 part2 Nowadays `loaddefs.el` are byte-compiled, so adjust pattern accordingly 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 @@ find-lisp-object-file-name (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'. commit be8147c53f9dd2d896c27d5b32bf4f38b0af9b3f Author: Eli Zaretskii Date: Thu Mar 23 15:33:04 2023 +0200 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) 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 @@ Bugs 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 @@ Bugs @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 @@ Known Problems @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 @@ Known Problems 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 @@ Bug Criteria @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 @@ Understanding Bug Reporting 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 @@ Checklist @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 @@ Checklist 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 @@ Checklist 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 @@ Checklist 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. - -@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. - -@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. - -@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.) +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.'' -Be precise about these changes. A description in English is not -enough---send a unified context diff for them. +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? -Adding files of your own, or porting to another machine, is a -modification of the source. +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 -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,6 +862,47 @@ Checklist information (such as passwords) may end up recorded in the dribble file. +@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 +confusing, copy in the text from the manual which you think is +at fault. If the section is small, just the section name is enough. + +@item +If the manifestation of the bug is an Emacs error message, it is +important to report the precise text of the error message, and a +backtrace showing how the Lisp program in Emacs arrived at the error. + +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. + +@item +Check whether any programs you have loaded into the Lisp world, +including your initialization file, set any variables that may affect +the functioning of Emacs. Also, see whether the problem happens in a +freshly started Emacs without loading your initialization file (start +Emacs with the @code{-Q} switch to prevent loading the init files). +If the problem does @emph{not} occur then, you must report the precise +contents of any programs that you must load into the Lisp world in +order to cause the problem to occur. + +@item +If the problem does depend on an init file or other Lisp programs that +are not part of the standard Emacs system, then you should make sure it +is not a bug in those programs by complaining to their maintainers +first. After they verify that they are using Emacs in a way that is +supposed to work, they should report the bug. + +@item +If you wish to mention something in the GNU Emacs source, show the line +of code with a few lines of context. Don't just give a line number. + +The line numbers in the development sources don't match those in your +sources. It would take extra work for the maintainers to determine what +code is in your version at a given line number, and we could not be +certain. + @item @findex open-termscript @cindex termscript file @@ -834,27 +913,70 @@ Checklist 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 +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 @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. +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. +@end itemize + +@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. + +@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. + +@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. + +@item +The command-line arguments given to the @code{configure} command when +Emacs was built (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. @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 +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: @@ -863,64 +985,102 @@ Checklist LC_MESSAGES=$LC_MESSAGES LC_TIME=$LC_TIME LANG=$LANG @end smallexample -Alternatively, use the @command{locale} command, if your system has it, +You can also use the @command{locale} command, if your system has it, to display your locale settings. +@end itemize -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. +Here are some things that are not necessary in a bug report: +@itemize @bullet @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.'' +A description of the envelope of the bug---this is not necessary for a +reproducible bug. -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? +Often people who encounter a bug spend a lot of time investigating +which changes to the input file will make the bug go away and which +changes will not affect it. -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. +This is often time-consuming and not very useful, because the way we +will find the bug is by running a single example under the debugger +with breakpoints, not by pure deduction from a series of examples. +You might as well save time by not searching for additional examples. +It is better to send the bug report right away, go back to editing, +and find another bug to report. + +Of course, if you can find a simpler example to report @emph{instead} of +the original one, that is a convenience. Errors in the output will be +easier to spot, running under the debugger will take less time, etc. + +However, simplification is not vital; if you can't do this or don't have +time to try, please report the bug with your original test case. @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 -confusing, copy in the text from the manual which you think is -at fault. If the section is small, just the section name is enough. +A core dump file. + +Debugging the core dump might be useful, but it can only be done on +your machine, with your Emacs executable. Therefore, sending the core +dump file to the Emacs maintainers won't be useful. Above all, don't +include the core file in an email bug report! Such a large message +can be extremely inconvenient. @item -If the manifestation of the bug is an Emacs error message, it is -important to report the precise text of the error message, and a -backtrace showing how the Lisp program in Emacs arrived at the error. +A system-call trace of Emacs execution. -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. +System-call traces are very useful for certain special kinds of +debugging, but in most cases they give little useful information. It is +therefore strange that many people seem to think that @emph{the} way to +report information about a crash is to send a system-call trace. Perhaps +this is a habit formed from experience debugging programs that don't +have source code or debugging symbols. + +In most programs, a backtrace is normally far, far more informative than +a system-call trace. Even in Emacs, a simple backtrace is generally +more informative, though to give full information you should supplement +the backtrace by displaying variable values and printing them as Lisp +objects with @code{pr} (see above). + +@item +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 +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. @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. + +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 -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. +@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. @@ -933,32 +1093,6 @@ Checklist 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 -the functioning of Emacs. Also, see whether the problem happens in a -freshly started Emacs without loading your initialization file (start -Emacs with the @code{-Q} switch to prevent loading the init files). -If the problem does @emph{not} occur then, you must report the precise -contents of any programs that you must load into the Lisp world in -order to cause the problem to occur. - -@item -If the problem does depend on an init file or other Lisp programs that -are not part of the standard Emacs system, then you should make sure it -is not a bug in those programs by complaining to their maintainers -first. After they verify that they are using Emacs in a way that is -supposed to work, they should report the bug. - -@item -If you wish to mention something in the GNU Emacs source, show the line -of code with a few lines of context. Don't just give a line number. - -The line numbers in the development sources don't match those in your -sources. It would take extra work for the maintainers to determine what -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. @@ -967,9 +1101,10 @@ Checklist 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 +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. +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. @@ -1000,8 +1135,8 @@ Checklist To make Lisp errors stop Emacs and return to GDB, put a breakpoint at @code{Fsignal}. -For a short listing of Lisp functions running, type the GDB -command @code{xbacktrace}. +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 @@ -1021,79 +1156,6 @@ Checklist directory name stored in the variable @code{data-directory}. @end itemize -Here are some things that are not necessary in a bug report: - -@itemize @bullet -@item -A description of the envelope of the bug---this is not necessary for a -reproducible bug. - -Often people who encounter a bug spend a lot of time investigating -which changes to the input file will make the bug go away and which -changes will not affect it. - -This is often time-consuming and not very useful, because the way we -will find the bug is by running a single example under the debugger -with breakpoints, not by pure deduction from a series of examples. -You might as well save time by not searching for additional examples. -It is better to send the bug report right away, go back to editing, -and find another bug to report. - -Of course, if you can find a simpler example to report @emph{instead} of -the original one, that is a convenience. Errors in the output will be -easier to spot, running under the debugger will take less time, etc. - -However, simplification is not vital; if you can't do this or don't have -time to try, please report the bug with your original test case. - -@item -A core dump file. - -Debugging the core dump might be useful, but it can only be done on -your machine, with your Emacs executable. Therefore, sending the core -dump file to the Emacs maintainers won't be useful. Above all, don't -include the core file in an email bug report! Such a large message -can be extremely inconvenient. - -@item -A system-call trace of Emacs execution. - -System-call traces are very useful for certain special kinds of -debugging, but in most cases they give little useful information. It is -therefore strange that many people seem to think that @emph{the} way to -report information about a crash is to send a system-call trace. Perhaps -this is a habit formed from experience debugging programs that don't -have source code or debugging symbols. - -In most programs, a backtrace is normally far, far more informative than -a system-call trace. Even in Emacs, a simple backtrace is generally -more informative, though to give full information you should supplement -the backtrace by displaying variable values and printing them as Lisp -objects with @code{pr} (see above). - -@item -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 -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 - -@item -A guess about what the bug is or what it depends on. - -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 - @node Sending Patches @subsection Sending Patches for GNU Emacs @@ -1108,26 +1170,29 @@ Sending Patches your best to help. Every patch must have several pieces of information before we -can properly evaluate it. - -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. - -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. +can properly evaluate it. They are described below. + +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. + +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 @@ Sending Patches @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 @@ Sending Patches 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. - -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}, +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. + +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 @@ Sending Patches @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 @@ Sending Patches 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 @@ Contributing @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 @@ Contributing 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 @@ Contributing @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 @@ Coding Standards @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 @@ Copyright Assignment 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), commit 82523dc621ace104d8f379509a436fcb03c48c26 Author: João Távora Date: Thu Mar 23 10:25:17 2023 +0000 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. 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 @@ eglot-handle-notification (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 commit 1bc9dfc5bee5c69d82f9a3ed448ba2fefea82a96 Author: João Távora Date: Tue Mar 21 14:55:57 2023 +0000 ; Minor copyedits to Eglot manual * doc/misc/eglot.texi (Troubleshooting Eglot): Minor fixes. 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 @@ Troubleshooting Eglot 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 @@ Troubleshooting Eglot 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 @@ Troubleshooting Eglot @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 commit bcd02cf5127ecfe6d6ce4ac316f881246c49db4f Author: Eli Zaretskii Date: Thu Mar 23 11:30:19 2023 +0200 ; 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. 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 @@ Defining Minor Modes 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 @@ Defining Minor Modes 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 @@ Defining Minor Modes 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 @@ Defining Minor 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 @@ define-globalized-minor-mode 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 commit 930b9fdd3ab9185e2faba8a08fbae81c82fa434a Author: Stefan Monnier Date: Wed Mar 22 13:52:50 2023 -0400 Fix :predicate handling in globalized minor modes * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix a thinko. (Bug#62376) 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 @@ define-globalized-minor-mode (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)))) commit 19c95b141606282915ed6c1a3f2c42a6b7a4420b Author: Eli Zaretskii Date: Thu Mar 23 10:31:56 2023 +0200 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'. 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 @@ describe-bindings-outline :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 @@ describe-map (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 commit f0a2f37deec868751542f5b67fc9e545570172ae Author: Daniel Martín Date: Sat Mar 18 01:47:32 2023 +0100 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) 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 @@ - (instancetype)toolbarClicked: (id)item return self; } +- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem +{ + return [toolbarItem isEnabled]; +} - (instancetype)toggleToolbar: (id)sender { commit 22de4b1e724da7ceadc117c0d4611ecf4bf589d1 Author: Eli Zaretskii Date: Thu Mar 23 10:03:04 2023 +0200 ; Describe problems with 'screen' and COLORTERM variable * etc/PROBLEMS: Describe the issue with 'screen' and COLORTERM=truecolor. (Bug#62237) 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.