commit 7d9513f9c48ba4d197502ad8196d51f18894145e (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat Oct 12 20:55:47 2024 +0300 Improve face font selection on MS-Windows * lisp/net/dictionary.el (dictionary-word-definition-face): Special-case w32. * lisp/faces.el (face-font-family-alternatives): Add a few modern font families. diff --git a/lisp/faces.el b/lisp/faces.el index c3a54a08a3d..21c3e663c6e 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -100,7 +100,7 @@ a font height that isn't optimal." ;; which are generally available. (defcustom face-font-family-alternatives (mapcar (lambda (arg) (mapcar 'purecopy arg)) - '(("Monospace" "courier" "fixed") + '(("Monospace" "Cascadia Code" "Lucida Console" "courier" "fixed") ;; Monospace Serif is an Emacs invention, intended to work around ;; portability problems when using Courier. It should work well @@ -133,7 +133,10 @@ a font height that isn't optimal." ;; This is present for backward compatibility. ("courier" "CMU Typewriter Text" "fixed") - ("Sans Serif" "helv" "helvetica" "arial" "fixed") + ("Sans Serif" + ;; https://en.wikipedia.org/wiki/List_of_typefaces_included_with_Microsoft_Windows + "Calibri" "Tahoma" "Lucida Sans Unicode" + "helv" "helvetica" "arial" "fixed") ("helv" "helvetica" "arial" "fixed"))) "Alist of alternative font family names. Each element has the form (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...). diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 3d3dd6d28fa..50e23727c61 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -320,7 +320,11 @@ Otherwise, `dictionary-search' displays definitions in a *Dictionary* buffer." :version "30.1") (defface dictionary-word-definition-face - '((((supports (:family "DejaVu Serif"))) + ;; w32 first, because 'supports' doesn't really tell whether the font + ;; family exists, and MS-Windows selects an ugly font as result. + '((((type w32)) + (:font "Sans Serif")) + (((supports (:family "DejaVu Serif"))) (:family "DejaVu Serif")) (((type x)) (:font "Sans Serif")) @@ -328,7 +332,7 @@ Otherwise, `dictionary-search' displays definitions in a *Dictionary* buffer." (:font "default"))) "The face that is used for displaying the definition of the word." :group 'dictionary -:version "28.1") +:version "31.1") (defface dictionary-word-entry-face '((((type x)) commit c3600916b6942b2a9797ec2248d29cb337c7c6fa Author: Pengji Zhang Date: Wed Aug 28 19:11:35 2024 +0800 Improve tests for flow-fill * test/lisp/mail/flow-fill-tests.el (fill-flow-tests-fill-flowed-decode): Remove debug message. (fill-flow-tests-fill-flowed-encode): Actually test function `fill-flowed-encode', which requires `use-hard-newline' to be non-nil. Also adjust test input to check behavior of the function under different cases. (Bug#72870) diff --git a/test/lisp/mail/flow-fill-tests.el b/test/lisp/mail/flow-fill-tests.el index 1f698f538f3..50fbb1e7f80 100644 --- a/test/lisp/mail/flow-fill-tests.el +++ b/test/lisp/mail/flow-fill-tests.el @@ -54,37 +54,43 @@ (with-temp-buffer (insert input) (fill-flowed) - (message "foo") (should (equal (buffer-string) output))))) (ert-deftest fill-flow-tests-fill-flowed-encode () (let ((input (concat - "> Thou villainous ill-breeding spongy dizzy-eyed \n" - "> reeky elf-skinned pigeon-egg! \n" - ">> Thou artless swag-bellied milk-livered \n" - ">> dismal-dreaming idle-headed scut!\n" + ;; Hard newline in the middle of a level + "> Thou villainous ill-breeding spongy dizzy-eyed" hard-newline + "> reeky elf-skinned pigeon-egg!\n" + ">> Thou artless swag-bellied milk-livered\n" + ;; Hard new line at the end of a level + ">> dismal-dreaming idle-headed scut!" hard-newline + ;; Trailing space should be preserved after filling ">>> Thou errant folly-fallen spleeny reeling-ripe \n" ">>> unmuzzled ratsbane!\n" - ">>>> Henceforth, the coding style is to be strictly \n" + ">>>> Henceforth, the coding style is to be strictly\n" ">>>> enforced, including the use of only upper case.\n" - ">>>>> I've noticed a lack of adherence to the coding \n" + ;; Consecutive hard newlines within a level + ">>>>> I've noticed a lack of adherence to" hard-newline + ">>>>> the coding" hard-newline ">>>>> styles, of late.\n" ">>>>>> Any complaints?\n")) (output (concat - "> Thou villainous ill-breeding spongy dizzy-eyed \n" + "> Thou villainous ill-breeding spongy dizzy-eyed\n" "> reeky elf-skinned pigeon-egg! \n" - ">> Thou artless swag-bellied milk-livered \n" - ">> dismal-dreaming idle-headed scut!\n" - ">>> Thou errant folly-fallen spleeny reeling-ripe \n" - ">>> unmuzzled ratsbane!\n" - ">>>> Henceforth, the coding style is to be strictly \n" - ">>>> enforced, including the use of only upper case.\n" - ">>>>> I've noticed a lack of adherence to the coding \n" - ">>>>> styles, of late.\n" - ">>>>>> Any complaints?\n")) - (fill-flowed-display-column 69)) + ">> Thou artless swag-bellied milk-livered dismal-dreaming \n" + ">> idle-headed scut!\n" + ">>> Thou errant folly-fallen spleeny reeling-ripe unmuzzled \n" + ">>> ratsbane! \n" + ">>>> Henceforth, the coding style is to be strictly enforced, \n" + ">>>> including the use of only upper case. \n" + ">>>>> I've noticed a lack of adherence to\n" + ">>>>> the coding\n" + ">>>>> styles, of late. \n" + ">>>>>> Any complaints? \n")) + (use-hard-newlines t) + (fill-flowed-encode-column 66)) (with-temp-buffer (insert input) (fill-flowed-encode) commit fc214b668391abed313920cd44f3d913c8207e0e Author: Pengji Zhang Date: Wed Aug 28 18:57:35 2024 +0800 Flow fill texts after the last hard newline * lisp/mail/flow-fill.el (fill-flowed-encode): Use `(point-max)' as `end' if there are no remaining hard newlines in buffer. This ensures that the last paragraph will always be encoded, even without a trailing hard newline. (Bug#72870) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index 919490ec5aa..d4ad7d45982 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -78,7 +78,9 @@ RFC 2646 suggests 66 characters for readability." (let ((start (point-min)) end) ;; Go through each paragraph, filling it and adding SPC ;; as the last character on each line. - (while (setq end (text-property-any start (point-max) 'hard 't)) + (while (and (< start (point-max)) + (setq end (or (text-property-any start (point-max) 'hard 't) + (point-max)))) (save-restriction (narrow-to-region start end) (let ((fill-column (eval fill-flowed-encode-column t))) commit a724a497084dceb895f17eaea5b90bd13c05a769 Author: Eli Zaretskii Date: Sat Oct 12 15:23:25 2024 +0300 * lisp/progmodes/compile.el (recompile): Autoload (bug#73697). diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index a78ac1b6462..03e6ee4021b 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1832,6 +1832,7 @@ to a function that generates a unique name." (compilation-start command comint)) ;; run compile with the default command line +;;;###autoload (defun recompile (&optional edit-command) "Re-compile the program including the current buffer. If this is run in a Compilation mode buffer, reuse the arguments from the commit bd5d84e5d3311e7ab4a7d0091d6c98365927d17a Author: Diancheng Wang Date: Tue Oct 8 11:11:24 2024 +0800 Stop highlighting current line when debuggee is running * lisp/progmodes/gud.el (gud-hide-current-line-indicator): New function. (gud-sentinel): * lisp/progmodes/gdb-mi.el (gdb-starting): Use it. (Bug#73687) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 2981965ee0c..6a9735fbc25 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2699,7 +2699,8 @@ Sets `gdb-thread-number' to new id." (gdb-force-mode-line-update (propertize gdb-inferior-status 'face font-lock-type-face)) (setq gdb-active-process t) - (setq gud-running t)) + (setq gud-running t) + (gud-hide-current-line-indicator nil)) ;; -break-insert -t didn't give a reason before gdb 6.9 diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 53a7d78328c..a4e611277e4 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -2949,11 +2949,19 @@ It is saved for when this flag is not set.") "Overlay created for `gud-highlight-current-line'. It is nil if not yet present.") +(defun gud-hide-current-line-indicator(destroy-overlay) + "Stop displaying arrow and highlighting current line in a source file." + ;; Stop displaying an arrow in a source file. + (setq gud-overlay-arrow-position nil) + ;; And any highlight overlays. + (when gud-highlight-current-line-overlay + (delete-overlay gud-highlight-current-line-overlay) + (if destroy-overlay + (setq gud-highlight-current-line-overlay nil)))) + (defun gud-sentinel (proc msg) (cond ((null (buffer-name (process-buffer proc))) ;; buffer killed - ;; Stop displaying an arrow in a source file. - (setq gud-overlay-arrow-position nil) (set-process-buffer proc nil) (if (and (boundp 'speedbar-initial-expansion-list-name) (string-equal speedbar-initial-expansion-list-name "GUD")) @@ -2963,12 +2971,9 @@ It is nil if not yet present.") (gdb-reset) (gud-reset))) ((memq (process-status proc) '(signal exit)) - ;; Stop displaying an arrow in a source file. - (setq gud-overlay-arrow-position nil) - ;; And any highlight overlays. - (when gud-highlight-current-line-overlay - (delete-overlay gud-highlight-current-line-overlay) - (setq gud-highlight-current-line-overlay nil)) + + (gud-hide-current-line-indicator t) + (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdbmi) (gdb-reset) commit ebfd5874f0b74cec06572ffc3e9bf7288bd5e77b Author: Paul Nelson Date: Mon Sep 16 01:33:53 2024 +0200 Add foldout command for widening to current fold * lisp/foldout.el (foldout-widen-to-current-fold): New command. * doc/emacs/text.texi (Foldout): Document it. * etc/NEWS: Announce it. (Bug#73286) diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 9bc2a6407d5..a6d19a32bc5 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -1396,6 +1396,14 @@ exits all folds. subheadings, specify a negative argument. For example, @w{@kbd{M--2 C-c C-x}} exits two folds and leaves the text and subheadings exposed. +@findex foldout-widen-to-current-fold + While working within a fold, you may wish to use Emacs's standard +narrowing commands such as @kbd{C-x n n} (@code{narrow-to-region}) or +@kbd{C-x n d} (@code{narrow-to-defun}). After using these commands, +@code{foldout-widen-to-current-fold}) allows you to widen back to the +current fold level, rather than the entire buffer. If you're not +currently in a fold, it behaves like @code{widen}. + Foldout mode also provides mouse commands for entering and exiting folds, and for showing and hiding text: diff --git a/etc/NEWS b/etc/NEWS index c2919169bbf..daaae54d7d3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -535,6 +535,13 @@ instead. *** A new shortcut to navigate to previous menu. The hardcoded "^" shortcut gets you back to the previous menu. +** Foldout + +--- +*** New command 'foldout-widen-to-current-fold'. +This command widens the view to the current fold level when in a fold, +or behaves like 'widen' if not in a fold. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/foldout.el b/lisp/foldout.el index 5799318fc6f..a4b6a402c5c 100644 --- a/lisp/foldout.el +++ b/lisp/foldout.el @@ -490,6 +490,21 @@ Signal an error if the event didn't occur on a heading." (error "Not a heading line"))) +(defun foldout-widen-to-current-fold () + "Widen to the current fold level. +If in a fold, widen to that fold's boundaries. +If not in a fold, acts like `widen'." + (interactive) + (if foldout-fold-list + (let* ((last-fold (car foldout-fold-list)) + (start (car last-fold)) + (end (cdr last-fold))) + (widen) + (narrow-to-region start + (if end (1- (marker-position end)) (point-max)))) + (widen))) + + ;;; Keymaps: (defvar foldout-inhibit-key-bindings nil commit 0e9502b10e08d1c93fe9b134b8cf74eae42c1eae Author: Manuel Giraud Date: Thu Oct 3 16:20:19 2024 +0200 Correctly update image properties * lisp/image-mode.el (image--update-properties): New function to update image properties. (image-toggle-display-image): Use it. (Bug#73617) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 7cf7845e935..e75f6ea918f 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -867,6 +867,13 @@ The limits are given by the user option (or (<= mw (* (car size) scale)) (<= mh (* (cdr size) scale)))))) +(defun image--update-properties (image properties) + "Update IMAGE with the new PROPERTIES set." + (let (prop) + (while (setq prop (pop properties)) + (plist-put (cdr image) prop (pop properties))) + image)) + (defun image-toggle-display-image () "Show the image of the image file. Turn the image data into a real image, but only if the whole file @@ -959,7 +966,7 @@ was inserted." ;; Discard any stale image data before looking it up again. (image-flush image) - (setq image (append image (image-transform-properties image))) + (setq image (image--update-properties image (image-transform-properties image))) (setq props `(display ,image ;; intangible ,image commit bb5b25181ea7a4393f019dc641a981bdb6687c62 Merge: 16e835171a8 0f8f0773183 Author: Eli Zaretskii Date: Sat Oct 12 05:53:27 2024 -0400 Merge from origin/emacs-30 0f8f0773183 ; * doc/emacs/search.texi (Word Search): Document 'dictio... fb155bcfb6f ; * lisp/emacs-lisp/chart.el (chart-bar-quickie): Doc fix. 6dbe4e99ac4 ; * lisp/emacs-lisp/chart.el (chart-bar-quickie): Improve... d664227f81a ; More accurate documentation of 'file-newer-than-file-p' e49b479f869 Fix c-ts-mode indentation for initializer lists (bug#73661) f520008744b Avoid segfaults in Rmail-MIME 6a5c2edd84f Eglot: use :immediate t when resolving completions (bug#7... cd36e070c24 Eglot: minor changes to doc and docstrings 1ea0d9b891b Revert "Set treesit-primary-parser for tree-sitter modes" 52746ceb625 Remove duplicate indent rules in elixir-ts-mode ed57faafc74 Set treesit-primary-parser for tree-sitter modes 37a6c859b04 ; * lisp/emacs-lisp/cl-macs.el (cl-once-only): Fix capita... 2d4d6dc43a4 Delete XIE X extension from TODO commit 16e835171a8ce388e581174925e47263e864727d Author: Sean Whitton Date: Sat Oct 12 16:58:25 2024 +0800 ; Revise docstring from last change diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 4cdcfe5cb96..856bea66a6f 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -397,11 +397,11 @@ specific file to query." (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit) "Print commit log associated with FILES into specified BUFFER. If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'. -If LIMIT is non-nil, show no more than this many entries. +If LIMIT is a positive integer, show no more than that many entries. -If START-REVISION is nil, the commit log is printed starting from the -working directory parent (revset \".\"). If START-REVISION is non-nil, -the log is printed starting from that revision." +If START-REVISION is nil, print the commit log starting from the working +directory parent (revset \".\"). If START-REVISION is a string, print +the log starting from that revision." ;; `vc-do-command' creates the buffer, but we need it before running ;; the command. (vc-setup-buffer buffer) commit fbeb3d22b7fabf13cd788772ade2ed594ee60872 Author: Spencer Baugh Date: Wed Oct 2 15:20:31 2024 -0400 Properly operate on current fileset revision in vc-hg-print-log * lisp/vc/vc-hg.el (vc-hg-print-log): If start-revision is nil, reliably log the working revision. (bug#73604) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 876d86dc24f..4cdcfe5cb96 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -397,8 +397,11 @@ specific file to query." (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit) "Print commit log associated with FILES into specified BUFFER. If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'. -If START-REVISION is non-nil, it is the newest revision to show. -If LIMIT is non-nil, show no more than this many entries." +If LIMIT is non-nil, show no more than this many entries. + +If START-REVISION is nil, the commit log is printed starting from the +working directory parent (revset \".\"). If START-REVISION is non-nil, +the log is printed starting from that revision." ;; `vc-do-command' creates the buffer, but we need it before running ;; the command. (vc-setup-buffer buffer) @@ -408,8 +411,8 @@ If LIMIT is non-nil, show no more than this many entries." (with-current-buffer buffer (apply #'vc-hg-command buffer 'async files "log" + (format "-r%s:0" (or start-revision ".")) (nconc - (when start-revision (list (format "-r%s:0" start-revision))) (when limit (list "-l" (format "%s" limit))) (when (eq vc-log-view-type 'with-diff) (list "-p")) commit 0f8f0773183a07a229b23d3f970723ceb9585aef (refs/remotes/origin/emacs-30) Author: Eli Zaretskii Date: Sat Oct 12 10:17:10 2024 +0300 ; * doc/emacs/search.texi (Word Search): Document 'dictionary-search'. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 3b52385347b..f23dc1fdb51 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -792,6 +792,46 @@ search engine whose @acronym{URL} is specified by the variable Wowser Manual}). If the region is not active, or doesn't contain any words, this command prompts the user for a URL or keywords to search. +@findex dictionary-search +@findex dictionary +@findex dictionary-tooltip-mode +@cindex dictionary server protocol (DICT) +@cindex word definition search +@vindex dictionary-server + You can also search for definitions of a word by querying dictionary +servers via the @sc{dict} protocol defined by @acronym{RFC} 2229. Emacs +includes a client for this protocol. Type @w{@kbd{M-x dictionary-search +@key{RET}}} to connect to a @sc{dict} server and ask it to provide the +available definitions of a word. This command prompts for the word to +look up, using the word at point as the default, then asks the @sc{dict} +server to provide the definitions of that word in one or more +dictionaries. By default, the command first tries to connect to the +@sc{dict} server installed on the local host, and if that fails, it +tries @file{dict.org} after your confirmation; customize the variable +@code{dictionary-server} to specify, as a string, the URL of a single +server to use (use @samp{localhost} if you want to query only the local +server). Normally, @code{dictionary-search} tells the server to look up +the word in all the dictionaries available to the server, but if you +invoke the command with a prefix argument, it will prompt for a single +dictionary to look. The list of dictionaries available to a server can +be displayed by pressing the @samp{Select dictionary} button shown in +the @file{*Dictionary*} buffer, described below. + + First time you use @code{dictionary-search}, it creates a new +@file{*Dictionary*} buffer and turns on a special mode in it. The +buffer shows buttons for selecting a dictionary, searching a definition +of another word, etc. Subsequent @code{dictionary-search} commands +reuse this buffer. To create another such buffer (e.g., too look up +other words, perhaps in another dictionary), type @w{@kbd{M-x dictionary +@key{RET}}}. + + If you turn on @code{dictionary-tooltip-mode} in a buffer, Emacs will +look up the definitions of the word at mouse pointer and show those +definitions in a tool tip. This is handy when you are reading text with +many words about whose meaning you are unsure. + + For other options of dictionary-search, see the @code{dictionary} +customization group (@pxref{Specific Customization}). @node Symbol Search @section Symbol Search commit fb155bcfb6f7dfdec3aaf9f535428d46419a6b4e Author: Eli Zaretskii Date: Sat Oct 12 08:44:28 2024 +0300 ; * lisp/emacs-lisp/chart.el (chart-bar-quickie): Doc fix. diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index b9646e93253..c472d421eb0 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -574,11 +574,16 @@ R1 and R2 are dotted pairs. Colorize it with FACE." (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle &optional max sort-pred) - "Create a bar chart in direction DIR [`horizontal' `vertical'] named TITLE. -NAMELST is the list of bar names and NAMETITLE is the name the of axis containing -them. NUMLST is the list of values and NUMTITLE is the name of the value -axis. Optional arguments: Set the chart's max element display to MAX, and sort -lists with SORT-PRED if desired." + "Create a bar chart named TITLE in direction DIR [`horizontal' `vertical']. +NAMELST is the list of bar names and NAMETITLE is the name the of axis +containing them. +NUMLST is the list of values and NUMTITLE is the name of the value +axis. +Optional argument MAX limits the chart's max element display to MAX by +passing it as second argument to `chart-trim', otherwise the chart's +display is unlimited. +Optional argument SORT-PRED is a predicate function passed as second +argument to `chart-sort' to sort the lists if desired." (let ((nc (make-instance 'chart-bar :title title :key-label "8-m" ; This is a text key pic commit 6dbe4e99ac41bc1f5bcbdbda3c215941170bc9c5 Author: Andrea Corallo Date: Fri Oct 11 15:26:28 2024 +0200 ; * lisp/emacs-lisp/chart.el (chart-bar-quickie): Improve documentation. diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 2ca9b64be33..b9646e93253 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -574,13 +574,11 @@ R1 and R2 are dotted pairs. Colorize it with FACE." (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle &optional max sort-pred) - "Wash over the complex EIEIO stuff and create a nice bar chart. -Create it going in direction DIR [`horizontal' `vertical'] with TITLE -using a name sequence NAMELST labeled NAMETITLE with values NUMLST -labeled NUMTITLE. -Optional arguments: -Set the chart's max element display to MAX, and sort lists with -SORT-PRED if desired." + "Create a bar chart in direction DIR [`horizontal' `vertical'] named TITLE. +NAMELST is the list of bar names and NAMETITLE is the name the of axis containing +them. NUMLST is the list of values and NUMTITLE is the name of the value +axis. Optional arguments: Set the chart's max element display to MAX, and sort +lists with SORT-PRED if desired." (let ((nc (make-instance 'chart-bar :title title :key-label "8-m" ; This is a text key pic commit d664227f81aed98097520877a16c5369403a6a2d Author: Eli Zaretskii Date: Thu Oct 10 11:03:48 2024 +0300 ; More accurate documentation of 'file-newer-than-file-p' * doc/lispref/files.texi (File Attributes): * src/fileio.c (Ffile_newer_than_file_p): Say the comparison uses the last-modification times. (Bug#73709) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 70db8521481..5c63f192447 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1299,7 +1299,8 @@ and modification. This function returns @code{t} if the file @var{filename1} is newer than file @var{filename2}. If @var{filename1} does not exist, it returns @code{nil}. If @var{filename1} does exist, but -@var{filename2} does not, it returns @code{t}. +@var{filename2} does not, it returns @code{t}. Otherwise, it compares +the times of last modification of the files. In the following example, assume that the file @file{aug-19} was written on the 19th, @file{aug-20} was written on the 20th, and the file diff --git a/src/fileio.c b/src/fileio.c index 7afe3e75737..2db2760916b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3788,7 +3788,8 @@ DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "", DEFUN ("file-newer-than-file-p", Ffile_newer_than_file_p, Sfile_newer_than_file_p, 2, 2, 0, doc: /* Return t if file FILE1 is newer than file FILE2. If FILE1 does not exist, the answer is nil; -otherwise, if FILE2 does not exist, the answer is t. */) +otherwise, if FILE2 does not exist, the answer is t. +For existing files, this compares their last-modified times. */) (Lisp_Object file1, Lisp_Object file2) { struct stat st1, st2; commit e49b479f8692573379a1ee3417bdda9e1f777888 Author: Jørgen Kvalsvik Date: Fri Oct 4 21:38:33 2024 +0200 Fix c-ts-mode indentation for initializer lists (bug#73661) The intentation behavior differed between c-mode/c++-mode and *-ts-mode for initializer lists where the first element was not at beginning-of-line. The anchor-prev-sibling function gave up and returned nil, but it should (probably) anchor on the first element in the initializer list, such as this: return { v1, v2, ..., y1, y2, ... }; c-ts-mode behaved better and figured out how to align, but I added a test for a similar compound literal to prevent regressions. * lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Anchor at first sibling unless bol is found. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New initializer list and compound literal test. Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index a3379ad7aab..576d715510d 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -324,10 +324,13 @@ characters of the current line." ;; If the start of the previous sibling isn't at the ;; beginning of a line, something's probably not quite ;; right, go a step further. (E.g., comment after a - ;; statement.) + ;; statement.) If the previous sibling is the first named + ;; node then anchor to that, e.g. when returning an aggregate + ;; and starting the items on the same line as {. (_ (goto-char (treesit-node-start prev-sibling)) - (if (looking-back (rx bol (* whitespace)) - (line-beginning-position)) + (if (or (looking-back (rx bol (* whitespace)) + (line-beginning-position))) + (null (treesit-node-prev-sibling prev-sibling t)) (setq continue nil) (setq prev-sibling (treesit-node-prev-sibling prev-sibling))))))) diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 599173832b5..a13a74cf8b3 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -208,6 +208,21 @@ int main() } =-=-= +Name: Return Compund Literal + +=-= +struct pair { int fst, snd; }; +struct pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return (struct pair) { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} + +=-=-= + Name: Switch-Case statement =-= @@ -486,6 +501,30 @@ namespace A { } =-=-= +Name: Return Aggregate Initialized Struct + +=-= +struct pair { int x, y; } +pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} +=-= +struct pair { int x, y; } +pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} +=-=-= + Code: (lambda () (c-ts-mode) commit f520008744b1eb71accded4108888d1f2055402e Author: Eli Zaretskii Date: Wed Oct 9 16:21:08 2024 +0300 Avoid segfaults in Rmail-MIME Rmail-MIME decodes text of email, including removal of CR characters, but that can segfault if the text of some MIME part is empty. * src/coding.c (decode_coding_raw_text): * lisp/mail/rmailmm.el (rmail-mime-insert-decoded-text): Don't attempt to decode empty text region. diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index a5ce5b65cd7..d86e48e6281 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -579,11 +579,13 @@ HEADER is a header component of a MIME-entity object (see (ignore-errors (base64-decode-region pos (point)))) ((string= transfer-encoding "quoted-printable") (quoted-printable-decode-region pos (point)))))) - (decode-coding-region - pos (point) - ;; Use -dos decoding, to remove ^M characters left from base64 or - ;; rogue qp-encoded text. - (coding-system-change-eol-conversion coding-system 1)) + ;; If the text is empty, we don't have anything to decode. + (and (/= pos (point)) + (decode-coding-region + pos (point) + ;; Use -dos decoding, to remove ^M characters left from base64 + ;; or rogue qp-encoded text. + (coding-system-change-eol-conversion coding-system 1))) (if (and (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system)) (not (eq (coding-system-base coding-system) 'us-ascii))) diff --git a/src/coding.c b/src/coding.c index b21ed360578..5591b7fed45 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5270,7 +5270,9 @@ decode_coding_raw_text (struct coding_system *coding) coding->chars_at_source = 1; coding->consumed_char = coding->src_chars; coding->consumed = coding->src_bytes; - if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') + if (eol_dos + && coding->src_bytes > 0 /* empty source text? */ + && coding->source[coding->src_bytes - 1] == '\r') { coding->consumed_char--; coding->consumed--; commit 6a5c2edd84fc3fdb879e4a19ea182c2a4d385833 Author: Brennan Vincent Date: Wed Oct 9 06:30:30 2024 -0500 Eglot: use :immediate t when resolving completions (bug#73279) Copyright-paperwork-exempt: Yes * lisp/progmodes/eglot.el (eglot-completion-at-point): Tweak eglot--request call. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index e7a0a3ce135..0a14146a245 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3242,7 +3242,8 @@ for which LSP on-type-formatting should be requested." :resolveProvider) (plist-get lsp-comp :data)) (eglot--request server :completionItem/resolve - lsp-comp :cancel-on-input t) + lsp-comp :cancel-on-input t + :immediate t) lsp-comp)))))) (when (and (consp eglot--capf-session) (= (car bounds) (car (nth 0 eglot--capf-session))) commit cd36e070c24d7828ea1b9bf62ffa920068ac4d41 Author: João Távora Date: Wed Oct 9 06:26:27 2024 -0500 Eglot: minor changes to doc and docstrings * doc/misc/eglot.texi (Quick Start): Tweak. (Setting Up LSP Servers): Tweak. (Customizing Eglot): Clarify eglot-connect-hook and eglot-initialized-hook. * lisp/progmodes/eglot.el (eglot-connect-hook) (eglot-server-initialized-hook): Rework docstring. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index fb5b618bd84..959bbfa6857 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -123,14 +123,16 @@ Here's how to start using Eglot with your programming project: @item Select and install a language server. -Eglot comes pre-configured with many popular language servers, see the -value of @code{eglot-server-programs}. If the server(s) mentioned -there satisfy your needs for the programming language(s) with which -you want to use Eglot, you just need to make sure those servers are -installed on your system. Alternatively, install one or more servers -of your choice and add them to the value of +Eglot comes pre-configured for many popular language servers, see the +value of @code{eglot-server-programs}. If the server(s) mentioned there +satisfy your needs for the programming language(s) with which you want +to use Eglot, you just need to make sure those servers are installed on +your system and Eglot can find them. + +Alternatively, install one or more servers of your choice and tell Eglot +where to find them. To do that, you may add to the value of @code{eglot-server-programs}, as described in @ref{Setting Up LSP -Servers}. +Servers} or have Eglot prompt you about it (@pxref{Eglot Commands}). @item Turn on Eglot for your project. @@ -197,7 +199,7 @@ particular server(s) you want to install. To use a language server, Eglot must know how to start it and which programming languages each server supports. This information is -provided by the variable @code{eglot-server-programs}. +commonly provided by the variable @code{eglot-server-programs}. @defvar eglot-server-programs This variable associates major modes with names and command-line @@ -939,12 +941,16 @@ to @w{@code{(disallow-non-standard-keys enforce-required-keys)}}. @vindex eglot-server-initialized-hook @item eglot-server-initialized-hook -A hook run after the server object is successfully initialized. +A hook run after the server object is successfully initialized (which +includes launching the process) but before any LSP communication is +attempted. Each function receives a @code{eglot-lsp-server} instance as +argument. @vindex eglot-connect-hook @item eglot-connect-hook -A hook run after connection to the server is successfully -established. @xref{Starting Eglot}. +A hook run after the LSP connection to the server is successfully +established. Each function receives a @code{eglot-lsp-server} instance +as argument. @xref{Starting Eglot}. @item eglot-managed-mode-hook A hook run after Eglot started or stopped managing a buffer. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 58487924883..e7a0a3ce135 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1487,18 +1487,21 @@ Use current server's or first available Eglot events buffer." (defvar eglot-connect-hook '(eglot-signal-didChangeConfiguration) - "Hook run after connecting in `eglot--connect'.") + "Hook run after connecting to a server. +Each function is passed an `eglot-lsp-server' instance +as argument.") (defvar eglot-server-initialized-hook '() "Hook run after a `eglot-lsp-server' instance is created. -That is before a connection was established. Use +That is before a connection is established. Use `eglot-connect-hook' to hook into when a connection was successfully established and the server on the other side has received the initializing configuration. -Each function is passed the server as an argument") +Each function is passed an `eglot-lsp-server' instance +as argument.") (defun eglot--cmd (contact) "Helper for `eglot--connect'." commit 1ea0d9b891bf7abadd291aeb715c51c4cc496dba Author: Yuan Fu Date: Tue Oct 8 17:33:11 2024 -0700 Revert "Set treesit-primary-parser for tree-sitter modes" This reverts commit ed57faafc74e0810b492841deccb3cdc77a258ff. diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 597ef69d9b8..854adf4ade7 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -208,7 +208,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table cmake-ts-mode--syntax-table (when (treesit-ready-p 'cmake) - (setq treesit-primary-parser (treesit-parser-create 'cmake)) + (treesit-parser-create 'cmake) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index b86555b1d87..1f86527191a 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -1049,7 +1049,7 @@ Key bindings: (error "Tree-sitter for C# isn't available")) ;; Tree-sitter. - (setq treesit-primary-parser (treesit-parser-create 'c-sharp)) + (treesit-parser-create 'c-sharp) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index 42fa7482a87..e31fd86bbdf 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -133,7 +133,7 @@ Return nil if there is no name or if NODE is not a stage node." :syntax-table dockerfile-ts-mode--syntax-table (when (treesit-ready-p 'dockerfile) - (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) + (treesit-parser-create 'dockerfile) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 899f7852c2b..2d3e6aac090 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -253,7 +253,7 @@ :syntax-table go-ts-mode--syntax-table (when (treesit-ready-p 'go) - (setq treesit-primary-parser (treesit-parser-create 'go)) + (treesit-parser-create 'go) ;; Comments. (setq-local comment-start "// ") @@ -453,7 +453,7 @@ what the parent of the node would be if it were a node." :syntax-table go-mod-ts-mode--syntax-table (when (treesit-ready-p 'gomod) - (setq treesit-primary-parser (treesit-parser-create 'gomod)) + (treesit-parser-create 'gomod) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index 84fd513525c..b527d96b579 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -148,7 +148,7 @@ With ARG, do it many times. Negative ARG means move backward." :group 'heex-ts (when (treesit-ready-p 'heex) - (setq treesit-primary-parser (treesit-parser-create 'heex)) + (treesit-parser-create 'heex) ;; Comments (setq-local treesit-thing-settings diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 6c7c5a30ab8..4ceb211ade1 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -326,7 +326,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'java) (error "Tree-sitter for Java isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'java)) + (treesit-parser-create 'java) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 7409c6be833..1fb96555010 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -128,7 +128,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'json) (error "Tree-sitter for JSON isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'json)) + (treesit-parser-create 'json) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index aea5e1e6116..4ea453c9b65 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -752,7 +752,7 @@ Calls REPORT-FN directly." (use-local-map lua-ts-mode-map) (when (treesit-ready-p 'lua) - (setq treesit-primary-parser (treesit-parser-create 'lua)) + (treesit-parser-create 'lua) ;; Comments. (setq-local comment-start "--") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e4b9fe2367d..0001bdd21a9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7147,7 +7147,7 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table (when (treesit-ready-p 'python) - (setq treesit-primary-parser (treesit-parser-create 'python)) + (treesit-parser-create 'python) (setq-local treesit-font-lock-feature-list '(( comment definition) ( keyword string type) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index aff0b8911b9..adcdf15c7ad 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1127,7 +1127,7 @@ leading double colon is not added." (unless (treesit-ready-p 'ruby) (error "Tree-sitter for Ruby isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'ruby)) + (treesit-parser-create 'ruby) (setq-local add-log-current-defun-function #'ruby-ts-add-log-current-function) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 038955d1ae0..571ffa9b220 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -507,7 +507,7 @@ See `prettify-symbols-compose-predicate'." :syntax-table rust-ts-mode--syntax-table (when (treesit-ready-p 'rust) - (setq treesit-primary-parser (treesit-parser-create 'rust)) + (treesit-parser-create 'rust) ;; Syntax. (setq-local syntax-propertize-function diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8ba64100203..a348e9ba6fd 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1623,7 +1623,7 @@ not written in Bash or sh." (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook #'sh-after-hack-local-variables nil t) - (setq treesit-primary-parser (treesit-parser-create 'bash)) + (treesit-parser-create 'bash) (setq-local treesit-font-lock-feature-list '(( comment function) ( command declaration-command keyword string) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 4860eaf3a34..3606a139d50 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -502,7 +502,7 @@ This mode is intended to be inherited by concrete major modes." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'typescript) - (setq treesit-primary-parser (treesit-parser-create 'typescript)) + (treesit-parser-create 'typescript) ;; Indent. (setq-local treesit-simple-indent-rules @@ -540,7 +540,7 @@ at least 3 (which is the default value)." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'tsx) - (setq treesit-primary-parser (treesit-parser-create 'tsx)) + (treesit-parser-create 'tsx) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index c8da28187ee..f5a20e0ca0e 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1814,7 +1814,7 @@ can also be used to fill comments. (setq-local font-lock-fontify-region-function #'css--fontify-region) ;; Tree-sitter specific setup. - (setq treesit-primary-parser (treesit-parser-create 'css)) + (treesit-parser-create 'css) (setq-local treesit-simple-indent-rules css--treesit-indent-rules) (setq-local treesit-defun-type-regexp "rule_set") (setq-local treesit-defun-name-function #'css--treesit-defun-name) diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el index f78fbdde1da..235e1055fa9 100644 --- a/lisp/textmodes/html-ts-mode.el +++ b/lisp/textmodes/html-ts-mode.el @@ -92,7 +92,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'html) (error "Tree-sitter for HTML isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'html)) + (treesit-parser-create 'html) ;; Indent. (setq-local treesit-simple-indent-rules html-ts-mode--indent-rules) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index 806f045c23b..3c4533a7fea 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -124,7 +124,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table toml-ts-mode--syntax-table (when (treesit-ready-p 'toml) - (setq treesit-primary-parser (treesit-parser-create 'toml)) + (treesit-parser-create 'toml) ;; Comments (setq-local comment-start "# ") diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index 42d7c2e1798..210835585fe 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -148,7 +148,7 @@ boundaries. JUSTIFY is passed to `fill-paragraph'." :syntax-table yaml-ts-mode--syntax-table (when (treesit-ready-p 'yaml) - (setq treesit-primary-parser (treesit-parser-create 'yaml)) + (treesit-parser-create 'yaml) ;; Comments. (setq-local comment-start "# ") commit 52746ceb62592fba6d58595b7bc3199058f30185 Author: Yuan Fu Date: Mon Oct 7 17:27:13 2024 -0700 Remove duplicate indent rules in elixir-ts-mode * lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): There are two forms adding heex-ts--indent-rules, remove one of them. diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index a3e11658468..cacdb266298 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -734,9 +734,6 @@ Return nil if NODE is not a defun node or doesn't have a name." (when (treesit-ready-p 'heex) (setq-local treesit-range-settings elixir-ts--treesit-range-rules) - (setq-local treesit-simple-indent-rules - (append treesit-simple-indent-rules heex-ts--indent-rules)) - (setq-local treesit-font-lock-settings (append treesit-font-lock-settings heex-ts--font-lock-settings)) commit ed57faafc74e0810b492841deccb3cdc77a258ff Author: Yuan Fu Date: Mon Oct 7 17:24:32 2024 -0700 Set treesit-primary-parser for tree-sitter modes I debated whether to do this, since technically speaking it's not needed for single-language modes. But ultimately it's better to be explicit and set a good example with builtin modes. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): * lisp/progmodes/csharp-mode.el (csharp-ts-mode): * lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode): * lisp/progmodes/go-ts-mode.el (go-ts-mode): (go-mod-ts-mode): * lisp/progmodes/heex-ts-mode.el (heex-ts-mode): * lisp/progmodes/java-ts-mode.el (java-ts-mode): * lisp/progmodes/json-ts-mode.el (json-ts-mode): * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): * lisp/progmodes/python.el (python-ts-mode): * lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode): * lisp/progmodes/rust-ts-mode.el (rust-ts-mode): * lisp/progmodes/sh-script.el: * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): (tsx-ts-mode): * lisp/textmodes/css-mode.el (css-ts-mode): * lisp/textmodes/html-ts-mode.el (html-ts-mode): * lisp/textmodes/toml-ts-mode.el (toml-ts-mode): * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): Set treesit-primary-parser. diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 854adf4ade7..597ef69d9b8 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -208,7 +208,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table cmake-ts-mode--syntax-table (when (treesit-ready-p 'cmake) - (treesit-parser-create 'cmake) + (setq treesit-primary-parser (treesit-parser-create 'cmake)) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 1f86527191a..b86555b1d87 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -1049,7 +1049,7 @@ Key bindings: (error "Tree-sitter for C# isn't available")) ;; Tree-sitter. - (treesit-parser-create 'c-sharp) + (setq treesit-primary-parser (treesit-parser-create 'c-sharp)) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index e31fd86bbdf..42fa7482a87 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -133,7 +133,7 @@ Return nil if there is no name or if NODE is not a stage node." :syntax-table dockerfile-ts-mode--syntax-table (when (treesit-ready-p 'dockerfile) - (treesit-parser-create 'dockerfile) + (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 2d3e6aac090..899f7852c2b 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -253,7 +253,7 @@ :syntax-table go-ts-mode--syntax-table (when (treesit-ready-p 'go) - (treesit-parser-create 'go) + (setq treesit-primary-parser (treesit-parser-create 'go)) ;; Comments. (setq-local comment-start "// ") @@ -453,7 +453,7 @@ what the parent of the node would be if it were a node." :syntax-table go-mod-ts-mode--syntax-table (when (treesit-ready-p 'gomod) - (treesit-parser-create 'gomod) + (setq treesit-primary-parser (treesit-parser-create 'gomod)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index b527d96b579..84fd513525c 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -148,7 +148,7 @@ With ARG, do it many times. Negative ARG means move backward." :group 'heex-ts (when (treesit-ready-p 'heex) - (treesit-parser-create 'heex) + (setq treesit-primary-parser (treesit-parser-create 'heex)) ;; Comments (setq-local treesit-thing-settings diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 4ceb211ade1..6c7c5a30ab8 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -326,7 +326,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'java) (error "Tree-sitter for Java isn't available")) - (treesit-parser-create 'java) + (setq treesit-primary-parser (treesit-parser-create 'java)) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 1fb96555010..7409c6be833 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -128,7 +128,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'json) (error "Tree-sitter for JSON isn't available")) - (treesit-parser-create 'json) + (setq treesit-primary-parser (treesit-parser-create 'json)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 4ea453c9b65..aea5e1e6116 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -752,7 +752,7 @@ Calls REPORT-FN directly." (use-local-map lua-ts-mode-map) (when (treesit-ready-p 'lua) - (treesit-parser-create 'lua) + (setq treesit-primary-parser (treesit-parser-create 'lua)) ;; Comments. (setq-local comment-start "--") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0001bdd21a9..e4b9fe2367d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7147,7 +7147,7 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table (when (treesit-ready-p 'python) - (treesit-parser-create 'python) + (setq treesit-primary-parser (treesit-parser-create 'python)) (setq-local treesit-font-lock-feature-list '(( comment definition) ( keyword string type) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index adcdf15c7ad..aff0b8911b9 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1127,7 +1127,7 @@ leading double colon is not added." (unless (treesit-ready-p 'ruby) (error "Tree-sitter for Ruby isn't available")) - (treesit-parser-create 'ruby) + (setq treesit-primary-parser (treesit-parser-create 'ruby)) (setq-local add-log-current-defun-function #'ruby-ts-add-log-current-function) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 571ffa9b220..038955d1ae0 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -507,7 +507,7 @@ See `prettify-symbols-compose-predicate'." :syntax-table rust-ts-mode--syntax-table (when (treesit-ready-p 'rust) - (treesit-parser-create 'rust) + (setq treesit-primary-parser (treesit-parser-create 'rust)) ;; Syntax. (setq-local syntax-propertize-function diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a348e9ba6fd..8ba64100203 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1623,7 +1623,7 @@ not written in Bash or sh." (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook #'sh-after-hack-local-variables nil t) - (treesit-parser-create 'bash) + (setq treesit-primary-parser (treesit-parser-create 'bash)) (setq-local treesit-font-lock-feature-list '(( comment function) ( command declaration-command keyword string) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 3606a139d50..4860eaf3a34 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -502,7 +502,7 @@ This mode is intended to be inherited by concrete major modes." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'typescript) - (treesit-parser-create 'typescript) + (setq treesit-primary-parser (treesit-parser-create 'typescript)) ;; Indent. (setq-local treesit-simple-indent-rules @@ -540,7 +540,7 @@ at least 3 (which is the default value)." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'tsx) - (treesit-parser-create 'tsx) + (setq treesit-primary-parser (treesit-parser-create 'tsx)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index f5a20e0ca0e..c8da28187ee 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1814,7 +1814,7 @@ can also be used to fill comments. (setq-local font-lock-fontify-region-function #'css--fontify-region) ;; Tree-sitter specific setup. - (treesit-parser-create 'css) + (setq treesit-primary-parser (treesit-parser-create 'css)) (setq-local treesit-simple-indent-rules css--treesit-indent-rules) (setq-local treesit-defun-type-regexp "rule_set") (setq-local treesit-defun-name-function #'css--treesit-defun-name) diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el index 235e1055fa9..f78fbdde1da 100644 --- a/lisp/textmodes/html-ts-mode.el +++ b/lisp/textmodes/html-ts-mode.el @@ -92,7 +92,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'html) (error "Tree-sitter for HTML isn't available")) - (treesit-parser-create 'html) + (setq treesit-primary-parser (treesit-parser-create 'html)) ;; Indent. (setq-local treesit-simple-indent-rules html-ts-mode--indent-rules) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index 3c4533a7fea..806f045c23b 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -124,7 +124,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table toml-ts-mode--syntax-table (when (treesit-ready-p 'toml) - (treesit-parser-create 'toml) + (setq treesit-primary-parser (treesit-parser-create 'toml)) ;; Comments (setq-local comment-start "# ") diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index 210835585fe..42d7c2e1798 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -148,7 +148,7 @@ boundaries. JUSTIFY is passed to `fill-paragraph'." :syntax-table yaml-ts-mode--syntax-table (when (treesit-ready-p 'yaml) - (treesit-parser-create 'yaml) + (setq treesit-primary-parser (treesit-parser-create 'yaml)) ;; Comments. (setq-local comment-start "# ") commit 37a6c859b04ef9f88c3f9751027d544100cf1d2c Author: Sean Whitton Date: Sun Oct 6 13:38:57 2024 +0800 ; * lisp/emacs-lisp/cl-macs.el (cl-once-only): Fix capitalisation. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2e501005bf7..b37f744b175 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2505,7 +2505,7 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...). (defmacro cl-once-only (names &rest body) "Generate code to evaluate each of NAMES just once in BODY. -This macro helps with writing other macros. Each of names is +This macro helps with writing other macros. Each of NAMES is either (NAME FORM) or NAME, which latter means (NAME NAME). During macroexpansion, each NAME is bound to an uninterned symbol. The expansion evaluates each FORM and binds it to the commit 2d4d6dc43a417b873024d1bee93036d3749f59af Author: Stefan Kangas Date: Sun Oct 6 01:47:50 2024 +0200 Delete XIE X extension from TODO According to Wikipedia, XIE "is no longer included in the X11 reference distribution, having been removed with X11R6.7 in 2004." Ref: https://en.wikipedia.org/wiki/X_Image_Extension * etc/TODO: Delete item to use XIE X extension. diff --git a/etc/TODO b/etc/TODO index 87ca19f37f2..21c85216964 100644 --- a/etc/TODO +++ b/etc/TODO @@ -788,9 +788,6 @@ to ASCII. *** Provide a user friendly interface to specify fonts -** Use the XIE X extension, if available, for image display -This is obsolete, as XIE itself is now considered obsolete. - ** Make monochrome images honor the face Display those images using the foreground and background colors of the applicable faces.