commit 161cb6034cec114b59f8fabc4230b3f48ac6cecb (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Nov 11 09:14:14 2022 +0200 ; * CONTRIBUTE: Clarify the log message line width guidelines. diff --git a/CONTRIBUTE b/CONTRIBUTE index 94d757daaf..c226645bd7 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -202,9 +202,10 @@ them right the first time, so here are guidelines for formatting them: you can put a paragraph (after the empty line and before the individual ChangeLog entries) that further describes the commit. -- Limit lines in commit messages to 78 characters, unless they consist - of a single word of at most 140 characters; this is enforced by a - commit hook. +- Lines in ChangeLog entries should preferably be not longer than 63 + characters, and must not exceed 78 characters, unless they consist + of a single word of at most 140 characters; this 78/140 limit is + enforced by a commit hook. - If only a single file is changed, the summary line can be the normal file first line (starting with the asterisk). Then there is no commit 0f5352377539bc2587b9bfd068de0f4b3bf8b248 Author: Stefan Kangas Date: Fri Nov 11 04:29:29 2022 +0100 Remove redundant library installation instructions * lisp/apropos.el: * lisp/mail/feedmail.el: * lisp/mail/mail-hist.el: * lisp/org/org-ctags.el: * lisp/org/org-protocol.el: * lisp/progmodes/ebnf2ps.el: * lisp/progmodes/mixal-mode.el: * lisp/progmodes/perl-mode.el: * lisp/savehist.el: * lisp/textmodes/table.el: * lisp/vc/smerge-mode.el: Remove redundant installation instructions for packages bundled with Emacs. diff --git a/lisp/apropos.el b/lisp/apropos.el index 624c29cb41..62a37df820 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -25,8 +25,7 @@ ;;; Commentary: ;; The ideas for this package were derived from the C code in -;; src/keymap.c and elsewhere. The functions in this file should -;; always be byte-compiled for speed. +;; src/keymap.c and elsewhere. ;; The idea for super-apropos is based on the original implementation ;; by Lynn Slater . diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 2ae916e3ac..eb6a071bf4 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -131,17 +131,13 @@ ;; feedmail-send-it. Hers's the best way to use the stuff in this ;; file: ;; -;; Save this file as feedmail.el somewhere on your elisp loadpath; -;; byte-compile it. Put the following lines in your init file: +;; Put the following lines in your init file: ;; ;; (setq send-mail-function 'feedmail-send-it) -;; (autoload 'feedmail-send-it "feedmail") ;; ;; If you plan to use the queue stuff, also use this: ;; ;; (setq feedmail-enable-queue t) -;; (autoload 'feedmail-run-the-queue "feedmail") -;; (autoload 'feedmail-run-the-queue-no-prompts "feedmail") ;; (setq auto-mode-alist (cons '("\\.fqm$" . mail-mode) auto-mode-alist)) ;; ;; though VM users might find it more comfortable to use this instead of @@ -174,11 +170,6 @@ ;; like to add the suffix ".fqm" to the list of non-saved things via the variable ;; desktop-files-not-to-save. ;; -;; If you are planning to call feedmail-queue-reminder from your .emacs or -;; something similar, you might need this: -;; -;; (autoload 'feedmail-queue-reminder "feedmail") -;; ;; If you ever use rmail-resend and queue messages, you should do this: ;; ;; (setq feedmail-queue-alternative-mail-header-separator "") diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el index a13f9de174..9fb7b36e98 100644 --- a/lisp/mail/mail-hist.el +++ b/lisp/mail/mail-hist.el @@ -1,6 +1,6 @@ ;;; mail-hist.el --- headers and message body history for outgoing mail -*- lexical-binding: t; -*- -;; Copyright (C) 1994, 2001-2022 Free Software Foundation, Inc. +;; Copyright (C) 1994-2022 Free Software Foundation, Inc. ;; Author: Karl Fogel ;; Created: March, 1994 @@ -24,21 +24,15 @@ ;;; Commentary: -;; Thanks to Jim Blandy for mentioning ring.el. It saved a lot of -;; time. -;; -;; To use this package, put it in a directory in your load-path, and -;; put this in your init file: +;; To use this package, add this to your init file: ;; -;; (load "mail-hist" nil t) +;; (require 'mail-hist) ;; -;; Or you could do it with autoloads and hooks in your .emacs: +;; Or you could do it with hooks in your .emacs: ;; -;; (add-hook 'mail-mode-hook 'mail-hist-define-keys) -;; (add-hook 'mail-send-hook 'mail-hist-put-headers-into-history) -;; (add-hook 'vm-mail-mode-hook 'mail-hist-define-keys) ;or rmail, etc -;; (autoload 'mail-hist-define-keys "mail-hist") -;; (autoload 'mail-hist-put-headers-into-history "mail-hist") +;; (add-hook 'mail-mode-hook 'mail-hist-define-keys) +;; (add-hook 'mail-send-hook 'mail-hist-put-headers-into-history) +;; (add-hook 'vm-mail-mode-hook 'mail-hist-define-keys) ;or rmail, etc ;; ;; Once it's installed, use M-p and M-n from mail headers to recover ;; previous/next contents in the history for that header, or, in the @@ -51,6 +45,9 @@ ;; point, so that you can mix the histories of different messages ;; easily. This might be confusing at times, but there should be no ;; problems that undo can't handle. +;; +;; Thanks to Jim Blandy for mentioning ring.el. It saved a lot of +;; time. ;;; Code: (require 'ring) diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index 67db49e9a6..b1ee32ab33 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -45,8 +45,6 @@ ;; Installation ;; ============ ;; -;; Install org mode -;; Ensure org-ctags.el is somewhere in your emacs load path. ;; Download and install Exuberant ctags -- "https://ctags.sourceforge.net/" ;; Edit your .emacs file (see next section) and load emacs. diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index 7a91a33b74..137a11f3d9 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -42,7 +42,6 @@ ;; ;; 1.) Add this to your init file (.emacs probably): ;; -;; (add-to-list 'load-path "/path/to/org-protocol/") ;; (require 'org-protocol) ;; ;; 3.) Ensure emacs-server is up and running. diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 6e42da2d54..1894826fe4 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -166,8 +166,6 @@ ;; ;; Where setup-ebnf2ps.el should be a file containing: ;; -;; ;; set load-path if ebnf2ps isn't installed in your Emacs environment -;; (setq load-path (append (list "/dir/of/ebnf2ps") load-path)) ;; (require 'ebnf2ps) ;; ;; insert here your ebnf2ps settings ;; (setq ebnf-terminal-shape 'bevel) diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el index 9d1ceaa55a..358b347f6e 100644 --- a/lisp/progmodes/mixal-mode.el +++ b/lisp/progmodes/mixal-mode.el @@ -33,9 +33,6 @@ ;; GNU MDK from `https://savannah.gnu.org/projects/mdk/' and ;; `https://ftp.gnu.org/pub/gnu/mdk'. ;; -;; To use this mode, place the following in your init file: -;; `(load-file "/PATH-TO-FILE/mixal-mode.el")'. -;; ;; When you load a file with the extension .mixal the mode will be started ;; automatically. If you want to start the mode manually, use `M-x mixal-mode'. ;; Font locking will work, the behavior of tabs is the same as Emacs's diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index db9df67279..4dd0fd67a6 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -27,8 +27,8 @@ ;;; Commentary: -;; To enter perl-mode automatically, add (autoload 'perl-mode "perl-mode") -;; to your init file and change the first line of your perl script to: +;; To enter `perl-mode' automatically, change the first line of your +;; perl script to: ;; #!/usr/bin/perl -- # -*-Perl-*- ;; With arguments to perl: ;; #!/usr/bin/perl -P- # -*-Perl-*- diff --git a/lisp/savehist.el b/lisp/savehist.el index 8924c8dde2..f1d3e50d94 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -1,6 +1,6 @@ ;;; savehist.el --- Save minibuffer history -*- lexical-binding:t -*- -;; Copyright (C) 1997, 2005-2022 Free Software Foundation, Inc. +;; Copyright (C) 1997-2022 Free Software Foundation, Inc. ;; Author: Hrvoje Nikšić ;; Maintainer: emacs-devel@gnu.org @@ -41,10 +41,6 @@ ;; You can also explicitly save history with `M-x savehist-save' and ;; load it by loading the `savehist-file' with `M-x load-file'. -;; If you are using a version of Emacs that does not ship with this -;; package, be sure to have `savehist.el' in a directory that is in -;; your load-path, and to byte-compile it. - ;;; Code: ;; User variables diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index f81cedc39b..2f34a58b5b 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -125,9 +125,7 @@ ;; are tired of guessing how it works come back to this document ;; again. ;; -;; To use the package regularly place this file in the site library -;; directory and add the next expression in your init file. Make -;; sure that directory is included in the `load-path'. +;; To use the package regularly, add this to your init file: ;; ;; (require 'table) ;; diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index 003b26eca4..e13894d6b5 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -23,11 +23,10 @@ ;;; Commentary: ;; Provides a lightweight alternative to emerge/ediff. -;; To use it, simply add to your .emacs the following lines: ;; -;; (autoload 'smerge-mode "smerge-mode" nil t) +;; To use it, simply type `M-x smerge-mode'. ;; -;; you can even have it turned on automatically with the following +;; You can even have it turned on automatically with the following ;; piece of code in your .emacs: ;; ;; (defun sm-try-smerge () commit ea8ed105fdbb7b14ac7f507483f19373738f2941 Author: Po Lu Date: Fri Nov 11 10:31:14 2022 +0800 Slightly adjust EWMH frame activation code for child frames * src/xterm.c (x_get_toplevel_parent): New function. (x_focus_frame): Do not use EWMH activation in two cases: focus transfers to child frames (this is not guaranteed to work if the focus and the child frame do not share the same toplevel) or focus transfers from child frames to their toplevel parents. diff --git a/src/xterm.c b/src/xterm.c index a175a4a6bb..0a25d7de05 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -27522,6 +27522,25 @@ x_get_focus_frame (struct frame *f) return lisp_focus; } +/* Return the toplevel parent of F, if it is a child frame. + Otherwise, return NULL. */ + +static struct frame * +x_get_toplevel_parent (struct frame *f) +{ + struct frame *parent; + + if (!FRAME_PARENT_FRAME (f)) + return NULL; + + parent = FRAME_PARENT_FRAME (f); + + while (FRAME_PARENT_FRAME (parent)) + parent = FRAME_PARENT_FRAME (parent); + + return parent; +} + /* In certain situations, when the window manager follows a click-to-focus policy, there seems to be no way around calling XSetInputFocus to give another frame the input focus. @@ -27547,6 +27566,14 @@ x_focus_frame (struct frame *f, bool noactivate) else { if (!noactivate + /* If F is a child frame, use SetInputFocus instead. This + may not work if its parent is not activated. */ + && !FRAME_PARENT_FRAME (f) + /* If the focus is being transferred from a child frame to + its toplevel parent, also use SetInputFocus. */ + && (!dpyinfo->x_focus_frame + || (x_get_toplevel_parent (dpyinfo->x_focus_frame) + != f)) && x_wm_supports (f, dpyinfo->Xatom_net_active_window)) { /* When window manager activation is possible, use it commit 52d9c51816d633f93bd0718d45b4c0e1cc2d4987 Author: Stefan Kangas Date: Fri Nov 11 01:53:41 2022 +0100 * lisp/progmodes/hideshow.el: Improve Commentary. diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index cb43efaf47..00507a3c1a 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -31,14 +31,14 @@ ;; are available, implementing block hiding and showing. They (and their ;; keybindings) are: ;; -;; hs-hide-block C-c @ C-h -;; hs-show-block C-c @ C-s -;; hs-hide-all C-c @ C-M-h -;; hs-show-all C-c @ C-M-s -;; hs-hide-level C-c @ C-l -;; hs-toggle-hiding C-c @ C-c -;; hs-toggle-hiding [(shift mouse-2)] -;; hs-hide-initial-comment-block +;; `hs-hide-block' C-c @ C-h +;; `hs-show-block' C-c @ C-s +;; `hs-hide-all' C-c @ C-M-h +;; `hs-show-all' C-c @ C-M-s +;; `hs-hide-level' C-c @ C-l +;; `hs-toggle-hiding' C-c @ C-c +;; `hs-toggle-hiding' S- +;; `hs-hide-initial-comment-block' ;; ;; Blocks are defined per mode. In c-mode, c++-mode and java-mode, they ;; are simply text between curly braces, while in Lisp-ish modes parens @@ -50,16 +50,14 @@ ;; * Suggested usage ;; -;; First make sure hideshow.el is in a directory in your `load-path'. -;; You can optionally byte-compile it using `M-x byte-compile-file'. -;; Then, add the following to your init file: +;; Add the following to your init file: ;; -;; (load-library "hideshow") -;; (add-hook 'X-mode-hook #'hs-minor-mode) ; other modes similarly +;; (require 'hideshow) +;; (add-hook 'X-mode-hook #'hs-minor-mode) ; other modes similarly ;; ;; where X = {emacs-lisp,c,c++,perl,...}. You can also manually toggle ;; hideshow minor mode by typing `M-x hs-minor-mode'. After hideshow is -;; activated or deactivated, `hs-minor-mode-hook' is run w/ `run-hooks'. +;; activated or deactivated, `hs-minor-mode-hook' is run with `run-hooks'. ;; ;; Additionally, Joseph Eydelnant writes: ;; I enjoy your package hideshow.el Version 5.24 2001/02/13 @@ -67,14 +65,14 @@ ;; toggle hide/show all with a single key. ;; Here are a few lines of code that lets me do just that. ;; -;; (defvar my-hs-hide nil "Current state of hideshow for toggling all.") -;; ;;;###autoload -;; (defun my-toggle-hideshow-all () "Toggle hideshow all." -;; (interactive) -;; (setq my-hs-hide (not my-hs-hide)) -;; (if my-hs-hide -;; (hs-hide-all) -;; (hs-show-all))) +;; (defvar my-hs-hide nil "Current state of hideshow for toggling all.") +;; ;;;###autoload +;; (defun my-toggle-hideshow-all () "Toggle hideshow all." +;; (interactive) +;; (setq my-hs-hide (not my-hs-hide)) +;; (if my-hs-hide +;; (hs-hide-all) +;; (hs-show-all))) ;; ;; [Your hideshow hacks here!] @@ -82,12 +80,12 @@ ;; ;; You can use `M-x customize-variable' on the following variables: ;; -;; - hs-hide-comments-when-hiding-all -- self-explanatory! -;; - hs-hide-all-non-comment-function -- if non-nil, when doing a -;; `hs-hide-all', this function -;; is called w/ no arguments -;; - hs-isearch-open -- what kind of hidden blocks to -;; open when doing isearch +;; - `hs-hide-comments-when-hiding-all' -- self-explanatory! +;; - `hs-hide-all-non-comment-function' -- if non-nil, when doing a +;; `hs-hide-all', this function +;; is called with no arguments +;; - `hs-isearch-open' -- what kind of hidden blocks to +;; open when doing isearch ;; ;; Some languages (e.g., Java) are deeply nested, so the normal behavior ;; of `hs-hide-all' (hiding all but top-level blocks) results in very @@ -96,21 +94,21 @@ ;; what is more useful. For example, the following code shows the next ;; nested level in addition to the top-level: ;; -;; (defun ttn-hs-hide-level-1 () -;; (when (hs-looking-at-block-start-p) -;; (hs-hide-level 1)) -;; (forward-sexp 1)) -;; (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1) +;; (defun ttn-hs-hide-level-1 () +;; (when (hs-looking-at-block-start-p) +;; (hs-hide-level 1)) +;; (forward-sexp 1)) +;; (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1) ;; -;; Hideshow works w/ incremental search (isearch) by setting the variable +;; Hideshow works with incremental search (isearch) by setting the variable ;; `hs-headline', which is the line of text at the beginning of a hidden ;; block that contains a match for the search. You can have this show up ;; in the mode line by modifying the variable `mode-line-format'. For ;; example, the following code prepends this info to the mode line: ;; -;; (unless (memq 'hs-headline mode-line-format) -;; (setq mode-line-format -;; (append '("-" hs-headline) mode-line-format))) +;; (unless (memq 'hs-headline mode-line-format) +;; (setq mode-line-format +;; (append '("-" hs-headline) mode-line-format))) ;; ;; See documentation for `mode-line-format' for more info. ;; @@ -121,8 +119,8 @@ ;; ;; One of `hs-hide-hook' or `hs-show-hook' is run for the toggling ;; commands when the result of the toggle is to hide or show blocks, -;; respectively. All hooks are run w/ `run-hooks'. See docs for each -;; variable or hook for more info. +;; respectively. All hooks are run with `run-hooks'. See the +;; documentation for each variable or hook for more information. ;; ;; Normally, hideshow tries to determine appropriate values for block ;; and comment definitions by examining the buffer's major mode. If commit 025d28ed8932153ba8a596a3de77c3c96ad6b2e0 Author: Stefan Kangas Date: Fri Nov 11 01:48:42 2022 +0100 Prefer defvar-keymap in hideshow.el * lisp/progmodes/hideshow.el (hs-minor-mode-map): Prefer defvar-keymap. diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 6de079f05a..cb43efaf47 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -348,22 +348,20 @@ info node `(elisp)Overlays'." "Non-nil if using hideshow mode as a minor mode of some other mode. Use the command `hs-minor-mode' to toggle or set this variable.") -(defvar hs-minor-mode-map - (let ((map (make-sparse-keymap))) - ;; These bindings roughly imitate those used by Outline mode. - (define-key map "\C-c@\C-h" #'hs-hide-block) - (define-key map "\C-c@\C-s" #'hs-show-block) - (define-key map "\C-c@\C-\M-h" #'hs-hide-all) - (define-key map "\C-c@\C-\M-s" #'hs-show-all) - (define-key map "\C-c@\C-l" #'hs-hide-level) - (define-key map "\C-c@\C-c" #'hs-toggle-hiding) - (define-key map "\C-c@\C-a" #'hs-show-all) - (define-key map "\C-c@\C-t" #'hs-hide-all) - (define-key map "\C-c@\C-d" #'hs-hide-block) - (define-key map "\C-c@\C-e" #'hs-toggle-hiding) - (define-key map [(shift mouse-2)] #'hs-toggle-hiding) - map) - "Keymap for hideshow minor mode.") +(defvar-keymap hs-minor-mode-map + :doc "Keymap for hideshow minor mode." + ;; These bindings roughly imitate those used by Outline mode. + "C-c @ C-h" #'hs-hide-block + "C-c @ C-s" #'hs-show-block + "C-c @ C-M-h" #'hs-hide-all + "C-c @ C-M-s" #'hs-show-all + "C-c @ C-l" #'hs-hide-level + "C-c @ C-c" #'hs-toggle-hiding + "C-c @ C-a" #'hs-show-all + "C-c @ C-t" #'hs-hide-all + "C-c @ C-d" #'hs-hide-block + "C-c @ C-e" #'hs-toggle-hiding + "S-" #'hs-toggle-hiding) (easy-menu-define hs-minor-mode-menu hs-minor-mode-map "Menu used when hideshow minor mode is active." commit 1a2d603bb3938ff68ed1a5412d131b41efd40a24 Author: dannyfreeman Date: Thu Nov 3 09:39:16 2022 -0400 Eglot: Only handle URIs with the file:// scheme (bug#58790) Eglot will not attempt to parse URIs that are not file:// type at all. Instead let 'file-name-handler-alist' entries to deal with those. Not parsing them at all allows the 'file-name-handler-alist' regexps to identify them more accurately. By also checking if Eglot received a URI in 'eglot--path-to-uri', 'file-name-handler-alist' can provide the non-file type URI back to the lsp server, which presumably will know how to handle them since it is also giving them out to clients. This issue originated with clojure-lsp sending clients "jar:" type URIs that Emacs is unable to handle out of the box. Before this change, "jar:" URIs were parsed once, but since they contain a nested URI, this resulted in a file being dispatched with a partially parsed path that looked like "file://path/to.jar!/path/in/jar". * lisp/progmodes/eglot.el (eglot--path-to-uri): Noop if already an URI. (eglot--uri-to-path): Only handle file:// URIs diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1b1302d689..2463f68f97 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1501,29 +1501,38 @@ If optional MARKER, return a marker instead" (defun eglot--path-to-uri (path) "URIfy PATH." (let ((truepath (file-truename path))) - (concat "file://" - ;; Add a leading "/" for local MS Windows-style paths. - (if (and (eq system-type 'windows-nt) - (not (file-remote-p truepath))) - "/") - (url-hexify-string - ;; Again watch out for trampy paths. - (directory-file-name (file-local-name truepath)) - eglot--uri-path-allowed-chars)))) + (if (url-type (url-generic-parse-url truepath)) + ;; Path is already a URI, so forward it to the lsp server untouched. + truepath + (concat "file://" + ;; Add a leading "/" for local MS Windows-style paths. + (if (and (eq system-type 'windows-nt) + (not (file-remote-p truepath))) + "/") + (url-hexify-string + ;; Again watch out for trampy paths. + (directory-file-name (file-local-name truepath)) + eglot--uri-path-allowed-chars))))) (defun eglot--uri-to-path (uri) "Convert URI to file path, helped by `eglot--current-server'." (when (keywordp uri) (setq uri (substring (symbol-name uri) 1))) (let* ((server (eglot-current-server)) (remote-prefix (and server (eglot--trampish-p server))) - (retval (url-unhex-string (url-filename (url-generic-parse-url uri)))) - ;; Remove the leading "/" for local MS Windows-style paths. - (normalized (if (and (not remote-prefix) - (eq system-type 'windows-nt) - (cl-plusp (length retval))) - (substring retval 1) - retval))) - (concat remote-prefix normalized))) + (url (url-generic-parse-url uri))) + ;; Only attempt to parse URIs with the file scheme. + (if (string= "file" (url-type url)) + (let* ((retval (url-unhex-string (url-filename url))) + ;; Remove the leading "/" for local MS Windows-style paths. + (normalized (if (and (not remote-prefix) + (eq system-type 'windows-nt) + (cl-plusp (length retval))) + (substring retval 1) + retval))) + (concat remote-prefix normalized)) + ;; Leave non-file type URIs untouched, `file-name-handler-alist' + ;; handlers can be used to dispatch them properly. + uri))) (defun eglot--snippet-expansion-fn () "Compute a function to expand snippets. commit c3b64985aa6f61886a24974836635284c86478ef Author: João Távora Date: Thu Nov 10 21:06:33 2022 +0000 Improve Eglot's docstrings and manual The examples in the manual can now be copy-pasted to user's init files as-is. * doc/misc/eglot.texi (Setting Up LSP Servers): Use `with-eval-after-load'. Add eglot-alternatives example. (Customizing Eglot): Use 'require and fix a typo. * lisp/progmodes/eglot.el (eglot-server-programs): Mention eglot-alternatives in eglot-server-program's docstring. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 8d184976cd..04bdcc6161 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -264,8 +264,9 @@ Emacs major-mode @code{foo-mode}, you can add it to the alist like this: @lisp -(add-to-list 'eglot-server-programs - '(foo-mode . ("fools" "--stdio"))) +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + '(foo-mode . ("fools" "--stdio")))) @end lisp This will invoke the program @command{fools} with the command-line @@ -277,6 +278,24 @@ mentioned by the @code{exec-path} variable (@pxref{Subprocess Creation,,, elisp, GNU Emacs Lisp Reference Manual}), for Eglot to be able to find it. +Sometimes, multiple servers are acceptable alternatives for handling a +given major-mode. In those cases, you may combine the helper function +@code{eglot-alternatives} with the funcional form of +@code{eglot-server-programs}. + +@lisp +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + `(foo-mode . ,(eglot-alternatives + '(("fools" "--stdio") + ("phewls" "--fast")))))) +@end lisp + +If you have @command{fools} and @command{phewls} installed, the +function produced by @code{eglot-alternatives} will prompt for the +server to use in @code{foo-mode} buffers. Else it will use whichever +is available. + @node Starting Eglot @section Starting Eglot @cindex starting Eglot @@ -1046,8 +1065,10 @@ Eglot via Elisp to adapt to it, by defining a suitable Here's an example: @lisp +(require 'eglot) + (add-to-list 'eglot-server-programs - '((c++ mode c-mode) . (eglot-cquery "cquery"))) + '((c++-mode c-mode) . (eglot-cquery "cquery"))) (defclass eglot-cquery (eglot-lsp-server) () :documentation "A custom class for cquery's C/C++ langserver.") diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 7fa4bd380c..1b1302d689 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -298,7 +298,10 @@ CONTACT can be: the call is interactive, the function can ask the user for hints on finding the required programs, etc. Otherwise, it should not ask the user for any input, and return nil or signal - an error if it can't produce a valid CONTACT.") + an error if it can't produce a valid CONTACT. The helper + function `eglot-alternatives' (which see) can be used to + produce a function that offers more than one server for a given + MAJOR-MODE.") (defface eglot-highlight-symbol-face '((t (:inherit bold))) commit 2e8551c0766daff940021b36b895d00be507e63a Author: Juri Linkov Date: Thu Nov 10 20:35:58 2022 +0200 ; * lisp/tab-line.el (tab-line-cache-key-function): Fix docstring (bug#57848). diff --git a/lisp/tab-line.el b/lisp/tab-line.el index e5e5b7b2ec..99a785ee3e 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -585,8 +585,8 @@ For use in `tab-line-tab-face-functions'." (defvar tab-line-cache-key-function #'tab-line-cache-key-default "Function that adds more cache keys. -It has one argument with a list of tabs, and returns a list of cache keys. -You can use `add-function' to add more cache keys.") +It is called with one argument, a list of tabs, and should return a list +of cache keys. You can use `add-function' to add more cache keys.") (defun tab-line-format () "Format for displaying the tab line of the selected window." commit 53f25609fc28fbc039a3867635e91711488936e5 Merge: 702a47f4f6 c833b291f5 Author: Eli Zaretskii Date: Thu Nov 10 19:18:28 2022 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit c833b291f57e61613cbf09cffae478aa02e6ecc5 Author: Evgeni Kolev Date: Thu Nov 10 17:17:44 2022 +0000 Ignore errors when shutting down all LSP servers (bug#59146) eglot-shutdown-all has a bug that results in partially stopping servers: when a server shutdown timeouts (1.5s), an error is propagated and eglot-shutdown-all does not try to shutdown the rest of the servers. * eglot.el (eglot-shutdown-all): Ignore errors when shutting down servers, converting errors to messages. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index f69d392b46..7fa4bd380c 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -877,7 +877,8 @@ SERVER." PRESERVE-BUFFERS as in `eglot-shutdown', which see." (interactive (list current-prefix-arg)) (cl-loop for ss being the hash-values of eglot--servers-by-project - do (cl-loop for s in ss do (eglot-shutdown s nil nil preserve-buffers)))) + do (with-demoted-errors "[eglot] shutdown all: %s" + (cl-loop for s in ss do (eglot-shutdown s nil nil preserve-buffers))))) (defun eglot--on-shutdown (server) "Called by jsonrpc.el when SERVER is already dead." commit 702a47f4f6f1f06e5d1c2f472de5c06d47fc38a0 Author: Eli Zaretskii Date: Thu Nov 10 19:16:40 2022 +0200 Don't reset the inbox buffer's modified status in Rmail * lisp/mail/rmail.el (rmail-get-new-mail-1): Don't mark the buffer unmodified if it was modified before getting new mail. (Bug#59108) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index f095d5e9c0..e3372a6ff4 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1751,6 +1751,7 @@ not be a new one). It returns non-nil if it got any new messages." (spam-filter-p (and (featurep 'rmail-spam-filter) rmail-use-spam-filter)) (blurb "") + (mod-p (buffer-modified-p)) result success suffix) (narrow-to-region (point) (point)) ;; Read in the contents of the inbox files, renaming them as @@ -1766,10 +1767,11 @@ not be a new one). It returns non-nil if it got any new messages." (rmail-insert-inbox-text files nil) (setq delete-files (rmail-insert-inbox-text files t)))) ;; If there was no new mail, or we aborted before actually - ;; trying to get any, mark buffer unmodified. Otherwise the - ;; buffer is correctly marked modified and the file locked - ;; until we save out the new mail. - (if (= (point-min) (point-max)) + ;; trying to get any, mark buffer unmodified, unless it was + ;; modified originally. Otherwise the buffer is correctly + ;; marked modified and the file locked until we save out the + ;; new mail. + (if (and (null mod-p) (= (point-min) (point-max))) (set-buffer-modified-p nil))) ;; Scan the new text and convert each message to ;; Rmail/mbox format. commit dc4aef3b85f22e5d529c5ceb0686f26781587601 Author: Arash Esbati Date: Thu Nov 10 10:18:43 2022 +0100 Support 'texlab' LSP server in Eglot OOTB * lisp/progmodes/eglot.el (eglot-server-programs): Add support for 'texlab' LSP server for tex-mode and similar languages. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 2eaa396386..f69d392b46 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -217,7 +217,7 @@ language-server/bin/php-language-server.php")) (scala-mode . ("metals-emacs")) (racket-mode . ("racket" "-l" "racket-langserver")) ((tex-mode context-mode texinfo-mode bibtex-mode) - . ("digestif")) + . ,(eglot-alternatives '("digestif" "texlab"))) (erlang-mode . ("erlang_ls" "--transport" "stdio")) (yaml-mode . ("yaml-language-server" "--stdio")) (nix-mode . ,(eglot-alternatives '("nil" "rnix-lsp"))) commit ed067f08fe1b1338271e5c436da4063687eb7a98 Author: Alan Mackenzie Date: Thu Nov 10 11:57:42 2022 +0000 Add to /etc/NEWS a mention of the new C++20 support in CC Mode * etc/NEWS. A new section about C++20 support. * lisp/progmodes/cc-defs.el (c-version): Update to 5.35.2. diff --git a/etc/NEWS b/etc/NEWS index cb5cedd203..2245b41d9e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1482,6 +1482,10 @@ This controls how statements like the following are indented: It is enabled by default, but requires that the external "shellcheck" command is installed. +** CC Mode +--- +*** C++ Mode now supports most of the new features in the C++20 standard. + ** Cperl Mode --- diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 81aac2ec27..b13f6a5914 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -86,7 +86,7 @@ ;;; Variables also used at compile time. -(defconst c-version "5.35.1" +(defconst c-version "5.35.2" "CC Mode version number.") (defconst c-version-sym (intern c-version)) commit 2a7f01aa38bda94f3e68bbcbc4efde841d7b524b Author: Eli Zaretskii Date: Thu Nov 10 12:55:16 2022 +0200 Fix initialization of module functions * src/emacs-module.c (allocate_module_function): Fix initialization of module functions. Suggested by Richard Copley . (Bug#59104) diff --git a/src/emacs-module.c b/src/emacs-module.c index fcdf103c19..35d6e9e0d7 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -561,7 +561,7 @@ static struct Lisp_Module_Function * allocate_module_function (void) { return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function, - interactive_form, PVEC_MODULE_FUNCTION); + command_modes, PVEC_MODULE_FUNCTION); } #define XSET_MODULE_FUNCTION(var, ptr) \ commit f8df45f853752bb842af453dd05ccb64d990b767 Author: kobarity Date: Mon Nov 7 22:24:44 2022 +0900 Fix indentation for multi-line block start in Python mode * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Fix for multi-line block start. * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-6): New test. (Bug#59009) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index cec0d54a44..a734e06149 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5377,6 +5377,7 @@ likely an invalid python file." ;; block and the current line, otherwise it ;; is not an opening block. (save-excursion + (python-nav-end-of-statement) (forward-line) (let ((no-back-indent t)) (save-match-data diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 8330525394..f871b7bc7d 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5592,6 +5592,23 @@ else: (equal (list (python-tests-look-at "else:" -1 t)) (python-info-dedenter-opening-block-positions))))) +(ert-deftest python-info-dedenter-opening-block-positions-6 () + "Test multiline block start." + (python-tests-with-temp-buffer + " +def func(): + if ( + cond1 or + cond2 + ): + something() + else +" + (python-tests-look-at "else\n") + (should + (equal (list (python-tests-look-at "if (" -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 commit f7694c80d3ec67b4e79dd240fa7e5d9f1b0f9256 Author: Eli Zaretskii Date: Thu Nov 10 12:21:10 2022 +0200 ; * etc/NEWS: Mention that order of overlays might change. (Bug#59067) diff --git a/etc/NEWS b/etc/NEWS index ab64eff74e..cb5cedd203 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -112,7 +112,8 @@ efficient than the original one, and should speed up all the operations that involve overlays, especially when there are lots of them in a buffer. However, no changes in behavior of overlays should be visible on the Lisp or user level, with the exception of better -performance. +performance and the order of overlays returned by functions that don't +promise any particular order. --- ** The docstrings of preloaded files are not in "etc/DOC" any more. commit 435861a3baa3dbe9deff7346161887883508dee6 Author: Eli Zaretskii Date: Thu Nov 10 12:18:18 2022 +0200 ; * src/buffer.c (Foverlays_in): Doc fix. (Bug#59067) diff --git a/src/buffer.c b/src/buffer.c index ec2d34daf8..9be2c4a970 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3835,7 +3835,9 @@ and also contained within the specified region. Empty overlays are included in the result if they are located at BEG, between BEG and END, or at END provided END denotes the position at the -end of the accessible part of the buffer. */) +end of the accessible part of the buffer. + +The resulting list of overlays is in an arbitrary unpredictable order. */) (Lisp_Object beg, Lisp_Object end) { ptrdiff_t len, noverlays; commit 25b4cec31d580353995d87fe19ae4dab6e6e37de Author: Eli Zaretskii Date: Thu Nov 10 12:12:56 2022 +0200 Avoid dumping core upon SIGHUP in non-interactive sessions * src/emacs.c (terminate_due_to_signal): Don't special-case SIGINT. Patch by Paul Eggert . (Bug#58956) diff --git a/src/emacs.c b/src/emacs.c index 1b2aa9442b..c4c8bfc82f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -432,9 +432,9 @@ terminate_due_to_signal (int sig, int backtrace_limit) if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT) { /* Avoid abort in shut_down_emacs if we were interrupted - by SIGINT in noninteractive usage, as in that case we - don't care about the message stack. */ - if (sig == SIGINT && noninteractive) + in noninteractive usage, as in that case we don't + care about the message stack. */ + if (noninteractive) clear_message_stack (); Fkill_emacs (make_fixnum (sig), Qnil); } commit 98c273ce1c23ce5ba3fb201daef13ec0da3e5185 Merge: 7e9afea775 af6a93b2b8 Author: Eli Zaretskii Date: Thu Nov 10 12:09:39 2022 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 7e9afea7756cc66732fc9599c2637fe303797d89 Author: Eli Zaretskii Date: Thu Nov 10 12:08:47 2022 +0200 ; * test/lisp/dired-tests.el (dired-test-bug59047): Rename. diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index fd7ff73267..18b0257e01 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -288,16 +288,6 @@ (should (cdr (dired-get-marked-files)))) (when (buffer-live-p buf) (kill-buffer buf)))))) -(ert-deftest dired-test-bugXXXX () - "Test for https://debbugs.gnu.org/XXXX ." - (dired (list (expand-file-name "src" source-directory) - "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) - (dired-hide-all) - (dired-hide-all) - (dired-next-line 1) - (should (equal 'dired-hide-details-detail - (get-text-property (1+ (line-beginning-position)) 'invisible)))) - (ert-deftest dired-test-bug27899 () "Test for https://debbugs.gnu.org/27899 ." :tags '(:unstable) @@ -364,6 +354,17 @@ (should (equal "subdir" (dired-get-filename 'local t))))))) +(ert-deftest dired-test-bug59047 () + "Test for https://debbugs.gnu.org/59047 ." + (dired (list (expand-file-name "src" source-directory) + "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) + (dired-hide-all) + (dired-hide-all) + (dired-next-line 1) + (should (equal 'dired-hide-details-detail + (get-text-property + (1+ (line-beginning-position)) 'invisible)))) + (defmacro dired-test-with-temp-dirs (just-empty-dirs &rest body) "Helper macro for Bug#27940 test." (declare (indent 1) (debug body)) commit af6a93b2b85839f9f5775f6350ddd3036be177f4 Author: Alan Mackenzie Date: Thu Nov 10 10:06:20 2022 +0000 * lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix off-by-one error. This fixes bug #59070. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2aa6b90dea..34ba97bb87 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2390,6 +2390,8 @@ with // and /*, not more generic line and block comments." ;; Go to a less nested declaration each time round this loop. (and (setq old-pos (point)) + ;; The following form tries to move to the end of the previous + ;; declaration without moving outside of an enclosing {. (let (pseudo) (while (and @@ -2404,7 +2406,9 @@ with // and /*, not more generic line and block comments." (setq pseudo (c-cheap-inside-bracelist-p (c-parse-state))))))) (goto-char pseudo)) t) - (>= (point) bod-lim) + (or (> (point) bod-lim) + (eq bod-lim (point-min))) + ;; Move forward to the start of the next declaration. (progn (c-forward-syntactic-ws) ;; Have we got stuck in a comment at EOB? (not (and (eobp) commit 7879eca247116745dc7ceaf45b1b93d618c5a217 Author: Gabriel do Nascimento Ribeiro Date: Sat Nov 5 08:27:50 2022 -0300 Make 'dired-hide-details-mode' work after 'dired-hide-subdir' * lisp/dired.el (dired--unhide): Restore text properties. (Bug#59047) * test/lisp/dired-tests.el (dired-test-bugXXXX): New test. diff --git a/lisp/dired.el b/lisp/dired.el index 209e270942..825d0e4750 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3034,7 +3034,8 @@ See options: `dired-hide-details-hide-symlink-targets' and (remove-list-of-text-properties (progn (goto-char start) (line-end-position)) (progn (goto-char end) (line-end-position)) - '(invisible))))) + '(invisible)) + (dired-insert-set-properties start end)))) ;;; Functions for finding the file name in a dired buffer line diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 09becc7fe7..fd7ff73267 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -288,6 +288,16 @@ (should (cdr (dired-get-marked-files)))) (when (buffer-live-p buf) (kill-buffer buf)))))) +(ert-deftest dired-test-bugXXXX () + "Test for https://debbugs.gnu.org/XXXX ." + (dired (list (expand-file-name "src" source-directory) + "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) + (dired-hide-all) + (dired-hide-all) + (dired-next-line 1) + (should (equal 'dired-hide-details-detail + (get-text-property (1+ (line-beginning-position)) 'invisible)))) + (ert-deftest dired-test-bug27899 () "Test for https://debbugs.gnu.org/27899 ." :tags '(:unstable) commit b4db61f5804b16f66acf1a824944b4ef1e32186d Author: Matt Armstrong Date: Fri Nov 4 12:43:30 2022 -0700 Rewrite the `kill-buffer-delete-auto-save' tests (bug#59028) These tests had been annoying to me when run in interactive mode. They failed to bind `kill-buffer-delete-auto-save' as needed, so they depended on the user's settings, and they failed to mock out the "Buffer modified, save?" prompt. * test/src/buffer-tests.el (test-kill-buffer-auto-save): New helper function that mocks the two different kinds of prompts that occur when killing modified buffers that visit a file. Tests fail if expected prompts are not issued. (test-kill-buffer-auto-save-default): Use it, and explicitly bind `kill-buffer-delete-auto-save' to nil. (test-kill-buffer-auto-save-delete): Delete it. (test-kill-buffer-auto-save-delete-yes): New test for the "yes" half of the old `test-kill-buffer-auto-save-delete'. (test-kill-buffer-auto-save-delete-yes): Ditto for the "no" half. diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 26a649e133..65a9945266 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el @@ -8380,65 +8380,92 @@ dicta sunt, explicabo. ")) (remove-overlays) (should (= (length (overlays-in (point-min) (point-max))) 0)))) -(ert-deftest test-kill-buffer-auto-save-default () - (ert-with-temp-file file - (let (auto-save) - ;; Always answer yes. - (cl-letf (((symbol-function #'yes-or-no-p) (lambda (_) t))) - (unwind-protect - (progn - (find-file file) - (auto-save-mode t) - (insert "foo\n") - (should buffer-auto-save-file-name) - (setq auto-save buffer-auto-save-file-name) - (do-auto-save) - (should (file-exists-p auto-save)) - (kill-buffer (current-buffer)) - (should (file-exists-p auto-save))) - (when auto-save - (ignore-errors (delete-file auto-save)))))))) - -(ert-deftest test-kill-buffer-auto-save-delete () +(defun test-kill-buffer-auto-save (auto-save-answer body-func) + "Test helper for `kill-buffer-delete-auto-save' tests. + +Call BODY-FUNC with the current buffer set to a buffer visiting a +temporary file. Around the call, mock the \"Buffer modified; +kill anyway?\" and \"Delete auto-save file?\" prompts, answering +\"yes\" for the former and AUTO-SAVE-ANSWER for the latter. The +expectation should be the characters `?y' or `?n', or `nil' if no +prompt is expected. The test fails if the \"Delete auto-save +file?\" prompt does not either prompt is not issued as expected. +Finally, kill the buffer and its temporary file." (ert-with-temp-file file - (let (auto-save) - (should (file-exists-p file)) - (setq kill-buffer-delete-auto-save-files t) - ;; Always answer yes. - (cl-letf (((symbol-function #'yes-or-no-p) (lambda (_) t))) - (unwind-protect - (progn - (find-file file) - (auto-save-mode t) - (insert "foo\n") - (should buffer-auto-save-file-name) - (setq auto-save buffer-auto-save-file-name) - (do-auto-save) - (should (file-exists-p auto-save)) - ;; This should delete the auto-save file. - (kill-buffer (current-buffer)) - (should-not (file-exists-p auto-save))) - (ignore-errors (delete-file file)) - (when auto-save - (ignore-errors (delete-file auto-save))))) - ;; Answer no to deletion. - (cl-letf (((symbol-function #'yes-or-no-p) - (lambda (prompt) - (not (string-search "Delete auto-save file" prompt))))) - (unwind-protect - (progn - (find-file file) - (auto-save-mode t) - (insert "foo\n") - (should buffer-auto-save-file-name) - (setq auto-save buffer-auto-save-file-name) - (do-auto-save) - (should (file-exists-p auto-save)) - ;; This should not delete the auto-save file. - (kill-buffer (current-buffer)) - (should (file-exists-p auto-save))) - (when auto-save - (ignore-errors (delete-file auto-save)))))))) + (should (file-exists-p file)) + (save-excursion + (find-file file) + (should (equal file (buffer-file-name))) + (let ((buffer (current-buffer)) + (auto-save-prompt-happened nil)) + (cl-letf (((symbol-function #'read-multiple-choice) + (lambda (prompt choices &rest _) + (should (string-search "modified; kill anyway?" prompt)) + (let ((answer (assq ?y choices))) + (should answer) + answer))) + ((symbol-function #'yes-or-no-p) + (lambda (prompt) + (should (string-search "Delete auto-save file?" prompt)) + (setq auto-save-prompt-happened t) + (pcase-exhaustive auto-save-answer + (?y t) + (?n nil))))) + (funcall body-func) + (should (equal (null auto-save-prompt-happened) + (null auto-save-answer)))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (set-buffer-modified-p nil) + (kill-buffer))))))) + +(ert-deftest test-kill-buffer-auto-save-default () + (let ((kill-buffer-delete-auto-save-files nil)) + (test-kill-buffer-auto-save + nil + (lambda () + (let (auto-save) + (auto-save-mode t) + (insert "foo\n") + (should buffer-auto-save-file-name) + (setq auto-save buffer-auto-save-file-name) + (do-auto-save) + (should (file-exists-p auto-save)) + (kill-buffer (current-buffer)) + (should (file-exists-p auto-save))))))) + +(ert-deftest test-kill-buffer-auto-save-delete-yes () + (let ((kill-buffer-delete-auto-save-files t)) + (test-kill-buffer-auto-save + ?y + (lambda () + (let (auto-save) + (auto-save-mode t) + (insert "foo\n") + (should buffer-auto-save-file-name) + (setq auto-save buffer-auto-save-file-name) + (do-auto-save) + (should (file-exists-p auto-save)) + ;; This should delete the auto-save file. + (kill-buffer (current-buffer)) + (should-not (file-exists-p auto-save))))))) + +(ert-deftest test-kill-buffer-auto-save-delete-no () + (let ((kill-buffer-delete-auto-save-files t)) + (test-kill-buffer-auto-save + ?n + (lambda () + (let (auto-save) + (auto-save-mode t) + (insert "foo\n") + (should buffer-auto-save-file-name) + (setq auto-save buffer-auto-save-file-name) + (do-auto-save) + (should (file-exists-p auto-save)) + ;; This should not delete the auto-save file. + (kill-buffer (current-buffer)) + (should (file-exists-p auto-save)) + (delete-file auto-save)))))) (ert-deftest test-buffer-modifications () (ert-with-temp-file file commit abbb0faceaedea5369eba68c43e0b19dc861810f Author: Nicolas Graner Date: Wed Nov 2 22:28:45 2022 +0100 Better support for 'textarea' and 'select' tags in EWW * lisp/net/eww.el (eww-tag-textarea, eww-tag-select): Don't miss 'textarea' and 'select' tags. (Bug#58973) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 414de931c4..3799ef96e8 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1596,7 +1596,8 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (list :eww-form eww-form :value value :type "textarea" - :name (dom-attr dom 'name))))) + :name (dom-attr dom 'name))) + (put-text-property start (1+ start) 'shr-tab-stop t))) (defun eww-tag-input (dom) (let ((type (downcase (or (dom-attr dom 'type) "text"))) @@ -1660,7 +1661,8 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (add-face-text-property start (point) 'eww-form-select) (put-text-property start (point) 'keymap eww-select-map) (unless (= start (point)) - (put-text-property start (1+ start) 'help-echo "select field")) + (put-text-property start (1+ start) 'help-echo "select field") + (put-text-property start (1+ start) 'shr-tab-stop t)) (shr-ensure-paragraph)))) (defun eww-select-display (select)