commit 49d8302b40b90c629f7c808f3de949be742074fb (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Sat Sep 20 21:20:04 2025 +0300 * lisp/progmodes/js.el: Obsolete 'js--treesit-sexp-nodes'. (js--treesit-sexp-nodes): Set the default value to nil and make obsolete. (js--treesit-thing-settings): Instead of using 'js--treesit-sexp-nodes', define a list of named and anonymous nodes that don't match the 'sexp' thing (bug#79465). diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 00c57b72e18..0fda7d62145 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3949,38 +3949,11 @@ Currently there are `js-mode' and `js-ts-mode'." "Nodes that designate sentences in JavaScript. See `treesit-thing-settings' for more information.") -(defvar js--treesit-sexp-nodes - '("expression" - "parenthesized_expression" - "formal_parameters" - "pattern" - "array" - "function" - "string" - "template_string" - "template_substitution" - "escape" - "template" - "regex" - "number" - "identifier" - "property_identifier" - "this" - "super" - "true" - "false" - "null" - "undefined" - "arguments" - "pair" - "jsx" - "statement_block" - "object" - "object_pattern" - "named_imports" - "class_body") +(defvar js--treesit-sexp-nodes nil "Nodes that designate sexps in JavaScript. See `treesit-thing-settings' for more information.") +(make-obsolete 'js--treesit-sexp-nodes + "`js--treesit-sexp-nodes' will be removed soon, use `js--treesit-thing-settings' instead." "31.1") (defvar js--treesit-list-nodes '("export_clause" @@ -4011,7 +3984,13 @@ See `treesit-thing-settings' for more information.") (defvar js--treesit-thing-settings `((javascript - (sexp ,(js--regexp-opt-symbol js--treesit-sexp-nodes)) + (sexp ,(if js--treesit-sexp-nodes + (js--regexp-opt-symbol js--treesit-sexp-nodes) + `(not (or (and named + ,(rx bos (or "program" "comment") eos)) + (and anonymous + ,(rx (or "{" "}" "[" "]" + "(" ")" ","))))))) (list ,(js--regexp-opt-symbol js--treesit-list-nodes)) (sentence ,(js--regexp-opt-symbol js--treesit-sentence-nodes)) (text ,(js--regexp-opt-symbol '("comment" commit 2ba301b30ee944c571f60eb90ee2473a59333011 Author: Eli Zaretskii Date: Sat Sep 20 19:37:48 2025 +0300 ; * etc/NEWS: Merge two "Register" sections. Fix wording. diff --git a/etc/NEWS b/etc/NEWS index e2df182a9ee..059270bff46 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -565,14 +565,6 @@ project, during completion. That makes some items shorter. The category defaults are the same as for 'buffer' but any user customizations would need to be re-added. -** Registers - -*** New functions 'buffer-to-register' and 'file-to-register'. -These allow users to interactively store file and buffers in registers. -Killed buffers stored in a register using 'buffer-to-register' are -automatically converted to a file-query value if the buffer was visiting -a file. - ** IDLWAVE has been moved to GNU ELPA. The version bundled with Emacs is out-of-date, and is now marked as obsolete. Use 'M-x list-packages' to install the 'idlwave' package from @@ -795,13 +787,20 @@ with finer grained control. ** Register ++++ +*** New functions 'buffer-to-register' and 'file-to-register'. +These allow users to interactively store file and buffers in registers. +Killed buffers stored in a register using 'buffer-to-register' are +automatically converted to a file-query value if the buffer was visiting +a file. + +--- *** The "*Register Preview*" buffer shows only suitable registers. That was already the case for the "fancy" UI but is now also true in the default UI you get, i.e., when 'register-use-preview' is 'traditional'. --- *** The "*Register Preview*" buffer shows sorted items. -This is helpful a user find a non-occupied register. ** Tree-sitter commit a760f1fe6e10f91c9600595ac57a1ff53b006343 Author: Masatake YAMATO Date: Thu Sep 18 03:21:22 2025 +0900 (register-preview-info): sort registers in preview buffer * lisp/register.el (register-preview): Sort alist returned from `register-of-type-alist'. (Bug#79474) diff --git a/etc/NEWS b/etc/NEWS index 76a12a32507..e2df182a9ee 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -799,6 +799,10 @@ with finer grained control. That was already the case for the "fancy" UI but is now also true in the default UI you get, i.e., when 'register-use-preview' is 'traditional'. +--- +*** The "*Register Preview*" buffer shows sorted items. +This is helpful a user find a non-occupied register. + ** Tree-sitter +++ diff --git a/lisp/register.el b/lisp/register.el index 9b2a10f02d7..7dbda04d176 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -246,7 +246,7 @@ Format of each entry is controlled by the variable `register-preview-function'." nil (with-current-buffer standard-output (setq cursor-in-non-selected-windows nil) - (dolist (elem registers) + (dolist (elem (sort registers :key #'car)) (when (cdr elem) (let ((beg (point))) (insert (funcall register-preview-function elem)) commit 7f6b68cd7cbe7a7e0ce5a5034ca29b77c3a70bb2 Author: Eli Zaretskii Date: Sat Sep 20 13:38:00 2025 +0300 ; * doc/emacs/programs.texi (Hideshow): Fix last change. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index e2249ffa283..22968ea878b 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1755,7 +1755,7 @@ the indicators. @item hs-indicator-type This variable controls where to show the indicators, if they are -enabled. You can show them on the fringe (@pxref{Windows Fringes}) or +enabled. You can show them on the fringe (@pxref{Fringes}) or in the window's margin. The default is to use the fringe if it's available, otherwise to use the margin. commit 5a56c0fb43bf556da981c4dfe1d7be4c256b24fe Author: Eli Zaretskii Date: Sat Sep 20 06:35:11 2025 -0400 ; * lisp/ldefs-boot.el: Update. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index e1f62222e9a..7d2c66b1e9f 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -9720,7 +9720,8 @@ BUFFER is put back into its original major mode. (fn FUN &optional NAME)") -(register-definition-prefixes "ehelp" '("ehelp-" "electric-")) + (autoload 'ehelp-command "ehelp" "Prefix command for ehelp." t 'keymap) +(register-definition-prefixes "ehelp" '("ehelp-map" "electric-")) ;;; Generated autoloads from emacs-lisp/eieio.el @@ -20140,6 +20141,29 @@ Otherwise they are treated as Emacs regexps (for backward compatibility).") (custom-autoload 'ls-lisp-support-shell-wildcards "ls-lisp" t) (register-definition-prefixes "ls-lisp" '("ls-lisp-")) + +;;; Generated autoloads from progmodes/lua-mode.el + +(autoload 'lua-mode "lua-mode" "\ +Major mode for editing Lua code. + +(fn)" t) +(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode)) +(add-to-list 'interpreter-mode-alist '("lua" . lua-mode)) +(defalias 'run-lua #'lua-start-process) +(autoload 'lua-start-process "lua-mode" "\ +Start a Lua process named NAME, running PROGRAM. +PROGRAM defaults to NAME, which defaults to `lua-default-application'. +When called interactively, switch to the process buffer. + +STARTFILE is the name of a file, whose contents are sent to the process +as its initial input. + +SWITCHES is a list of strings passed as arguments to PROGRAM. + +(fn &optional NAME PROGRAM STARTFILE &rest SWITCHES)" t) +(register-definition-prefixes "lua-mode" '("lua-")) + ;;; Generated autoloads from progmodes/lua-ts-mode.el @@ -20151,11 +20175,7 @@ Major mode for editing Lua files, powered by tree-sitter. \\{lua-ts-mode-map} (fn)" t) -(autoload 'lua-ts-mode-maybe "lua-ts-mode" "\ -Enable `lua-ts-mode' when its grammar is available. -Also propose to install the grammar when `treesit-enabled-modes' -is t or contains the mode name.") -(when (treesit-available-p) (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode-maybe)) (add-to-list 'interpreter-mode-alist '("\\ Date: Sat Sep 20 06:33:22 2025 -0400 Merge from origin/emacs-30 159ad91d0df ; Add Richard Stallman to admin/MAINTAINERS. commit 6570c746fe969eba75dd1b979371b63ed5c389ba Author: Eli Zaretskii Date: Sat Sep 20 13:15:59 2025 +0300 Avoid signaling errors in 'dabbrev-capf' * lisp/dabbrev.el (dabbrev-capf): Call 'dabbrev--reset-global-variables' if necessary. (Bug#61274) diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index 82ce1cbc673..00a73572fb1 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -400,6 +400,8 @@ then it searches *all* buffers." (defun dabbrev-capf () "Dabbrev completion function for `completion-at-point-functions'." + (or (stringp dabbrev--abbrev-char-regexp) + (dabbrev--reset-global-variables)) (let* ((abbrev (dabbrev--abbrev-at-point)) (beg (progn (search-backward abbrev) (point))) (end (progn (search-forward abbrev) (point))) commit 66308637d714e9494adc8fdd0d1e560a34f0250a Author: Eli Zaretskii Date: Sat Sep 20 13:06:17 2025 +0300 ; Fix last change. * etc/NEWS: * doc/emacs/programs.texi (Hideshow): Fix wording and punctuation. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 2000bc2b785..e2249ffa283 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1749,11 +1749,11 @@ ellipsis. @item hs-show-indicators This variable controls whether Hideshow mode should display indicators of hidden and shown blocks. The indicators also allow toggling the -hide/show state of each block. If the value is non-@code{nil}, enables -the indicators in all blocks. The default is @code{nil}, which disables +hide/show state of each block. If the value is non-@code{nil}, it enables +the indicators. The default is @code{nil}, which disables the indicators. -@item hs-indicactor-type +@item hs-indicator-type This variable controls where to show the indicators, if they are enabled. You can show them on the fringe (@pxref{Windows Fringes}) or in the window's margin. The default is to use the fringe if it's diff --git a/etc/NEWS b/etc/NEWS index e9b2dac43b1..76a12a32507 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -974,8 +974,7 @@ next to the ellipsis. By default this is disabled. +++ *** New user option 'hs-show-indicators'. This user option determines if hideshow should display indicators to -toggle the block hiding. If non-nil, the indicators are enabled in all -blocks. +show and toggle the block hiding. If non-nil, the indicators are enabled. By default this is disabled. commit 071cdb66fd2c82e821a43db64f8f77da8e34d270 Author: Elías Gabriel Pérez Date: Sun Aug 17 20:02:59 2025 -0600 Add hideable indicators for hideshow. (Bug#79294) * doc/emacs/programs.texi (Hideshow): Update documentation. * etc/NEWS: Announce changes. * lisp/progmodes/hideshow.el (hs-show-indicators) (hs-indicator-type, hs-indicator-maximum-buffer-size): New user options. (hs-indicator-hide, hs-indicator-show): New icons. (hs-block-positions, hs--make-indicators-overlays) (hs-indicator-mouse-toggle-hidding, hs--add-indicators) (hs--refresh-indicators): New functions. (hs-hide-block-at-point): Use hs-block-positions. (hs-inside-comment-p): Use 'get-char-property' instead of 'hs-overlay-at'. (hs-minor-mode): Rework. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index f00d79f499a..2000bc2b785 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1730,6 +1730,9 @@ Hide all blocks @var{n} levels below this block @vindex hs-hide-comments-when-hiding-all @vindex hs-display-lines-hidden +@vindex hs-show-indicators +@vindex hs-indicator-type +@vindex hs-indicator-maximum-buffer-size @vindex hs-isearch-open @vindex hs-special-modes-alist These variables can be used to customize Hideshow mode: @@ -1743,6 +1746,26 @@ comments too. If non-@code{nil}, display the number of hidden lines next to the ellipsis. +@item hs-show-indicators +This variable controls whether Hideshow mode should display indicators +of hidden and shown blocks. The indicators also allow toggling the +hide/show state of each block. If the value is non-@code{nil}, enables +the indicators in all blocks. The default is @code{nil}, which disables +the indicators. + +@item hs-indicactor-type +This variable controls where to show the indicators, if they are +enabled. You can show them on the fringe (@pxref{Windows Fringes}) or +in the window's margin. The default is to use the fringe if it's +available, otherwise to use the margin. + +@item hs-indicator-maximum-buffer-size +This variable limits the display of hideshow indicators to buffers that +are not too large. (Larger buffers might adversely affect redisplay +performance.) By default, buffers larger than 2MB have the indicators +disabled; the value of @code{nil} will activate the indicators +regardless of the buffer size. + @item hs-isearch-open This variable specifies the conditions under which incremental search should unhide a hidden block when matching text occurs within the diff --git a/etc/NEWS b/etc/NEWS index bd928345283..e9b2dac43b1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -966,9 +966,37 @@ at point to explore. ** Hideshow ++++ *** New user option 'hs-display-lines-hidden'. -If this option is non-nil, Hideshow displays the number of hidden -lines next to the ellipsis. +If this option is non-nil, Hideshow displays the number of hidden lines +next to the ellipsis. By default this is disabled. + ++++ +*** New user option 'hs-show-indicators'. +This user option determines if hideshow should display indicators to +toggle the block hiding. If non-nil, the indicators are enabled in all +blocks. + +By default this is disabled. + +*** New user option 'hs-indicator-maximum-buffer-size'. +This user option limits the display of hideshow indicators to buffers +that are not too large. By default, buffers larger than 2MB have the +indicators disabled; the value of nil will activate the indicators +regardless of the buffer size. + ++++ +*** New user option 'hs-indicator-type'. +This user option determine which indicator type should be used for the +block indicators. + +The possible values can be: 'fringe', display the indicators in the +fringe (the default); 'margin', display the indicators in the margin; +nil, display the indicators at end-of-line. + +The new icons 'hs-indicator-show' and 'hs-indicator-hide', can be used +for customize the indicators appearance, only if 'hs-indicator-type' is +set to 'margin' or nil. ** C-ts mode diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 445bdeeb7a7..d270b5677e3 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -220,6 +220,9 @@ ;;; Code: (require 'mule-util) ; For `truncate-string-ellipsis' +;; For indicators +(require 'icons) +(require 'fringe) ;;--------------------------------------------------------------------------- ;; user-configurable variables @@ -236,6 +239,16 @@ Note: If `selective-display' ellipsis already has a face, hideshow will use that face for the ellipsis instead." :version "31.1") +(defface hs-indicator-hide + '((t :inherit (shadow default))) + "Face used in hideshow indicator to indicate a hidden block." + :version "31.1") + +(defface hs-indicator-show + '((t :inherit hs-indicator-hide :weight bold)) + "Face used in hideshow indicator to indicate a shown block." + :version "31.1") + (defcustom hs-hide-comments-when-hiding-all t "Hide the comments too when you do an `hs-hide-all'." :type 'boolean) @@ -265,6 +278,83 @@ This has effect only if `search-invisible' is set to `open'." (const :tag "open both code and comment blocks" t) (const :tag "don't open any of them" nil))) +(defcustom hs-show-indicators nil + "Whether hideshow should display block hide/show indicators. +If non-nil, hideshow will display indicators for toggling the visibility +of code blocks. + +The indicators appearance are specified in `hs-indicator-type' (which see)." + :type 'boolean + :version "31.1") + +(defcustom hs-indicator-type 'fringe + "Indicate which indicator type to use for the block indicators. + +The possible values can be: + + - `fringe', display the indicators in the fringe. + - `margin', display the indicators in the margin. + - nil, display the indicators at end-of-line. + +This only have effect if `hs-show-indicators' is non-nil." + :type '(choice + (const :tag "Fringes" fringe) + (const :tag "Margins" margin) + (const :tag "Indicator at end-of-line" nil)) + :version "31.1") + +(defcustom hs-indicator-maximum-buffer-size 2000000 ;2mb + "Max buffer size in bytes where the indicators should be enabled. +If current buffer is larger than this variable value, the indicators +will be disabled. + +If set to nil, the indicators will be activated regardless of the buffer +size." + :type '(choice natnum (const :tag "No limit" nil)) + :version "31.1") + +(define-fringe-bitmap + 'hs-hide + [#b0000000 + #b1000001 + #b1100011 + #b0110110 + #b0011100 + #b0001000 + #b0000000]) + +(define-fringe-bitmap + 'hs-show + [#b0110000 + #b0011000 + #b0001100 + #b0000110 + #b0001100 + #b0011000 + #b0110000]) + +(define-icon hs-indicator-hide nil + `((image "outline-open.svg" "outline-open.pbm" + :face hs-indicator-hide + :height (0.6 . em) + :ascent center) + (symbol "🞃" "▼" :face hs-indicator-hide) + (text "-" :face hs-indicator-hide)) + "Icon used for hide block at point. +This is only used if `hs-indicator-type' is set to `margin' or nil." + :version "31.1") + +(define-icon hs-indicator-show nil + `((image "outline-close.svg" "outline-close.pbm" + :face hs-indicator-show + :height (0.6 . em) + :ascent center) + (symbol "▸" "▶" :face hs-indicator-show) + (text "+" :face hs-indicator-show)) + "Icon used for show block at point. +This is only used if `hs-indicator-type' is set to `margin' or nil." + :version "31.1") + ;;;###autoload (defvar hs-special-modes-alist ;; FIXME: Currently the check is made via @@ -378,7 +468,13 @@ Use the command `hs-minor-mode' to toggle or set this variable.") "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) + "S-" #'hs-toggle-hiding + " " #'hs-indicator-mouse-toggle-hidding) + +(defvar-keymap hs-indicators-map + :doc "Keymap for hideshow indicators." + " " #'hs-indicator-mouse-toggle-hidding + "" #'hs-toggle-hiding) (easy-menu-define hs-minor-mode-menu hs-minor-mode-map "Menu used when hideshow minor mode is active." @@ -562,6 +658,116 @@ to call with the newly initialized overlay." (when hs-set-up-overlay (funcall hs-set-up-overlay ov)) ov)) +(defun hs-block-positions () + "Return the current code block positions. +This return a cons-cell with the current code block beginning and end +positions. This does nothing if there is not a code block at current +point." + (save-match-data + (save-excursion + (when (funcall hs-looking-at-block-start-p-func) + (let ((mdata (match-data t)) + (header-end (match-end 0)) + block-beg block-end) + ;; `block-start' is the point at the end of the block + ;; beginning, which may need to be adjusted + (save-excursion + (goto-char (funcall (or hs-adjust-block-beginning #'identity) + header-end)) + (setq block-beg (line-end-position))) + ;; `block-end' is the point at the end of the block + (hs-forward-sexp mdata 1) + (setq block-end + (cond ((and (stringp hs-block-end-regexp) + (looking-back hs-block-end-regexp nil)) + (match-beginning 0)) + ((functionp hs-block-end-regexp) + (funcall hs-block-end-regexp) + (match-beginning 0)) + (t (point)))) + (cons block-beg block-end)))))) + +(defun hs--make-indicators-overlays (beg) + "Helper function to make the indicators overlays." + (let ((hiddenp (eq 'hs (get-char-property (pos-eol) 'invisible)))) + (when-let* ((o (make-overlay + (if hs-indicator-type beg (pos-eol)) + (1+ (if hs-indicator-type beg (pos-eol))))) + (fringe-type (if hiddenp 'hs-show 'hs-hide)) + (face-or-icon (if hiddenp 'hs-indicator-show 'hs-indicator-hide))) + + (overlay-put o 'hs-indicator t) + (overlay-put o 'hs-indicator-block-start beg) + (overlay-put o 'evaporate t) + (overlay-put o 'priority -50) + + (overlay-put + o 'before-string + (pcase hs-indicator-type + ;; Fringes + ('fringe + (propertize + "+" 'display + `(left-fringe ,fringe-type ,face-or-icon))) + ;; Margins + ('margin + (propertize + "+" 'display + `((margin left-margin) + ,(or (plist-get (icon-elements face-or-icon) 'image) + (icon-string face-or-icon))) + 'face face-or-icon + 'keymap hs-indicators-map)) + ;; EOL string + ('nil + (propertize + (icon-string face-or-icon) + 'mouse-face 'highlight + 'keymap hs-indicators-map))))))) + +(defun hs--add-indicators (&optional beg end) + "Add hideable indicators from BEG to END." + (save-excursion + (setq beg (if (null beg) (window-start) (goto-char beg) (pos-bol)) + end (if (null end) (window-end) (goto-char end) (pos-bol)))) + (goto-char beg) + (remove-overlays beg end 'hs-indicator t) + + (while (funcall hs-find-next-block-func hs-block-start-regexp end nil) + (when-let* ((b-beg (match-beginning 0)) + (_ (save-excursion + (goto-char b-beg) + (funcall hs-looking-at-block-start-p-func))) + ;; `catch' is used here if the search fail due + ;; unbalanced parenthesis or any other unknown error + ;; caused in `hs-forward-sexp'. + (b-end (catch 'hs-indicator-error + (save-excursion + (goto-char b-beg) + (condition-case _ + (funcall hs-forward-sexp-func 1) + (scan-error (throw 'hs-indicator-error nil))) + (point)))) + ;; Check if block is longer than 1 line. + (_ (< b-beg b-end)) + ;; If we are going to use the EOL indicators, then + ;; ignore the invisible lines which mostly are already + ;; hidden blocks. + (_ (> (count-lines b-beg b-end (not hs-indicator-type)) 1))) + (hs--make-indicators-overlays b-beg)) + ;; Only 1 indicator per line + (forward-line 1)) + `(jit-lock-bounds ,beg . ,end)) + +(defun hs--refresh-indicators () + "Update indicators appearance at current block." + (when hs-show-indicators + (save-match-data + (save-excursion + ;; Using window-start and window-end is more faster + ;; than computing again the block positions + (hs--add-indicators (window-start) (window-end)))))) + (defun hs--get-ellipsis (b e) "Helper function for `hs-make-overlay'. This returns the ellipsis string to use and its face." @@ -669,32 +875,19 @@ The block beginning is adjusted by `hs-adjust-block-beginning' and then further adjusted to be at the end of the line." (if comment-reg (hs-hide-comment-region (car comment-reg) (cadr comment-reg) end) - (when (funcall hs-looking-at-block-start-p-func) - (let ((mdata (match-data t)) - (header-end (match-end 0)) - p q ov) - ;; `p' is the point at the end of the block beginning, which - ;; may need to be adjusted - (save-excursion - (goto-char (funcall (or hs-adjust-block-beginning #'identity) - header-end)) - (setq p (line-end-position))) - ;; `q' is the point at the end of the block - (hs-forward-sexp mdata 1) - (setq q (cond ((and (stringp hs-block-end-regexp) - (looking-back hs-block-end-regexp nil)) - (match-beginning 0)) - ((functionp hs-block-end-regexp) - (funcall hs-block-end-regexp) - (match-beginning 0)) - (t (point)))) - (when (and (< p q) (> (count-lines p q) 1)) - (cond ((and hs-allow-nesting (setq ov (hs-overlay-at p))) - (delete-overlay ov)) - ((not hs-allow-nesting) - (hs-discard-overlays p q))) - (hs-make-overlay p q 'code (- header-end p))) - (goto-char (if end q (min p header-end))))))) + (let* ((block (hs-block-positions)) + (p (car-safe block)) + (q (cdr-safe block)) + ov) + (if (and block (< p q) (> (count-lines p q) 1)) + (progn + (cond ((and hs-allow-nesting (setq ov (hs-overlay-at p))) + (delete-overlay ov)) + ((not hs-allow-nesting) + (hs-discard-overlays p q))) + (goto-char q) + (hs-make-overlay p q 'code (- (match-end 0) p))) + (goto-char (if end q (min p (match-end 0)))))))) (defun hs-inside-comment-p () "Return non-nil if point is inside a comment, otherwise nil. @@ -885,7 +1078,7 @@ Return point, or nil if original point was not in a block." (beginning-of-line) (hs-find-block-beginning-match))))) (end-of-line) - (hs-overlay-at (point)))) + (eq 'hs (get-char-property (point) 'invisible)))) ;; This function is not used anymore (Bug#700). (defun hs-c-like-adjust-block-beginning (initial) @@ -976,6 +1169,7 @@ Upon completion, point is repositioned and the normal hook (funcall hs-looking-at-block-start-p-func) (funcall hs-find-block-beginning-func)) (hs-hide-block-at-point end c-reg) + (hs--refresh-indicators) (run-hooks 'hs-hide-hook)))))) (defun hs-show-block (&optional end) @@ -1011,6 +1205,7 @@ See documentation for functions `hs-hide-block' and `run-hooks'." (when (and p q) (hs-discard-overlays p q) (goto-char (if end q (1+ p)))))) + (hs--refresh-indicators) (run-hooks 'hs-show-hook))) (defun hs-hide-level (arg) @@ -1037,6 +1232,21 @@ Argument E should be the event that triggered this action." (define-obsolete-function-alias 'hs-mouse-toggle-hiding #'hs-toggle-hiding "27.1") +(defun hs-indicator-mouse-toggle-hidding (event) + "Toggle block hidding with indicators." + (interactive "e") + (when hs-show-indicators + (let* ((overlays (save-excursion + (goto-char (posn-point (event-end event))) + (overlays-in (pos-bol) (pos-eol)))) + (pos (catch 'hs--indicator-ov + (dolist (ov overlays) + (when-let* ((ov (overlay-get ov 'hs-indicator-block-start))) + (throw 'hs--indicator-ov ov)))))) + (when pos + (goto-char pos) + (hs-toggle-hiding))))) + (defun hs-hide-initial-comment-block () "Hide the first block of comments in a file. This can be useful if you have huge RCS logs in those comments." @@ -1086,8 +1296,21 @@ Key bindings: #'turn-off-hideshow nil t) (setq-local line-move-ignore-invisible t) - (add-to-invisibility-spec '(hs . t))) + (add-to-invisibility-spec '(hs . t)) + ;; Add block indicators + (when (and hs-show-indicators + (or (and (integerp hs-indicator-maximum-buffer-size) + (< (buffer-size) hs-indicator-maximum-buffer-size)) + (not hs-indicator-maximum-buffer-size))) + (when (and (not (display-graphic-p)) + (eq hs-indicator-type 'fringe)) + (setq-local hs-indicator-type 'margin)) + (jit-lock-register #'hs--add-indicators))) + (remove-from-invisibility-spec '(hs . t)) + (when hs-show-indicators + (jit-lock-unregister #'hs--add-indicators) + (remove-overlays nil nil 'hs-indicator t)) ;; hs-show-all does nothing unless h-m-m is non-nil. (let ((hs-minor-mode t)) (hs-show-all)))) commit 32ccb2347f67479010096afc1cb3676dc96b5c64 Author: Janneke Nieuwenhuizen Date: Sat Sep 13 16:30:42 2025 +0200 Fix 'shell-resync-dirs' for multi-line prompt. * lisp/shell.el (shell-eval-command): Instead of always taking the last element from the shell-dirtrack-query command, first try selecting the last directory. (Bug#79441) diff --git a/lisp/shell.el b/lisp/shell.el index 09d4161ba7a..a9c71488f2d 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1236,11 +1236,12 @@ This command queries the shell with the command bound to `shell-dirstack-query' (default \"dirs\"), reads the next line output and parses it to form the new directory stack." (interactive) - (let* ((dls (car - (last - (string-lines - (string-chop-newline - (shell-eval-command (concat shell-dirstack-query "\n"))))))) + (let* ((lines (nreverse + (string-lines + (string-chop-newline + (shell-eval-command (concat shell-dirstack-query "\n")))))) + (dls (or (seq-find #'file-directory-p lines) + (car lines))) (dlsl nil) (pos 0) (ds nil)) commit 40adabe2ef8787daa375eaddfb1e265ef5fb18a3 Author: Eli Zaretskii Date: Sat Sep 20 12:32:21 2025 +0300 Improve documentation of 'accept-process-output' * doc/lispref/processes.texi (Accepting Output): * src/process.c (Faccept_process_output): Document better the meaning of the timeout of 'accept-process-output' a,d the fact that it doesn't always return as soon as some output is available. See https://lists.gnu.org/archive/html/emacs-devel/2025-08/msg00750.html for more details. diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 3d3ec7a5a3c..59f6ddeb63b 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -1989,7 +1989,8 @@ until output arrives from a process. @defun accept-process-output &optional process seconds millisec just-this-one This function allows Emacs to read pending output from processes. The -output is given to their filter functions. If @var{process} is +output is given to the filter functions set up by the processes +(@pxref{Filter Functions}). If @var{process} is non-@code{nil} then this function does not return until some output has been received from @var{process} or @var{process} has closed the connection. @@ -2020,6 +2021,15 @@ got output from @var{process}, or from any process if @var{process} is corresponding connection contains buffered data. The function returns @code{nil} if the timeout expired or the connection was closed before output arrived. + +Note that this function is not guaranteed to return as soon as some +output is available from a subprocess, because the main purpose of the +function is to let Emacs read output from subprocesses, not to wait as +little as possible. In particular, if @var{process} is @code{nil}, the +function should not be expected to return before the specified timeout +expires. Thus, if a Lisp program needs to minimize the wait for the +subprocess output, it should call this function with a non-@code{nil} +value of a specific @var{process}. @end defun If a connection from a process contains buffered data, diff --git a/src/process.c b/src/process.c index 75416b8e52a..2804409f51e 100644 --- a/src/process.c +++ b/src/process.c @@ -4865,7 +4865,7 @@ deactivate_process (Lisp_Object proc) DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, 0, 4, 0, doc: /* Allow any pending output from subprocesses to be read by Emacs. -It is given to their filter functions. +The subprocess output is given to the respective process filter functions. Optional argument PROCESS means to return only after output is received from PROCESS or PROCESS closes the connection. @@ -4880,7 +4880,13 @@ from PROCESS only, suspending reading output from other processes. If JUST-THIS-ONE is an integer, don't run any timers either. Return non-nil if we received any output from PROCESS (or, if PROCESS is nil, from any process) before the timeout expired or the -corresponding connection was closed. */) +corresponding connection was closed. + +Note that it is not guaranteed that this function will return as +soon as some output is received. In particular, if PROCESS is nil, +the function should not be expected to return before the timeout +expires. The main purpose of this function is to allow process output +to be read by Emacs, not to return as soon as any output is read. */) (Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one) { commit 65fb5798960201d247063f38c460a69253a00264 Author: Stephen Berman Date: Sat Sep 20 10:18:40 2025 +0200 Prevent displaying an ungrammatical string in *Help* * lisp/help-fns.el (help-fns-function-description-header): If a function type symbol begins with a vowel, precede it with the article "an" instead of "a". To date this only prevents displaying "a interpreted-function", and it's susceptible to future false positives (bug#79469). diff --git a/lisp/help-fns.el b/lisp/help-fns.el index e9601d52e33..a4a3bb07bde 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1161,15 +1161,22 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." (setq elts (cdr-safe elts))) (concat beg (if is-full "keymap" "sparse keymap")))) (t - (concat beg (format "%s" - (if (and (consp def) (symbolp (car def))) - (car def) - (let ((type (or (oclosure-type def) - (cl-type-of def)))) - (make-text-button - (symbol-name type) nil - 'type 'help-type - 'help-args (list type)))))))))) + (let* ((type (or (oclosure-type def) (cl-type-of def))) + (typ-str + (format "%s" + (if (and (consp def) (symbolp (car def))) + (car def) + (make-text-button + (symbol-name type) nil + 'type 'help-type + 'help-args (list type)))))) + ;; FIXME: If someday Emacs has a function type symbol + ;; like `unicode-function' or `hour-function', this + ;; will produce an ungrammatical string (bug#79469). + (concat (if (string-match-p "\\`[aeiou]" (symbol-name type)) + "an " + beg) + typ-str)))))) (with-current-buffer standard-output (insert description)) commit 159ad91d0df4c73b2827a2d04d69ae08698d6e55 Author: Eli Zaretskii Date: Thu Sep 18 08:52:46 2025 +0300 ; Add Richard Stallman to admin/MAINTAINERS. diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index c505c4d4cd2..d6d30732a1e 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS @@ -10,6 +10,11 @@ The (co-)maintainers of Emacs are: Eli Zaretskii Stefan Kangas Andrea Corallo + Richard Stallman + +(Richard Stallman is one of the Emacs maintainers, +as well as being the Chief GNUisance to whom +GNU package maintainers are responsible.) ============================================================================== 1. Areas that someone wants to be maintaining (i.e. has a particularly