commit 598f15bcaf6fac41d58e438cb55571d0593de549 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Oct 4 08:43:54 2024 +0300 ; * lisp/files.el (save-some-buffers-action-alist): Fix comment. diff --git a/lisp/files.el b/lisp/files.el index 75cea9b931a..a5c34f1f88e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6152,7 +6152,7 @@ Before and after saving the buffer, this function runs `((?\M-~ ,(lambda (buf) (with-current-buffer buf (set-buffer-modified-p nil)) - ;; Return t to not ask about BUF again. + ;; Return t so we don't ask about BUF again. t) ,(purecopy "skip this buffer and mark it unmodified")) (?\C-r commit f3f57c11981489b1d19d2efb906820c98083cce1 Author: Eli Zaretskii Date: Fri Oct 4 08:40:39 2024 +0300 ; * doc/emacs/misc.texi (DocView Navigation): Fix wording. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 7b11a829b0b..83b83ea7ae9 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -585,13 +585,13 @@ default size for DocView, customize the variable @vindex doc-view-imenu-format @vindex doc-view-djvused-program DocView can generate an outline menu for PDF and DjVu documents using -the @command{mutool} and the @command{djvused} programs respectively -when they are available. This is made accessible via the @code{imenu} -facility (@pxref{Imenu}). You can customize how @code{imenu} items are -formatted and displayed using the variables @code{doc-view-imenu-format} -and @code{doc-view-imenu-flatten}. The filename of the -@command{djvused} program can be customized by changing the -@code{doc-view-djvused-program} user option. +the @command{mutool} and the @command{djvused} programs, respectively, +when they are available. This uses the @code{imenu} facility +(@pxref{Imenu}). You can customize how the @code{imenu} items for this +outline are formatted and displayed using the variables +@code{doc-view-imenu-format} and @code{doc-view-imenu-flatten}. The +filename of the @command{djvused} program can be customized by changing +the @code{doc-view-djvused-program} user option. @cindex registers, in DocView mode @findex doc-view-page-to-register commit d6dd71cd56e73aaf998d27225249edf661ead488 Author: Visuwesh Date: Wed Oct 2 13:48:25 2024 +0530 Add imenu index function for DjVu files in doc-view * lisp/doc-view.el (doc-view-pdfdraw-program): Prefer mutool over other names. (doc-view-imenu-enabled): Tweak the default value to check for 'djvused', and make it obsolete. (doc-view--djvu-outline, doc-view--parse-djvu-outline): Add new functions to return imenu index for a Djvu file. (doc-view--outline): Add new function to create the imenu index depending on the file type. (doc-view--outline): Document new possible variable value. (doc-view-imenu-index): Use the above function instead. (doc-view-imenu-setup): Try to create the imenu index unconditionally. * doc/emacs/misc.texi (DocView Navigation): Mention index creation using 'djvused' too. * etc/NEWS: Announce the change. (Bug#73530) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index b074eb034b2..7b11a829b0b 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -581,17 +581,17 @@ you instead want the image to be re-rendered at the new size, set default size for DocView, customize the variable @code{doc-view-resolution}. -@vindex doc-view-imenu-enabled @vindex doc-view-imenu-flatten @vindex doc-view-imenu-format - When the @command{mutool} program is available, DocView will use it -to generate entries for an outline menu, making it accessible via the -@code{imenu} facility (@pxref{Imenu}). To disable this functionality -even when @command{mutool} can be found on your system, customize the -variable @code{doc-view-imenu-enabled} to the @code{nil} value. You -can further customize how @code{imenu} items are formatted and -displayed using the variables @code{doc-view-imenu-format} and -@code{doc-view-imenu-flatten}. +@vindex doc-view-djvused-program + DocView can generate an outline menu for PDF and DjVu documents using +the @command{mutool} and the @command{djvused} programs respectively +when they are available. This is made accessible via the @code{imenu} +facility (@pxref{Imenu}). You can customize how @code{imenu} items are +formatted and displayed using the variables @code{doc-view-imenu-format} +and @code{doc-view-imenu-flatten}. The filename of the +@command{djvused} program can be customized by changing the +@code{doc-view-djvused-program} user option. @cindex registers, in DocView mode @findex doc-view-page-to-register diff --git a/etc/NEWS b/etc/NEWS index a2d61d5c561..66f5e18e8db 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -364,6 +364,13 @@ Docview can store current page to buffer-local registers with the new command 'doc-view-page-to-register' (bound to 'm'), and later the stored page can be restored with 'doc-view-jump-to-register' (bound to '''). ++++ +*** Docview can generate imenu index for DjVu files. +When the 'djvused' program is available, Docview can now generate imenu +index for DjVu files from its outline. +The name of the 'djvused' program can be customized by changing the user +option 'doc-view-djvused-program'. + ** Tramp +++ diff --git a/lisp/doc-view.el b/lisp/doc-view.el index e79295a8b01..3683f1f60d4 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -27,8 +27,10 @@ ;; `pdftotext', which comes with xpdf (https://www.foolabs.com/xpdf/) ;; or poppler (https://poppler.freedesktop.org/). EPUB, CBZ, FB2, XPS ;; and OXPS documents require `mutool' which comes with mupdf -;; (https://mupdf.com/index.html). Djvu documents require `ddjvu' +;; (https://mupdf.com/index.html). DjVu documents require `ddjvu' ;; (from DjVuLibre). ODF files require `soffice' (from LibreOffice). +;; `djvused' (from DjVuLibre) can be optionally used to generate imenu +;; outline for DjVu documents when available. ;;; Commentary: @@ -185,13 +187,13 @@ are available (see Info node `(emacs)Document View')." (defcustom doc-view-pdfdraw-program (cond + ((executable-find "mutool") "mutool") ((executable-find "pdfdraw") "pdfdraw") ((executable-find "mudraw") "mudraw") - ((executable-find "mutool") "mutool") (t "mudraw")) "Name of MuPDF's program to convert PDF files to PNG." :type 'file - :version "24.4") + :version "31.1") (defcustom doc-view-pdftotext-program-args '("-raw") "Parameters to give to the pdftotext command." @@ -216,10 +218,23 @@ are available (see Info node `(emacs)Document View')." :type 'boolean :version "30.1") -(defcustom doc-view-imenu-enabled (and (executable-find "mutool") t) - "Whether to generate an imenu outline when \"mutool\" is available." +(defcustom doc-view-djvused-program (and (executable-find "djvused") + "djvused") + "Name of \"djvused\" program to generate imenu outline for DjVu files. +This is part of DjVuLibre." + :type 'file + :version "31.1") + +(defcustom doc-view-imenu-enabled (and (or (executable-find "mutool") + (executable-find "djvused")) + t) + "Whether to generate imenu outline for PDF and DjVu files. +This uses \"mutool\" for PDF files and \"djvused\" for DjVu files." :type 'boolean - :version "29.1") + :version "31.1") +(make-obsolete-variable 'doc-view-imenu-enabled + "Imenu index is generated unconditionally when available." + "31.1") (defcustom doc-view-imenu-title-format "%t (%p)" "Format spec for imenu's display of section titles from docview documents. @@ -1958,7 +1973,9 @@ the document text." "[^\t]+\\(\t+\\)\"\\(.+\\)\"\t#\\(?:page=\\)?\\([0-9]+\\)") (defvar-local doc-view--outline nil - "Cached PDF outline, so that it is only computed once per document.") + "Cached PDF outline, so that it is only computed once per document. +It can be the symbol `unavailable' to indicate that outline is +unavailable for the document.") (defun doc-view--pdf-outline (&optional file-name) "Return a list describing the outline of FILE-NAME. @@ -1972,7 +1989,9 @@ structure is extracted by `doc-view--imenu-subtree'." (let ((outline nil) (fn (expand-file-name fn))) (with-temp-buffer - (unless (eql 0 (call-process "mutool" nil (current-buffer) nil "show" fn "outline")) + (unless (eql 0 (call-process doc-view-pdfdraw-program nil + (current-buffer) nil "show" fn "outline")) + (setq doc-view--outline 'unavailable) (imenu-unavailable-error "Unable to create imenu index using `mutool'")) (goto-char (point-min)) (while (re-search-forward doc-view--outline-rx nil t) @@ -1983,6 +2002,42 @@ structure is extracted by `doc-view--imenu-subtree'." outline))) (nreverse outline))))) +(defun doc-view--djvu-outline (&optional file-name) + "Return a list describing the outline of FILE-NAME. +If FILE-NAME is nil or omitted, it defaults to the current buffer's file +name. + +For the format, see `doc-view--pdf-outline'." + (unless file-name (setq file-name (buffer-file-name))) + (with-temp-buffer + (call-process doc-view-djvused-program nil (current-buffer) nil + "-e" "print-outline" file-name) + (goto-char (point-min)) + (when (eobp) + (setq doc-view--outline 'unavailable) + (imenu-unavailable-error "Unable to create imenu index using `djvused'")) + (nreverse (doc-view--parse-djvu-outline (read (current-buffer)))))) + +(defun doc-view--parse-djvu-outline (bookmark &optional level) + "Return a list describing the djvu outline from BOOKMARK. +Optional argument LEVEL is the current heading level, which defaults to 1." + (unless level (setq level 1)) + (let ((res)) + (unless (eq (car bookmark) 'bookmarks) + (user-error "Unknown outline type: %S" (car bookmark))) + (pcase-dolist (`(,title ,page . ,rest) (cdr bookmark)) + (push `((level . ,level) + (title . ,title) + (page . ,(string-to-number (string-remove-prefix "#" page)))) + res) + (when (and rest (listp (car rest))) + (setq res (append + (doc-view--parse-djvu-outline + (cons 'bookmarks rest) + (+ level 1)) + res)))) + res)) + (defun doc-view--imenu-subtree (outline act) "Construct a tree of imenu items for the given outline list and action. @@ -2015,19 +2070,36 @@ entries at an upper level." For extensibility, callers can specify a FILE-NAME to indicate the buffer other than the current buffer, and a jumping function GOTO-PAGE-FN other than `doc-view-goto-page'." - (let* ((goto (or goto-page-fn 'doc-view-goto-page)) - (act (lambda (_name _pos page) (funcall goto page))) - (outline (or doc-view--outline (doc-view--pdf-outline file-name)))) - (car (doc-view--imenu-subtree outline act)))) + (unless doc-view--outline + (setq doc-view--outline (doc-view--outline file-name))) + (unless (eq doc-view--outline 'unavailable) + (let* ((goto (or goto-page-fn #'doc-view-goto-page)) + (act (lambda (_name _pos page) (funcall goto page))) + (outline doc-view--outline)) + (car (doc-view--imenu-subtree outline act))))) + +(defun doc-view--outline (&optional file-name) + "Return the outline for the file FILE-NAME. +If FILE-NAME is nil, use the current file instead." + (unless file-name (setq file-name (buffer-file-name))) + (let ((outline + (pcase doc-view-doc-type + ('djvu + (when doc-view-djvused-program + (doc-view--djvu-outline file-name))) + (_ + (doc-view--pdf-outline file-name))))) + (when outline (imenu-add-to-menubar "Outline")) + ;; When the outline could not be made due to unavailability of the + ;; required program, or its absency from the document, return + ;; 'unavailable'. + (or outline 'unavailable))) (defun doc-view-imenu-setup () "Set up local state in the current buffer for imenu, if needed." - (when doc-view-imenu-enabled - (setq-local imenu-create-index-function #'doc-view-imenu-index - imenu-submenus-on-top nil - imenu-sort-function nil - doc-view--outline (doc-view--pdf-outline)) - (when doc-view--outline (imenu-add-to-menubar "Outline")))) + (setq-local imenu-create-index-function #'doc-view-imenu-index + imenu-submenus-on-top nil + imenu-sort-function nil)) ;;;; User interface commands and the mode commit 5e0935d9917fe768f74311c6cb4dc3a1e9014c52 Author: Daniel Colascione Date: Fri Oct 4 00:56:37 2024 -0400 Fix term.el tests; refine previous change Fix the term.el tests by making them match the new expected output. * test/lisp/term-tests.el: defvar - defconst (ansi-test-strings): remove unwanted text properties from expectations * lisp/term.el: (term--handle-colors-list): further shrink common-case face list diff --git a/lisp/term.el b/lisp/term.el index 7b9886e720a..c966afd5e80 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -3545,7 +3545,8 @@ color is unset in the terminal state." (setq term-current-face `(,@(when fg `(:foreground ,fg)) ,@(when bg `(:background ,bg)) - ,@(unless term-ansi-current-invisible + ,@(when (and term-ansi-current-reverse + (not term-ansi-current-invisible)) (list :inverse-video term-ansi-current-reverse))))) (setq term-current-face diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index f5209d6f580..8df07ac66e1 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -28,25 +28,18 @@ (defvar term-height) ; Number of lines in window. (defvar term-width) ; Number of columns in window. -(defvar yellow-fg-props - `( :foreground ,(face-foreground 'term-color-yellow nil 'default) - :background "unspecified-bg" :inverse-video nil)) -(defvar yellow-bg-props - `( :foreground "unspecified-fg" - :background ,(face-background 'term-color-yellow nil 'default) - :inverse-video nil)) -(defvar bright-yellow-fg-props - `( :foreground ,(face-foreground 'term-color-bright-yellow nil 'default) - :background "unspecified-bg" :inverse-video nil)) -(defvar bright-yellow-bg-props - `( :foreground "unspecified-fg" - :background ,(face-background 'term-color-bright-yellow nil 'default) - :inverse-video nil)) -(defvar custom-color-fg-props - `( :foreground "#87FFFF" - :background "unspecified-bg" :inverse-video nil)) - -(defvar ansi-test-strings +(defconst yellow-fg-props + `(:foreground ,(face-foreground 'term-color-yellow nil 'default))) +(defconst yellow-bg-props + `(:background ,(face-background 'term-color-yellow nil 'default))) +(defconst bright-yellow-fg-props + `(:foreground ,(face-foreground 'term-color-bright-yellow nil 'default))) +(defconst bright-yellow-bg-props + `(:background ,(face-background 'term-color-bright-yellow nil 'default))) +(defconst custom-color-fg-props + `(:foreground "#87FFFF")) + +(defconst ansi-test-strings `(("\e[33mHello World\e[0m" ,(propertize "Hello World" 'font-lock-face `(,yellow-fg-props))) ("\e[43mHello World\e[0m" commit d9e76c87a120305abc4701acb496ced103b4b4fb Author: Sean Whitton Date: Fri Oct 4 09:40:16 2024 +0800 ; diff-delete-other-hunks manual entry: Expand explanation diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index a7fef99c593..86b85f16d69 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1712,7 +1712,7 @@ Delete hunks other than the current one. If the region is active, this command deletes the hunks the region overlaps; otherwise it deletes all hunks other than the current hunk. This command does not work in a narrowed buffer because deleting hunks safely requires access to the -file headers. +parts of the buffer where the hunks' file names are specified. @findex diff-refine-hunk @item C-c C-b commit eeeb13bed476a0d1b744f31c8e18513346cfbe39 Author: Sean Whitton Date: Fri Oct 4 09:25:08 2024 +0800 ; Fix word order in a recently-added comment diff --git a/lisp/files.el b/lisp/files.el index b92108fac93..75cea9b931a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6152,7 +6152,7 @@ Before and after saving the buffer, this function runs `((?\M-~ ,(lambda (buf) (with-current-buffer buf (set-buffer-modified-p nil)) - ;; Return t not to ask about BUF again. + ;; Return t to not ask about BUF again. t) ,(purecopy "skip this buffer and mark it unmodified")) (?\C-r commit c3e989ca9d786e001a9801fdd95fcbcb0d73fddc Author: Sean Whitton Date: Fri Oct 4 08:28:21 2024 +0800 New minor mode find-function-mode replaces find-function-setup-keys * lisp/emacs-lisp/find-func.el (find-function-mode-map): (find-function-mode): New minor mode. (find-function-setup-keys): Replace with stub function that just enables the new minor mode. Mark as obsolete. * etc/NEWS: Announce the change. diff --git a/etc/NEWS b/etc/NEWS index e4c1ef4eae0..a2d61d5c561 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -50,6 +50,9 @@ The 'find-function', 'find-library', 'find-face-definition', and 'find-variable' commands now allow retrieving previous input using the usual minibuffer history commands. Each command has a separate history. +--- +** New minor mode find-function-mode replaces the old find-function-setup-keys. + ** Minibuffer and Completions +++ diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index c1835feff18..c031ee427d4 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -26,7 +26,7 @@ ;; The funniest thing about this is that I can't imagine why a package ;; so obviously useful as this hasn't been written before!! ;; ;;; find-func -;; (find-function-setup-keys) +;; (find-function-mode 1) ;; ;; or just: ;; @@ -805,21 +805,34 @@ See `find-function-on-key'." (when (and symb (not (equal symb 0))) (find-variable-other-window symb)))) +(defvar-keymap find-function-mode-map + "C-x F" #'find-function + "C-x 4 F" #'find-function-other-window + "C-x 5 F" #'find-function-other-frame + + "C-x K" #'find-function-on-key + "C-x 4 K" #'find-function-on-key-other-window + "C-x 5 K" #'find-function-on-key-other-frame + + "C-x V" #'find-variable + "C-x 4 V" #'find-variable-other-window + "C-x 5 V" #'find-variable-other-frame + + "C-x L" #'find-library + "C-x 4 L" #'find-library-other-window + "C-x 5 L" #'find-library-other-frame) + +;;;###autoload +(define-minor-mode find-function-mode + "Enable some key bindings for the `find-function' family of functions." + :global t :lighter nil ; compat. with old `find-function-setup-keys' + :group 'find-function :version "31.1") + ;;;###autoload (defun find-function-setup-keys () - "Define some key bindings for the `find-function' family of functions." - (define-key ctl-x-map "F" 'find-function) - (define-key ctl-x-4-map "F" 'find-function-other-window) - (define-key ctl-x-5-map "F" 'find-function-other-frame) - (define-key ctl-x-map "K" 'find-function-on-key) - (define-key ctl-x-4-map "K" 'find-function-on-key-other-window) - (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) - (define-key ctl-x-map "V" 'find-variable) - (define-key ctl-x-4-map "V" 'find-variable-other-window) - (define-key ctl-x-5-map "V" 'find-variable-other-frame) - (define-key ctl-x-map "L" 'find-library) - (define-key ctl-x-4-map "L" 'find-library-other-window) - (define-key ctl-x-5-map "L" 'find-library-other-frame)) + "Turn on `find-function-mode', which see." + (find-function-mode 1)) +(make-obsolete 'find-function-setup-keys 'find-function-mode "31.1") (provide 'find-func) commit c9e30e8c77d903a117e9319b264c7b66af499713 Author: Theodor Thornhill Date: Sun Jan 22 11:27:37 2023 +0100 Add sentence and sexp movement to python-ts-mode * lisp/progmodes/python.el (python-ts-mode): Add relevant node types. (Bug#60856) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a9fb3e3de6a..56c80c8264b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7208,6 +7208,20 @@ implementations: `python-mode' and `python-ts-mode'." "_definition")) (setq-local treesit-defun-name-function #'python--treesit-defun-name) + + (setq-local treesit-sentence-type-regexp + (regexp-opt '("statement" + "clause"))) + + (setq-local treesit-sexp-type-regexp + (regexp-opt '("expression" + "string" + "call" + "operator" + "identifier" + "integer" + "float"))) + (treesit-major-mode-setup) (setq-local syntax-propertize-function #'python--treesit-syntax-propertize) commit 59dcd1143320ada0244aa309c98a0afa5f2eb5f5 Author: Stefan Kangas Date: Fri Oct 4 01:37:31 2024 +0200 Fix two warnings in smerge.el * lisp/vc/smerge-mode.el (smerge-upper, smerge-lower): Fix warnings. diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index a16c7871ff9..aad3e302826 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -81,7 +81,7 @@ Used in `smerge-diff-base-upper' and related functions." (((class color) (min-colors 88) (background dark)) :background "#553333" :extend t) (((class color)) - :foreground "red" :extend)) + :foreground "red" :extend t)) "Face for the `upper' version of a conflict.") (define-obsolete-face-alias 'smerge-mine 'smerge-upper "26.1") (defvar smerge-upper-face 'smerge-upper) @@ -92,7 +92,7 @@ Used in `smerge-diff-base-upper' and related functions." (((class color) (min-colors 88) (background dark)) :background "#335533" :extend t) (((class color)) - :foreground "green" :extend)) + :foreground "green" :extend t)) "Face for the `lower' version of a conflict.") (define-obsolete-face-alias 'smerge-other 'smerge-lower "26.1") (defvar smerge-lower-face 'smerge-lower) commit e20ce5fcc53593db5400596afee783d966ad2b2d Author: Stefan Kangas Date: Fri Oct 4 01:36:41 2024 +0200 Prefer defcustom :local specifier * lisp/dirtrack.el (dirtrack-list): * lisp/emacs-lisp/lisp.el (defun-prompt-regexp): * lisp/emulation/viper-init.el (viper-related-files-and-buffers-ring): * lisp/emulation/viper-util.el (viper-syntax-preference): * lisp/erc/erc.el (erc-ignore-list): * lisp/files.el (buffer-offer-save, backup-by-copying-when-mismatch): * lisp/find-file.el (ff-pre-find-hook, ff-pre-load-hook) (ff-post-load-hook, ff-not-found-hook, ff-file-created-hook) (ff-case-fold-search, ff-always-in-other-window) (ff-ignore-include, ff-quiet-mode, ff-other-file-alist) (ff-search-directories): * lisp/mh-e/mh-e.el (mh-scan-prog): * lisp/newcomment.el (comment-column): * lisp/obsolete/rlogin.el (rlogin-directory-tracking-mode): * lisp/play/decipher.el (decipher-ignore-spaces): * lisp/plstore.el (plstore-encrypt-to): * lisp/proced.el (proced-format, proced-filter, proced-sort) (proced-descend, proced-auto-update-flag, proced-tree-flag): * lisp/progmodes/fortran.el (fortran-line-length): * lisp/shell.el (shell-history-file-name): * lisp/simple.el (goal-column, fill-prefix): * lisp/vc/ediff-init.el (ediff-use-faces) (ediff-highlight-all-diffs, ediff-autostore-merges): * lisp/vc/ediff-merg.el (ediff-show-clashes-only) (ediff-skip-merge-regions-that-differ-from-default): Prefer defcustom :local specifier to using 'make-variable-buffer-local' directly. diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el index 07e176b8eea..8e9181f1379 100644 --- a/lisp/dirtrack.el +++ b/lisp/dirtrack.el @@ -126,10 +126,9 @@ First item is a regexp that describes where to find the path in a prompt. Second is a number, the regexp group to match." :type '(sexp (regexp :tag "Prompt Expression") (integer :tag "Regexp Group")) + :local t :version "24.1") -(make-variable-buffer-local 'dirtrack-list) - (defcustom dirtrack-debug nil "If non-nil, the function `dirtrack' will report debugging info." :type 'boolean) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 280de5036aa..c9e27e78c33 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -36,8 +36,8 @@ This is only necessary if the opening paren or brace is not in column 0. See function `beginning-of-defun'." :type '(choice (const nil) regexp) + :local t :group 'lisp) -(make-variable-buffer-local 'defun-prompt-regexp) (defcustom parens-require-spaces t "If non-nil, add whitespace as needed when inserting parentheses. diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 9f724551239..e9f32b447d8 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -698,8 +698,8 @@ If nil, the cursor will move backwards without deleting anything." "List of file and buffer names to consider related to the current buffer. Related buffers can be cycled through via :R and :P commands." :type 'boolean + :local 'permanent-only :group 'viper-misc) -(put 'viper-related-files-and-buffers-ring 'permanent-local t) ;; Used to find out if we are done with searching the current buffer. (defvar-local viper-local-search-start-marker nil) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index d28c319de98..db4f12b84f9 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -1135,8 +1135,8 @@ This option is appropriate if you like Emacs-style words." :type '(radio (const strict-vi) (const reformed-vi) (const extended) (const emacs)) :set #'viper-set-syntax-preference + :local t :group 'viper) -(make-variable-buffer-local 'viper-syntax-preference) ;; addl-chars are characters to be temporarily considered as alphanumerical diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 7de3b375752..730ec2ebb22 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1106,8 +1106,8 @@ A user identifier has the form \"nick!login@host\". If an identifier matches, the message from the person will not be processed." :group 'erc-ignore - :type '(repeat regexp)) -(make-variable-buffer-local 'erc-ignore-list) + :type '(repeat regexp) + :local t) (defcustom erc-ignore-reply-list nil "List of regexps matching user identifiers to ignore completely. diff --git a/lisp/files.el b/lisp/files.el index c9889f3c765..b92108fac93 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -144,8 +144,8 @@ the default for a new file created there by you. This variable is relevant only if `backup-by-copying' is nil." :version "24.1" :type 'boolean + :local 'permanent-only :group 'backup) -(put 'backup-by-copying-when-mismatch 'permanent-local t) (defcustom backup-by-copying-when-privileged-mismatch 200 "Non-nil means create backups by copying to preserve a privileged owner. @@ -178,9 +178,8 @@ use `kill-buffer-query-functions'." :type '(choice (const :tag "Never" nil) (const :tag "On Emacs exit" t) (const :tag "Whenever save-some-buffers is called" always)) + :local 'permanent :group 'backup) -(make-variable-buffer-local 'buffer-offer-save) -(put 'buffer-offer-save 'permanent-local t) (defcustom find-file-existing-other-name t "Non-nil means find a file under alternative names, in existing buffers. diff --git a/lisp/find-file.el b/lisp/find-file.el index 23e0c12ad2c..65e980d38fc 100644 --- a/lisp/find-file.el +++ b/lisp/find-file.el @@ -130,37 +130,45 @@ (defcustom ff-pre-find-hook nil "List of functions to be called before the search for the file starts." - :type 'hook) + :type 'hook + :local t) (defcustom ff-pre-load-hook nil "List of functions to be called before the other file is loaded." - :type 'hook) + :type 'hook + :local t) (defcustom ff-post-load-hook nil "List of functions to be called after the other file is loaded." - :type 'hook) + :type 'hook + :local t) (defcustom ff-not-found-hook nil "List of functions to be called if the other file could not be found." - :type 'hook) + :type 'hook + :local t) (defcustom ff-file-created-hook nil "List of functions to be called if the other file needs to be created." - :type 'hook) + :type 'hook + :local t) (defcustom ff-case-fold-search nil "Non-nil means ignore cases in matches (see `case-fold-search'). If you have extensions in different cases, you will want this to be nil." - :type 'boolean) + :type 'boolean + :local t) (defcustom ff-always-in-other-window nil "If non-nil, find the corresponding file in another window by default. To override this, give an argument to `ff-find-other-file'." - :type 'boolean) + :type 'boolean + :local t) (defcustom ff-ignore-include nil "If non-nil, ignore `#include' lines." - :type 'boolean) + :type 'boolean + :local t) (defcustom ff-always-try-to-create t "If non-nil, always attempt to create the other file if it was not found." @@ -168,7 +176,8 @@ To override this, give an argument to `ff-find-other-file'." (defcustom ff-quiet-mode nil "If non-nil, do not trace which directories are being searched." - :type 'boolean) + :type 'boolean + :local t) ;;;###autoload (defcustom ff-special-constructs @@ -220,7 +229,8 @@ function must return a non-nil list of file-names. It cannot return nil, nor can it signal in any way a failure to find a suitable list of file names." :type '(choice (repeat (list regexp (choice (repeat string) function))) - symbol)) + symbol) + :local t) (defcustom ff-search-directories 'cc-search-directories "List of directories to search for a specific file. @@ -243,7 +253,8 @@ not exist, it is replaced (silently) with an empty string. The stars are *not* wildcards: they are searched for together with the preceding slash. The star represents all the subdirectories except `..', and each of these subdirectories will be searched in turn." - :type '(choice (repeat directory) symbol)) + :type '(choice (repeat directory) symbol) + :local t) (defcustom cc-search-directories '("." "/usr/include" "/usr/local/include/*") @@ -294,17 +305,6 @@ is created with the first matching extension (`.cc' yields `.hh')." ;; No user definable variables beyond this point! ;; ============================================== -(make-variable-buffer-local 'ff-pre-find-hook) -(make-variable-buffer-local 'ff-pre-load-hook) -(make-variable-buffer-local 'ff-post-load-hook) -(make-variable-buffer-local 'ff-not-found-hook) -(make-variable-buffer-local 'ff-file-created-hook) -(make-variable-buffer-local 'ff-case-fold-search) -(make-variable-buffer-local 'ff-always-in-other-window) -(make-variable-buffer-local 'ff-ignore-include) -(make-variable-buffer-local 'ff-quiet-mode) -(make-variable-buffer-local 'ff-other-file-alist) -(make-variable-buffer-local 'ff-search-directories) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; User entry points diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 3d686b4a777..0a72773549e 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -2008,9 +2008,9 @@ absolute pathname, it is assumed to be in the `mh-progs' directory. You may link another program to `scan' (see \"mh-profile(5)\") to produce a different type of listing." :type 'string + :local t :group 'mh-scan-line-formats :package-version '(MH-E . "6.0")) -(make-variable-buffer-local 'mh-scan-prog) ;;; Searching (:group 'mh-search) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index ee7b2ea34d8..04b5746eeae 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -109,8 +109,8 @@ can set the value for a particular mode using that mode's hook. Comments might be indented to a different value in order not to go beyond `comment-fill-column' or in order to align them with surrounding comments." :type 'integer + :local t :group 'comment) -(make-variable-buffer-local 'comment-column) ;;;###autoload (put 'comment-column 'safe-local-variable 'integerp) diff --git a/lisp/obsolete/rlogin.el b/lisp/obsolete/rlogin.el index f285165ba21..d875405ac8b 100644 --- a/lisp/obsolete/rlogin.el +++ b/lisp/obsolete/rlogin.el @@ -99,10 +99,9 @@ re-syncing of directories." :type '(choice (const :tag "off" nil) (const :tag "ftp" t) (other :tag "local" local)) + :local t :group 'rlogin) -(make-variable-buffer-local 'rlogin-directory-tracking-mode) - (defcustom rlogin-host nil "The name of the default remote host. This variable is buffer-local." :type '(choice (const nil) string) diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el index 56f166c10f1..805d2f93b9a 100644 --- a/lisp/play/decipher.el +++ b/lisp/play/decipher.el @@ -109,8 +109,8 @@ This variable must be set before typing `\\[decipher]'." You should set this to nil if the cipher message is divided into words, or t if it is not. This variable is buffer-local." - :type 'boolean) -(make-variable-buffer-local 'decipher-ignore-spaces) + :type 'boolean + :local t) (defcustom decipher-undo-limit 5000 "The maximum number of entries in the undo list. diff --git a/lisp/plstore.el b/lisp/plstore.el index db977cb6308..a33d6bca84c 100644 --- a/lisp/plstore.el +++ b/lisp/plstore.el @@ -236,6 +236,7 @@ If neither t nor nil, doesn't ask user." May either be a string or a list of strings. If it is nil, symmetric encryption will be used." :type '(choice (const nil) (repeat :tag "Recipient(s)" string)) + :local 'permanent-only :group 'plstore) ;;;###autoload @@ -250,7 +251,6 @@ symmetric encryption will be used." val) t))))) -(put 'plstore-encrypt-to 'permanent-local t) (defvar plstore-encoded nil "Non-nil if the current buffer shows the decoded alist.") ; [sic!] diff --git a/lisp/proced.el b/lisp/proced.el index 1d257b6bd4d..f99a6f74909 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -289,8 +289,8 @@ one, etc." It can be the car of an element of `proced-format-alist'. It can also be a list of keys appearing in `proced-grammar-alist'." :type '(choice (symbol :tag "Format Name") - (repeat :tag "Keys" (symbol :tag "")))) -(make-variable-buffer-local 'proced-format) + (repeat :tag "Keys" (symbol :tag ""))) + :local t) ;; FIXME: is there a better name for filter `user' that does not coincide ;; with an attribute key? @@ -335,8 +335,8 @@ of `proced-filter-alist'." (choice (cons :tag "Key . Regexp" (symbol :tag "Key") regexp) (cons :tag "Key . Function" (symbol :tag "Key") function) (cons :tag "Function" (const :tag "Key: function" function) function) - (cons :tag "Fun-all" (const :tag "Key: fun-all" fun-all) function))))) -(make-variable-buffer-local 'proced-filter) + (cons :tag "Fun-all" (const :tag "Key: fun-all" fun-all) function)))) + :local t) (defcustom proced-sort 'pcpu "Current sort scheme for proced listing. @@ -344,13 +344,13 @@ It must be the KEY of an element of `proced-grammar-alist'. It can also be a list of KEYs as in the SORT-SCHEMEs of the elements of `proced-grammar-alist'." :type '(choice (symbol :tag "Sort Scheme") - (repeat :tag "Key List" (symbol :tag "Key")))) -(make-variable-buffer-local 'proced-sort) + (repeat :tag "Key List" (symbol :tag "Key"))) + :local t) (defcustom proced-descend t "Non-nil if proced listing is sorted in descending order." - :type '(boolean :tag "Descending Sort Order")) -(make-variable-buffer-local 'proced-descend) + :type '(boolean :tag "Descending Sort Order") + :local t) (defcustom proced-goal-attribute 'args "If non-nil, key of the attribute that defines the `goal-column'." @@ -368,13 +368,13 @@ displayed in a window. Can be changed interactively via `proced-toggle-auto-update'." :type '(radio (const :tag "Don't auto update" nil) (const :tag "Only update visible proced buffers" visible) - (const :tag "Update all proced buffers" t))) -(make-variable-buffer-local 'proced-auto-update-flag) + (const :tag "Update all proced buffers" t)) + :local t) (defcustom proced-tree-flag nil "Non-nil for display of Proced buffer as process tree." - :type 'boolean) -(make-variable-buffer-local 'proced-tree-flag) + :type 'boolean + :local t) (defcustom proced-post-display-hook nil "Normal hook run after displaying or updating a Proced buffer. diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 0bd807859c7..00c3d5a5cbd 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -290,6 +290,7 @@ buffer). This corresponds to the g77 compiler option `-ffixed-line-length-N'." :type 'integer :safe 'integerp + :local t :initialize 'custom-initialize-default :set (lambda (_symbol value) ;; Do all fortran buffers, and the default. @@ -297,8 +298,6 @@ buffer). This corresponds to the g77 compiler option :version "23.1" :group 'fortran) -(make-variable-buffer-local 'fortran-line-length) - (defcustom fortran-mode-hook nil "Hook run when entering Fortran mode." :type 'hook diff --git a/lisp/shell.el b/lisp/shell.el index 14f073d6a61..965e6edcb37 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -432,8 +432,8 @@ interpreted as local file name on the remote host. If `shell-mode' is invoked in a local buffer, and no history file name can be determined, a default according to the shell type is used." :type '(choice (const :tag "Default" nil) (const :tag "Suppress" t) file) + :local 'permanent-only :version "30.1") -(put 'shell-history-file-name 'permanent-local t) ;;; Basic Procedures diff --git a/lisp/simple.el b/lisp/simple.el index 4fff24205be..e35cfe0479b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7704,8 +7704,8 @@ This has no effect when the variable `line-move-visual' is non-nil." A non-nil setting overrides the variable `line-move-visual', which see." :type '(choice integer (const :tag "None" nil)) + :local t :group 'editing-basics) -(make-variable-buffer-local 'goal-column) (defvar temporary-goal-column 0 "Current goal column for vertical motion. @@ -8989,8 +8989,8 @@ treated as delimiting words. See this command's namesake in Info node :type '(choice (const :tag "None" nil) string) :safe #'string-or-null-p + :local t :group 'fill) -(make-variable-buffer-local 'fill-prefix) (defcustom auto-fill-inhibit-regexp nil "Regexp to match lines that should not be auto-filled." diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 72dae9b678f..085ee9140f5 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -567,9 +567,8 @@ If nil, differences are highlighted using ASCII flags, ediff-before-flag and ediff-after-flag. On a non-window system, differences are always highlighted using ASCII flags." :type 'boolean + :local 'permanent :group 'ediff-highlighting) -(make-variable-buffer-local 'ediff-use-faces) -(put 'ediff-use-faces 'permanent-local t) ;; this indicates that diff regions are word-size, so fine diffs are ;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise @@ -611,9 +610,8 @@ reverses the meaning of this variable." Otherwise, all difference regions are highlighted, but the selected region is shown in brighter colors." :type 'boolean + :local 'permanent :group 'ediff-highlighting) -(make-variable-buffer-local 'ediff-highlight-all-diffs) -(put 'ediff-highlight-all-diffs 'permanent-local t) (ediff-defvar-local ediff-control-buffer-suffix nil @@ -1200,8 +1198,8 @@ save. Anything else means save automatically only if the merge job is part of a group of jobs, such as `ediff-merge-directory' or `ediff-merge-directory-revisions'." :type '(choice (const nil) (const t) (const group-jobs-only)) + :local t :group 'ediff-merge) -(make-variable-buffer-local 'ediff-autostore-merges) (ediff-defvar-local ediff-merge-store-file nil "File where the result of the merge is to be saved. Internal.") diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el index 606c23cb8aa..294880a4c49 100644 --- a/lisp/vc/ediff-merg.el +++ b/lisp/vc/ediff-merg.el @@ -73,9 +73,8 @@ STRING4" This means that regions that have status prefer-A or prefer-B will be skipped over. A value of nil means show all regions." :type 'boolean - :group 'ediff-merge - ) -(make-variable-buffer-local 'ediff-show-clashes-only) + :local t + :group 'ediff-merge) (defcustom ediff-skip-merge-regions-that-differ-from-default nil "If t, show only the regions that have not been changed by the user. @@ -87,9 +86,8 @@ A region is considered to have been changed also when it is marked as Buffer A or if it is marked as `prefer-B' and is different from the region in Buffer B." :type 'boolean - :group 'ediff-merge - ) -(make-variable-buffer-local 'ediff-skip-merge-regions-that-differ-from-default) + :local t + :group 'ediff-merge) (defvar state-of-merge) ; dynamic var commit bde00266db42213ca5da3fd8cde882c13b0dfdfb Author: Dmitry Gutov Date: Thu Oct 3 22:19:56 2024 +0300 help-setup-xref: Clean up xref backend before non-Lisp uses * lisp/help-mode.el (help-setup-xref): Kill more local variables, previously set in help-fns--setup-xref-backend (bug#69462). diff --git a/lisp/help-mode.el b/lisp/help-mode.el index e16408be7b0..b6757fcdbf1 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -518,7 +518,9 @@ restore it properly when going back." outline-minor-mode-highlight outline-minor-mode-use-buttons outline-default-state - outline-default-rules))) + outline-default-rules + xref-backend-functions + semantic-symref-filepattern-alist))) (when help-xref-stack-item (push (cons (point) help-xref-stack-item) help-xref-stack) (setq help-xref-forward-stack nil)) commit 4d43fbe3f5782f2efe3b325df87b65da026ef212 Author: Dmitry Gutov Date: Thu Oct 3 22:07:58 2024 +0300 ; Update a comment accordingly diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index ff80040382c..b841dc1d179 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -157,10 +157,10 @@ Line numbers start from 1 and columns from 0." (save-excursion (goto-char (point-min)) (ignore-errors - ;; xref location may be out of date; it may be past the - ;; end of the current file, or the file may have been - ;; deleted. Return a reasonable location; the user will - ;; figure it out. + ;; The location shouldn't be be out of date, but we make + ;; provision for that anyway; in case it's past the end of + ;; the file, or it had been deleted. Then return an + ;; approximation, the user will figure it out. (beginning-of-line line) (forward-char column)) (point-marker)))))) commit a9e36fc3bf811853e152e7ff427a39272cff1a80 Author: Dmitry Gutov Date: Thu Oct 3 22:03:09 2024 +0300 xref-location-marker: Use find-file-noselect to ensure uptodateness * lisp/progmodes/xref.el (xref-location-marker): Always call 'find-file-noselect' rather than 'get-file-buffer' to go through the visited-file-modtime verification every time. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 5ecb8664da0..ff80040382c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -150,9 +150,8 @@ Line numbers start from 1 and columns from 0." (cl-defmethod xref-location-marker ((l xref-file-location)) (pcase-let (((cl-struct xref-file-location file line column) l)) (with-current-buffer - (or (get-file-buffer file) - (let ((find-file-suppress-same-file-warnings t)) - (find-file-noselect file))) + (let ((find-file-suppress-same-file-warnings t)) + (find-file-noselect file)) (save-restriction (widen) (save-excursion commit ef587bf6b46b2ea3ef91b260ac2542666081260d Author: Stefan Monnier Date: Thu Oct 3 14:32:09 2024 -0400 track-changes.el: Improve error tracing to help debugging Add a new `trace` setting for `track-changes-record-errors` to record more information in order to try and help find the root cause of errors. * lisp/emacs-lisp/track-changes.el (track-changes--trace): New var. (track-changes-record-errors): Document new `trace` setting. (track-change--backtrace, track-changes--trace): New functions. (track-changes--recover-from-error): Use them. (track-changes--error-log): Document new format. (track-changes-register, track-changes-unregister) (track-changes-fetch, track-changes--before, track-changes--after): Call `track-changes--trace`. diff --git a/lisp/emacs-lisp/track-changes.el b/lisp/emacs-lisp/track-changes.el index 92d14959763..1b0f64f544d 100644 --- a/lisp/emacs-lisp/track-changes.el +++ b/lisp/emacs-lisp/track-changes.el @@ -170,6 +170,10 @@ More specifically it indicates which \"before\" they hold. "Current size of the buffer, as far as this library knows. This is used to try and detect cases where buffer modifications are \"lost\".") +(defvar track-changes--trace nil + "Ring holding a trace of recent calls to the API. +Each call is recorded as a (BUFFER-NAME . BACKTRACE).") + ;;;; Exposed API. (defvar track-changes-record-errors @@ -178,7 +182,8 @@ This is used to try and detect cases where buffer modifications are \"lost\".") ;; annoy the user too much about errors. (string-match "\\..*\\." emacs-version) "If non-nil, keep track of errors in `before/after-change-functions' calls. -The errors are kept in `track-changes--error-log'.") +The errors are kept in `track-changes--error-log'. +If set to `trace', then we additionally keep a trace of recent calls to the API.") (cl-defun track-changes-register ( signal &key nobefore disjoint immediate) "Register a new tracker whose change-tracking function is SIGNAL. @@ -213,6 +218,7 @@ and should thus be extra careful: don't modify the buffer, don't call a function that may block, do as little work as possible, ... When IMMEDIATE is non-nil, the SIGNAL should probably not always call `track-changes-fetch', since that would defeat the purpose of this library." + (track-changes--trace) (when (and nobefore disjoint) ;; FIXME: Without `before-change-functions', we can discover ;; a disjoint change only after the fact, which is not good enough. @@ -236,6 +242,7 @@ When IMMEDIATE is non-nil, the SIGNAL should probably not always call Trackers can consume resources (especially if `track-changes-fetch' is not called), so it is good practice to unregister them when you don't need them any more." + (track-changes--trace) (unless (memq id track-changes--trackers) (error "Unregistering a non-registered tracker: %S" id)) (setq track-changes--trackers (delq id track-changes--trackers)) @@ -270,6 +277,7 @@ This reflects a bug somewhere, so please report it when it happens. If no changes occurred since the last time, it doesn't call FUNC and returns nil, otherwise it returns the value returned by FUNC and re-enable the TRACKER corresponding to ID." + (track-changes--trace) (cl-assert (memq id track-changes--trackers)) (unless (equal track-changes--buffer-size (buffer-size)) (track-changes--recover-from-error @@ -387,6 +395,29 @@ returned to a consistent state." ;;;; Auxiliary functions. +(defun track-change--backtrace (n &optional base) + (let ((frames nil)) + (catch 'done + (mapbacktrace (lambda (&rest frame) + (if (>= (setq n (- n 1)) 0) + (push frame frames) + (push '... frames) + (throw 'done nil))) + (or base #'track-change--backtrace))) + (nreverse frames))) + +(defun track-changes--trace () + (when (eq 'trace track-changes-record-errors) + (require 'ring) + (declare-function ring-insert "ring" (ring item)) + (declare-function make-ring "ring" (size)) + (unless track-changes--trace + (setq track-changes--trace (make-ring 10))) + (ring-insert track-changes--trace + (cons (buffer-name) + (track-change--backtrace + 10 #'track-changes--trace))))) + (defun track-changes--clean-state () (cond ((null track-changes--state) @@ -442,7 +473,9 @@ returned to a consistent state." (defvar track-changes--error-log () "List of errors encountered. -Each element is a triplet (BUFFER-NAME BACKTRACE RECENT-KEYS).") +Each element is a tuple [BUFFER-NAME BACKTRACE RECENT-KEYS TRACE]. +where both RECENT-KEYS and TRACE are sorted oldest-first and +backtraces have the deepest frame first.") (defun track-changes--recover-from-error (&optional info) ;; We somehow got out of sync. This is usually the result of a bug @@ -453,14 +486,15 @@ Each element is a triplet (BUFFER-NAME BACKTRACE RECENT-KEYS).") (message "Recovering from confusing calls to `before/after-change-functions'!") (warn "Missing/incorrect calls to `before/after-change-functions'!! Details logged to `track-changes--error-log'") - (push (list (buffer-name) info - (let* ((bf (backtrace-frames - #'track-changes--recover-from-error)) - (tail (nthcdr 50 bf))) - (when tail (setcdr tail '...)) - bf) - (let ((rk (recent-keys 'include-cmds))) - (if (< (length rk) 20) rk (substring rk -20)))) + (push (vector (buffer-name) info + (track-change--backtrace + 50 #'track-changes--recover-from-error) + (let ((rk (recent-keys 'include-cmds))) + (if (< (length rk) 20) rk (substring rk -20))) + (when (and (eq 'trace track-changes-record-errors) + (fboundp 'ring-elements)) + (apply #'vector + (nreverse (ring-elements track-changes--trace))))) track-changes--error-log)) (setq track-changes--before-clean 'unset) (setq track-changes--buffer-size (buffer-size)) @@ -470,6 +504,7 @@ Details logged to `track-changes--error-log'") (setq track-changes--state (track-changes--state))) (defun track-changes--before (beg end) + (track-changes--trace) (cl-assert track-changes--state) (cl-assert (<= beg end)) (let* ((size (- end beg)) @@ -554,6 +589,7 @@ Details logged to `track-changes--error-log'") (buffer-substring-no-properties old-bend new-bend))))))))) (defun track-changes--after (beg end len) + (track-changes--trace) (cl-assert track-changes--state) (and (eq track-changes--before-clean 'unset) (not track-changes--before-no) commit 03a1e942c0b116b847832e5aa28e737547ea7f09 Author: Stefan Monnier Date: Thu Oct 3 13:43:25 2024 -0400 * doc/misc/eieio.texi (Writing Methods): Typo diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 039588b311d..ec1e6727ff8 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi @@ -812,7 +812,7 @@ You do it using Emacs Lisp's built-in support for CLOS-style generic functions via the @code{cl-defgeneric} and @code{cl-defmethod} macros (@pxref{Generic Functions,,,elisp,GNU Emacs Lisp Reference Manual}). -EIEIO provides one extension to @code{cl-defmethod} to allow mathods to +EIEIO provides one extension to @code{cl-defmethod} to allow methods to dispatch on a class argument: so-called ``static'' methods do not depend on an object instance, but instead operate on a class. You can create a static method by using the @code{subclass} specializer with commit 0894d3835e8f841045cc7cd9db2184cac35fcbb1 Author: Stefan Monnier Date: Thu Oct 3 11:55:58 2024 -0400 (key-translate-select): Minor tweaks * lisp/keymap.el (key-translate-select): Rename from `key-select-translation` so as to stick to the `key-translate-` prefix. Silence compilation warning. diff --git a/lisp/keymap.el b/lisp/keymap.el index b65f34f96bf..7a19621441c 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -424,7 +424,7 @@ Interactively, prompt for FROM and TO with `read-char'." (aref from-key 0) (and to (aref to-key 0))))) -(defun key-select-translation () +(defun key-translate-select () "Prompt for a current keyboard translation pair with `completing-read'. Each pair is formatted as \"FROM -> TO\". @@ -454,6 +454,7 @@ Return the \"FROM\" as a key string." (if (characterp chr) (funcall key-code-func chr trans) (require 'range) + (declare-function range-map "range" (func range)) (range-map (lambda (kc) (funcall key-code-func kc trans)) chr))) @@ -470,7 +471,7 @@ Return the \"FROM\" as a key string." FROM must satisfy `key-valid-p'. If FROM has no entry in `keyboard-translate-table', this has no effect." - (interactive (list (key-select-translation))) + (interactive (list (key-translate-select))) (key-translate from nil)) (defun keymap-lookup (keymap key &optional accept-default no-remap position) commit 3139ce7ad42ab883eee5189d6cb19612f525f491 Author: Hugo Heagren Date: Sun Aug 4 12:54:27 2024 +0100 Add commands to interactively set/unset keyboard translations * lisp/keymap.el (key-translate): Add an interactive form, prompting for keys to translate, and update docstring to reflect this. (key-translate-selection-function): New custom option. (key-select-translation): New function, default value of above option. (key-translate-remove): New command, for removing entries from `keyboard-translate-table'. diff --git a/etc/NEWS b/etc/NEWS index 15d5631e144..e4c1ef4eae0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -123,6 +123,11 @@ It is equivalent to running ‘project-any-command’ with ‘find-file’. * Editing Changes in Emacs 31.1 +** Commands for keyboard translation +`key-translate' is now interactive. It prompts for a key to translate +from, and another to translate to, and sets `keyboard-translate-table'. +The new command `key-translate-remove' prompts for a key/translation +pair with completing-read, and removes it from the translation table. ** Internationalization diff --git a/lisp/keymap.el b/lisp/keymap.el index 861d6724c9e..b65f34f96bf 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -392,9 +392,16 @@ This function creates a `keyboard-translate-table' if necessary and then modifies one entry in it. Both FROM and TO should be specified by strings that satisfy `key-valid-p'. -If TO is nil, remove any existing translation for FROM." +If TO is nil, remove any existing translation for FROM. + +Interactively, prompt for FROM and TO with `read-char'." (declare (compiler-macro (lambda (form) (keymap--compile-check from to) form))) + ;; Using `key-description' is a necessary evil here, so that the + ;; values can be passed to keymap-* functions, even though those + ;; functions immediately undo it with `key-parse'. + (interactive `(,(key-description `[,(read-char "From: ")]) + ,(key-description `[,(read-char "To: ")]))) (keymap--check from) (when to (keymap--check to)) @@ -417,6 +424,55 @@ If TO is nil, remove any existing translation for FROM." (aref from-key 0) (and to (aref to-key 0))))) +(defun key-select-translation () + "Prompt for a current keyboard translation pair with `completing-read'. + +Each pair is formatted as \"FROM -> TO\". + +Return the \"FROM\" as a key string." + (let* ((formatted-trans-alist nil) + ;; Alignment helpers + (pad 0) + (key-code-func + (lambda (kc trans) + (let* ((desc (key-description `[,kc])) + (len (length desc))) + (when (> len pad) + (setq pad len)) + (push + `(,desc . ,(key-description `[,trans])) + formatted-trans-alist)))) + (format-func + (lambda (pair) ;; (key . value) + (format + "%s -> %s" + (string-pad (key-description `[,(car pair)]) pad) + (key-description `[,(cdr pair)]))))) + ;; Set `pad' and `formatted-trans-alist' + (map-char-table + (lambda (chr trans) + (if (characterp chr) + (funcall key-code-func chr trans) + (require 'range) + (range-map + (lambda (kc) (funcall key-code-func kc trans)) + chr))) + keyboard-translate-table) + (car + (split-string + (completing-read + "Key Translation: " + (mapcar format-func formatted-trans-alist) + nil t))))) + +(defun key-translate-remove (from) + "Remove translation of FROM from `keyboard-translate-table'. + +FROM must satisfy `key-valid-p'. If FROM has no entry in +`keyboard-translate-table', this has no effect." + (interactive (list (key-select-translation))) + (key-translate from nil)) + (defun keymap-lookup (keymap key &optional accept-default no-remap position) "Return the binding for command KEY in KEYMAP. KEY is a string that satisfies `key-valid-p'. commit 042eee61ee2dee3732ffc8c4d30a75fa4751f844 Author: Michael Albinus Date: Thu Oct 3 16:41:40 2024 +0200 ; Fix last change in gitlab-ci.yml diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index b99fb878f02..de70e10870f 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -87,7 +87,7 @@ default: - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} -e EMACS_TEST_JUNIT_REPORT=${EMACS_TEST_JUNIT_REPORT} -e EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} -e NPROC=`nproc` --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -xvc "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j \$NPROC && make -k -j \$NPROC ${make_params}"' after_script: # - docker ps -a - ' - pwd; printenv + # - pwd; printenv # - test -n "$(docker ps -aq -f name=${test_name})" && ( docker export ${test_name} | tar -tvf - ) # Prepare test artifacts. - test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name} commit 8683d64cc571500347a16e7cb7d144d723250489 Author: Stefan Monnier Date: Thu Oct 3 10:25:13 2024 -0400 (help--symbol-completion-table): Try and fix bug#73473 * lisp/help-fns.el (help--symbol-completion-table): Be more careful with `help-enable-completion-autoload` so we don't load a package in cases where we already know it won't impact the result. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 40e589b3e0a..5cc8df6497f 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -206,9 +206,12 @@ type specifier when available." ,@(when completions-detailed '((affixation-function . help--symbol-completion-table-affixation))) (category . symbol-help)) - (when help-enable-completion-autoload + (when (and help-enable-completion-autoload + (memq action '(nil t lambda))) (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) - (help--load-prefixes prefixes))) + ;; Don't load FOO.el during `test-completion' of `FOO-'. + (unless (and (eq action 'lambda) (assoc string prefixes)) + (help--load-prefixes prefixes)))) (let ((prefix-completions (and help-enable-completion-autoload (mapcar #'intern (all-completions string definition-prefixes))))) commit b9ebacf40345977ddf18531cb1ebf0f6c56045ae Author: Andrea Corallo Date: Thu Oct 3 13:15:58 2024 +0200 * Fix few warnings in lisp/shell.el * lisp/shell.el (shell-highlight-undef-defined-face) (shell-highlight-undef-undefined-face) (shell-highlight-undef-alias-face): Unquote :inherit argument. diff --git a/lisp/shell.el b/lisp/shell.el index 4d92fe71df4..14f073d6a61 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1659,19 +1659,19 @@ Returns t if successful." :version "29.1") (defface shell-highlight-undef-defined-face - '((t :inherit 'font-lock-function-name-face)) + '((t :inherit font-lock-function-name-face)) "Face used for existing shell commands." :group 'shell :version "29.1") (defface shell-highlight-undef-undefined-face - '((t :inherit 'font-lock-warning-face)) + '((t :inherit font-lock-warning-face)) "Face used for non-existent shell commands." :group 'shell :version "29.1") (defface shell-highlight-undef-alias-face - '((t :inherit 'font-lock-variable-name-face)) + '((t :inherit font-lock-variable-name-face)) "Face used for shell command aliases." :group 'shell :version "29.1") commit abb932290dff3ad7456477a7401df01e3105336f Author: Andrea Corallo Date: Thu Oct 3 09:23:30 2024 +0200 * src/comp.c (compile_function, Fcomp__compile_ctxt_to_file0): Use DOHASH. diff --git a/src/comp.c b/src/comp.c index 44ab6b34939..cee2859c2eb 100644 --- a/src/comp.c +++ b/src/comp.c @@ -4340,11 +4340,9 @@ compile_function (Lisp_Object func) /* Pre-declare all basic blocks to gcc. The "entry" block must be declared as first. */ declare_block (Qentry); - Lisp_Object blocks = CALL1I (comp-func-blocks, func); - struct Lisp_Hash_Table *ht = XHASH_TABLE (blocks); - DOHASH_SAFE (ht, i) + struct Lisp_Hash_Table *ht = XHASH_TABLE (CALL1I (comp-func-blocks, func)); + DOHASH (ht, block_name, block) { - Lisp_Object block_name = HASH_KEY (ht, i); if (!EQ (block_name, Qentry)) declare_block (block_name); } @@ -4355,10 +4353,8 @@ compile_function (Lisp_Object func) gcc_jit_lvalue_as_rvalue (comp.func_relocs)); - DOHASH_SAFE (ht, i) + DOHASH (ht, block_name, block) { - Lisp_Object block_name = HASH_KEY (ht, i); - Lisp_Object block = HASH_VALUE (ht, i); Lisp_Object insns = CALL1I (comp-block-insns, block); if (NILP (block) || NILP (insns)) xsignal1 (Qnative_ice, @@ -4975,12 +4971,12 @@ DEFUN ("comp--compile-ctxt-to-file0", Fcomp__compile_ctxt_to_file0, struct Lisp_Hash_Table *func_h = XHASH_TABLE (CALL1I (comp-ctxt-funcs-h, Vcomp_ctxt)); - DOHASH_SAFE (func_h, i) - declare_function (HASH_VALUE (func_h, i)); + DOHASH (func_h, k, function) + declare_function (function); /* Compile all functions. Can't be done before because the relocation structs has to be already defined. */ - DOHASH_SAFE (func_h, i) - compile_function (HASH_VALUE (func_h, i)); + DOHASH (func_h, k, function) + compile_function (function); /* Work around bug#46495 (GCC PR99126). */ #if defined (WIDE_EMACS_INT) \ commit f985bab71bc58c51d9c9dad3bac78271de8d5290 Author: Andrea Corallo Date: Wed Oct 2 16:35:02 2024 +0200 * etc/TODO (Native compiler improvements): Add entry. diff --git a/etc/TODO b/etc/TODO index d37ca6646bb..756ce49e2a4 100644 --- a/etc/TODO +++ b/etc/TODO @@ -926,6 +926,12 @@ in the same CU don't have to go through funcall. If one of these functions is redefined, a trampoline is compiled and installed to restore the redirection through funcall. +**** Better runtime function inlining + +Several functions could be open-coded in generated code once exposed to +libgccjit. Two simple first candidates are probably 'maybe_quit' and +'maybe_gc'. + *** Features to be improved or missing **** Make use of function type declaration commit cc2ad5c2d1508236e79658936e7c7f532ddba586 Author: Sean Whitton Date: Thu Oct 3 18:36:45 2024 +0800 New M-~ entry in save-some-buffers-action-alist * lisp/files.el (save-some-buffers-action-alist): New M-~ entry. (save-some-buffers): * doc/emacs/files.texi (Save Commands): * etc/NEWS: Document the new M-~ binding during C-x s. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 0866e81233d..a7fef99c593 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -481,6 +481,9 @@ Terminate @code{save-some-buffers} without any more saving. @item . Save this buffer, then exit @code{save-some-buffers} without even asking about other buffers. +@item M-~ +Don't save this buffer, and also mark it as unmodified. +This is like the @code{not-modified} command (@pxref{Save Commands}). @item C-r View the buffer that you are currently being asked about. When you exit View mode, you get back to @code{save-some-buffers}, which asks the diff --git a/etc/NEWS b/etc/NEWS index abe316547aa..15d5631e144 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -166,6 +166,11 @@ You can now insert or wrap text with multiple sets of parentheses and other matching delimiters at once with Electric Pair mode, by providing a prefix argument when inserting one of the delimiters. ++++ +** You can now use M-~ during C-x s ('save-some-buffers'). +Typing M-~ while saving some buffers means not to save the buffer and +also to mark it as unmodified. This is an alternative way to mark a +buffer as unmodified which doesn't require switching to that buffer. * Changes in Specialized Modes and Packages in Emacs 31.1 diff --git a/lisp/files.el b/lisp/files.el index 58b5a26a492..c9889f3c765 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6150,7 +6150,13 @@ Before and after saving the buffer, this function runs (defvar save-some-buffers--switch-window-callback nil) (defvar save-some-buffers-action-alist - `((?\C-r + `((?\M-~ ,(lambda (buf) + (with-current-buffer buf + (set-buffer-modified-p nil)) + ;; Return t not to ask about BUF again. + t) + ,(purecopy "skip this buffer and mark it unmodified")) + (?\C-r ,(lambda (buf) (if (not enable-recursive-minibuffers) (progn (display-buffer buf) @@ -6257,7 +6263,8 @@ in variables (rather than in buffers).") (defun save-some-buffers (&optional arg pred) "Save some modified file-visiting buffers. Asks user about each one. -You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save, \\`C-r' +You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save, +\\`M-~' not to save and also mark the buffer as unmodified, \\`C-r' to look at the buffer in question with `view-buffer' before deciding, \\`d' to view the differences using `diff-buffer-with-file', \\`!' to save the buffer and all remaining commit 1aeec0db7d206e7664ba68fc5b6720f0535c2978 Merge: d5b02b7ad6f 748f76c5b32 Author: Eli Zaretskii Date: Thu Oct 3 13:34:40 2024 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit d5b02b7ad6fc67a10176a2ce56e14592252d3ed7 Author: Eli Zaretskii Date: Thu Oct 3 13:32:10 2024 +0300 Avoid assertion violations due to wrong 'min-width' property * src/xdisp.c (display_min_width): Ignore 'min-width' display specs which produce stretch glyphs wider than the window when lines are truncated. (Bug#73600) diff --git a/src/xdisp.c b/src/xdisp.c index 7883c579815..c74e81a3933 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5689,7 +5689,13 @@ display_min_width (struct it *it, ptrdiff_t charpos, XCAR (it->min_width_property), font, true, NULL); width -= it->current_x - it->min_width_start; - w = list1 (make_int (width)); + /* It makes no sense to try to obey min-width which yields + a stretch that ends beyond the visible portion of the + window if we are truncating screen lines. If we are + requested to do that, some Lisp program went awry. */ + if (!(it->line_wrap == TRUNCATE + && it->current_x + width > it->last_visible_x)) + w = list1 (make_int (width)); } else #endif @@ -5699,19 +5705,24 @@ display_min_width (struct it *it, ptrdiff_t charpos, NULL, true, NULL); width -= (it->current_x - it->min_width_start) / FRAME_COLUMN_WIDTH (it->f); - w = make_int (width); + if (!(it->line_wrap == TRUNCATE + && it->current_x + width > it->last_visible_x)) + w = make_int (width); } /* Insert the stretch glyph. */ - it->object = list3 (Qspace, QCwidth, w); - produce_stretch_glyph (it); - if (it->area == TEXT_AREA) + if (!NILP (w)) { - it->current_x += it->pixel_width; + it->object = list3 (Qspace, QCwidth, w); + produce_stretch_glyph (it); + if (it->area == TEXT_AREA) + { + it->current_x += it->pixel_width; - if (it->continuation_lines_width - && it->string_from_prefix_prop_p) - it->wrap_prefix_width = it->current_x; + if (it->continuation_lines_width + && it->string_from_prefix_prop_p) + it->wrap_prefix_width = it->current_x; + } } it->min_width_property = Qnil; } commit 748f76c5b325fe1e3c79f04d43a50af862944aa1 Author: Michael Albinus Date: Thu Oct 3 09:26:24 2024 +0200 ; Minor changes in gitlab-ci.yml * test/infra/gitlab-ci.yml (.job-template): Comment test prints. (.test-template): Adapt paths: diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 809e05b9d0e..b99fb878f02 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -87,8 +87,8 @@ default: - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} -e EMACS_TEST_JUNIT_REPORT=${EMACS_TEST_JUNIT_REPORT} -e EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} -e NPROC=`nproc` --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -xvc "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j \$NPROC && make -k -j \$NPROC ${make_params}"' after_script: # - docker ps -a - - pwd; printenv - - test -n "$(docker ps -aq -f name=${test_name})" && ( docker export ${test_name} | tar -tvf - ) + ' - pwd; printenv + # - test -n "$(docker ps -aq -f name=${test_name})" && ( docker export ${test_name} | tar -tvf - ) # Prepare test artifacts. - test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name} - test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/configure.log ${test_name} @@ -134,7 +134,7 @@ default: expire_in: 1 week when: always paths: - - "${test_name}/**.log" + - ${test_name}/ reports: junit: ${test_name}/${EMACS_TEST_JUNIT_REPORT}