commit 9fc46f1fd9580c19656688e379e146401c19ef66 (HEAD, refs/remotes/origin/master) Author: Elías Gabriel Pérez Date: Sun Nov 9 09:20:05 2025 +0200 hideshow: Rework previous changes * lisp/progmodes/hideshow.el (hs-grok-mode-type): Improve 'hs--set-variable'. * lisp/progmodes/python.el (python-base-mode, python-ts-mode): Provide backward-compatibility for older versions. diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 764fdb66848..c8b4e68f00f 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -1019,21 +1019,21 @@ Otherwise, return nil." (when (>= (point) q) (list (and hideable p) (point)))))))) -(defun hs--set-variable (var old-nth &optional default) +(defun hs--set-variable (var nth &optional default) "Set Hideshow VAR if already not set. This function is meant to be used for backward compatibility with `hs-special-modes-alist'. -OLD-NTH is a number indicating NTH element of `hs-special-modes-alist'. +NTH must be a number indicating NTH element of +`hs-special-modes-alist' or a function. DEFAULT is a value to use as fallback." (unless (local-variable-p var) ; Already set, nothing to do. - (if-let* (old-nth - (old-lookup (assoc major-mode hs-special-modes-alist))) - (set (make-local-variable var) - (if (integerp old-nth) - (nth old-nth old-lookup) - (funcall old-nth old-lookup))) + (if-let* ((old-lookup (assoc major-mode hs-special-modes-alist)) + (val (if (integerp nth) + (nth nth old-lookup) + (funcall nth old-lookup)))) + (set (make-local-variable var) val) (when default (set (make-local-variable var) default))))) @@ -1048,12 +1048,14 @@ If `hs-special-modes-alist' has information associated with the current buffer's major mode, use that. Otherwise, guess start, end and `comment-start' regexps; `forward-sexp' function; and adjust-block-beginning function." - (hs--set-variable 'hs-block-start-regexp #'caadr) - (hs--set-variable 'hs-block-start-mdata-select #'cadadr) + (hs--set-variable 'hs-block-start-regexp + (lambda (v) (car (ensure-list (nth 1 v))))) + (hs--set-variable 'hs-block-start-mdata-select + (lambda (v) (cadr (ensure-list (nth 1 v))))) (hs--set-variable 'hs-block-end-regexp 2) (hs--set-variable 'hs-c-start-regexp 3 (string-trim-right (regexp-quote comment-start))) - (hs--set-variable 'hs-forward-sexp-function 4) + (hs--set-variable 'hs-forward-sexp-function 4 #'forward-sexp) (hs--set-variable 'hs-adjust-block-beginning-function 5) (hs--set-variable 'hs-find-block-beginning-function 6) (hs--set-variable 'hs-find-next-block-function 7) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 12557aecf4d..c4cf7ec46cf 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7355,15 +7355,30 @@ implementations: `python-mode' and `python-ts-mode'." #'python-eldoc-function)))) (eldoc-add-command-completions "python-indent-dedent-line-backspace") - (setq-local hs-block-start-regexp python-nav-beginning-of-block-regexp) - ;; Use the empty string as end regexp so it doesn't default to - ;; "\\s)". This way parens at end of defun are properly hidden. - (setq-local hs-block-end-regexp "") - (setq-local hs-c-start-regexp "#") - (setq-local hs-forward-sexp-function #'python-hideshow-forward-sexp-function) - (setq-local hs-find-block-beginning-function #'python-nav-beginning-of-block) - (setq-local hs-find-next-block-function #'python-hideshow-find-next-block) - (setq-local hs-looking-at-block-start-predicate #'python-info-looking-at-beginning-of-block) + (if (< emacs-major-version 31) + (dolist (mode '(python-mode python-ts-mode)) + (add-to-list + 'hs-special-modes-alist + `(,mode + ,python-nav-beginning-of-block-regexp + ;; Use the empty string as end regexp so it doesn't default to + ;; "\\s)". This way parens at end of defun are properly hidden. + "" + "#" + python-hideshow-forward-sexp-function + nil + python-nav-beginning-of-block + python-hideshow-find-next-block + python-info-looking-at-beginning-of-block))) + (setq-local hs-block-start-regexp python-nav-beginning-of-block-regexp) + ;; Use the empty string as end regexp so it doesn't default to + ;; "\\s)". This way parens at end of defun are properly hidden. + (setq-local hs-block-end-regexp "") + (setq-local hs-c-start-regexp "#") + (setq-local hs-forward-sexp-function #'python-hideshow-forward-sexp-function) + (setq-local hs-find-block-beginning-function #'python-nav-beginning-of-block) + (setq-local hs-find-next-block-function #'python-hideshow-find-next-block) + (setq-local hs-looking-at-block-start-predicate #'python-info-looking-at-beginning-of-block)) (setq-local outline-regexp (python-rx (* space) block-start)) (setq-local outline-level @@ -7437,8 +7452,9 @@ implementations: `python-mode' and `python-ts-mode'." (setq-local forward-sexp-function #'treesit-forward-sexp treesit-sexp-thing 'sexp) - (setq-local hs-treesit-things '(or defun sexp)) - (setq-local hs-adjust-block-end-function #'python-ts-hs-adjust-block-end-fn) + (when (>= emacs-major-version 31) + (setq-local hs-treesit-things '(or defun sexp)) + (setq-local hs-adjust-block-end-function #'python-ts-hs-adjust-block-end-fn)) (setq-local syntax-propertize-function #'python--treesit-syntax-propertize) commit f11349ea1a5f391a457da90a7a07af9ba7f47e6d Author: Eli Zaretskii Date: Sun Nov 9 08:58:15 2025 +0200 Fix a crash in 'merge_face_ref' * src/xfaces.c (get_lface_attributes): Avoid crashes if F is NULL. This happens when 'face_inheritance_cycle' is for some reason called for the default attributes of a face (which are applicable to future frames). We avoid the crashes by not consulting face remapping in that case, since face remapping is buffer-local, and therefore cannot possibly affect face defaults. (Bug#79790) diff --git a/src/xfaces.c b/src/xfaces.c index 3a6d2aecba6..6189337ff68 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2125,25 +2125,31 @@ get_lface_attributes (struct window *w, face_name = resolve_face_name (face_name, signal_p); - /* See if SYMBOL has been remapped to some other face (usually this - is done buffer-locally). */ - face_remapping = assq_no_quit (face_name, Vface_remapping_alist); - if (CONSP (face_remapping)) + /* See if SYMBOL has been remapped to some other face (usually this is + done buffer-locally). We only do that of F is non-NULL, because + face remapping is not relevant for default attributes of faces for + future frames, and because merge_face_ref cannot handle NULL frames + anyway. */ + if (f) { - struct named_merge_point named_merge_point; - - if (push_named_merge_point (&named_merge_point, - face_name, NAMED_MERGE_POINT_REMAP, - &named_merge_points)) + face_remapping = assq_no_quit (face_name, Vface_remapping_alist); + if (CONSP (face_remapping)) { - int i; + struct named_merge_point named_merge_point; - for (i = 1; i < LFACE_VECTOR_SIZE; ++i) - attrs[i] = Qunspecified; + if (push_named_merge_point (&named_merge_point, + face_name, NAMED_MERGE_POINT_REMAP, + &named_merge_points)) + { + int i; + + for (i = 1; i < LFACE_VECTOR_SIZE; ++i) + attrs[i] = Qunspecified; - return merge_face_ref (w, f, XCDR (face_remapping), attrs, - signal_p, named_merge_points, - 0); + return merge_face_ref (w, f, XCDR (face_remapping), attrs, + signal_p, named_merge_points, + 0); + } } } commit 266335374e29cfd304838b2109af93ab22f6009f Author: Wilson Snyder Date: Sat Nov 8 18:33:58 2025 -0500 verilog-mode: Make recent change backward-compatible and update from package upstream. * lisp/progmodes/verilog-mode.el (verilog-mode): Support Emacs 31.1 'hs-forward-sexp-func in backward-compatible way. (verilog-submit-bug-report) Remove key binding. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 79b75c24db5..51e3270a58c 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -9,7 +9,7 @@ ;; Keywords: languages ;; The "Version" is the date followed by the decimal rendition of the Git ;; commit hex. -;; Version: 2025.01.01.100165202 +;; Version: 2025.11.08.248496848 ;; Yoni Rabkin contacted the maintainer of this ;; file on 19/3/2008, and the maintainer agreed that when a bug is @@ -124,7 +124,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2025-01-01-5f86652-vpo-GNU" +(defconst verilog-mode-version "2025-11-08-ecfc2d0-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -1586,7 +1586,6 @@ If set will become buffer local.") (define-key map "\C-c\C-r" #'verilog-label-be) (define-key map "\C-c\C-i" #'verilog-pretty-declarations) (define-key map "\C-c=" #'verilog-pretty-expr) - (define-key map "\C-c\C-b" #'verilog-submit-bug-report) (define-key map "\C-c/" #'verilog-star-comment) (define-key map "\C-c\C-c" #'verilog-comment-region) (define-key map "\C-c\C-u" #'verilog-uncomment-region) @@ -4363,9 +4362,16 @@ Key bindings specific to `verilog-mode-map' are: (when (and (boundp 'which-func-modes) (listp which-func-modes)) (add-to-list 'which-func-modes 'verilog-mode)) ;; hideshow support - (setq-local hs-block-start-regexp "\\") - (setq-local hs-block-end-regexp "\\") - (setq-local hs-forward-sexp-function #'verilog-forward-sexp-function) + (cond ((boundp 'hs-forward-sexp-function) ;; 31.1 and beyond + (setq-local hs-block-start-regexp "\\") + (setq-local hs-block-end-regexp "\\") + (setq-local hs-forward-sexp-function #'verilog-forward-sexp-function)) + ((boundp 'hs-special-modes-alist) ;; pre 31.1, not XEmacs + (unless (assq 'verilog-mode hs-special-modes-alist) + (setq hs-special-modes-alist + (cons '(verilog-mode "\\" "\\" nil + verilog-forward-sexp-function) + hs-special-modes-alist))))) (add-hook 'completion-at-point-functions #'verilog-completion-at-point nil 'local) commit ef2584585b095fff1e045e58673d2a7c8f9af799 Author: Elías Gabriel Pérez Date: Sat Nov 8 20:04:30 2025 +0200 hideshow: Rework previous changes * lisp/progmodes/hideshow.el: Set default values of buffer-local variables. (hs-inside-comment-p): Restore. (hs--set-variable): Rename from 'hs--get-mode-value'. (hs-grok-mode-type): Rework. * lisp/nxml/nxml-mode.el: * lisp/progmodes/f90.el: * lisp/progmodes/fortran.el: * lisp/progmodes/icon.el: * lisp/progmodes/lua-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/verilog-mode.el: * lisp/progmodes/vhdl-mode.el: * lisp/textmodes/mhtml-mode.el: * lisp/textmodes/sgml-mode.el: * lisp/treesit.el (treesit-major-mode-setup): Rename 'hs-forward-sexp-func' to 'hs-forward-sexp-function', 'hs-adjust-block-beginning' to 'hs-adjust-block-beginning-function', 'hs-find-block-beginning-func' to 'hs-find-block-beginning-function', 'hs-find-next-block-func' to 'hs-find-next-block-function', 'hs-looking-at-block-start-p-func' to 'hs-looking-at-block-start-predicate', 'hs-inside-comment-p-func' to 'hs-inside-comment-predicate'. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 08c6c1b2fac..9b780a91721 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -535,7 +535,7 @@ Many aspects this mode can be customized using (setq-local hs-block-start-regexp "<[^/>]*?") (setq-local hs-block-end-regexp "]*[^/]>") (setq-local hs-c-start-regexp "