commit 08540a29e30775092cf3dc7fc25f845bd34b913b (HEAD, refs/remotes/origin/master) Author: Lars Ingebrigtsen Date: Mon Sep 13 10:35:17 2021 +0200 package-menu-execute doc string clarification * lisp/emacs-lisp/package.el (package-menu-execute): Say what happens to upgrade-marked packages (bug#50551). diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 617e941dba..c6cb8f058b 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -3601,8 +3601,10 @@ packages list, respectively." (defun package-menu-execute (&optional noquery) "Perform marked Package Menu actions. -Packages marked for installation are downloaded and installed; -packages marked for deletion are removed. +Packages marked for installation are downloaded and installed, +packages marked for deletion are removed, +and packages marked for upgrading are downloaded and upgraded. + Optional argument NOQUERY non-nil means do not ask the user to confirm." (interactive nil package-menu-mode) (package--ensure-package-menu-mode) commit e8a28d756433e80fd622496eba65286ea0c4b895 Author: Lars Ingebrigtsen Date: Mon Sep 13 10:29:08 2021 +0200 * etc/NEWS: Clarify insert-into-buffer (bug#50558). diff --git a/etc/NEWS b/etc/NEWS index 8385128f69..c807c41325 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3683,8 +3683,7 @@ the current system. +++ ** New function 'insert-into-buffer'. -This is like 'insert-buffer-substring', but works in the opposite -direction. +This inserts the contents of the current buffer into another buffer. +++ ** New function 'json-available-p'. commit fd1379a85aafa77c119b9b7aa811f669c575bac7 Author: Juri Linkov Date: Mon Sep 13 11:14:32 2021 +0300 Support mouse events clicked on the tab bar but outside of any tab (bug#41343) * lisp/tab-bar.el (tab-bar--key-to-number): Return non-nil non-numeric t when no tab is used. Return nil for current-tab. (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab): Do nothing when tab-bar--key-to-number returns non-nil non-numeric t for click events outside of any tab. (tab-bar-mouse-context-menu): Add context menu when mouse is clicked outside of tabs. Add "Duplicate" alongside with "Close" to the menu used when mouse is clicked on a tab. (toggle-tab-bar-mode-from-frame, toggle-frame-tab-bar): Move code closer to 'tab-bar-show'. * src/xdisp.c (handle_tab_bar_click): Return Qtab_bar with empty list when mouse is clicked on the tab bar but outside of any tab. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 2684ff998b..e0eb62c887 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -113,7 +113,6 @@ For easier selection of tabs by their numbers, consider customizing :group 'tab-bar :version "27.1") - (defun tab-bar--define-keys () "Install key bindings for switching between tabs if the user has configured them." (when tab-bar-select-tab-modifiers @@ -224,10 +223,15 @@ a list of frames to update." (tab-bar--define-keys) (tab-bar--undefine-keys))) + +;;; Key bindings + (defun tab-bar--key-to-number (key) - (let ((key-name (format "%S" key))) - (when (string-prefix-p "tab-" key-name) - (string-to-number (string-replace "tab-" "" key-name))))) + (unless (eq key 'current-tab) + (let ((key-name (format "%S" key))) + (if (string-prefix-p "tab-" key-name) + (string-to-number (string-replace "tab-" "" key-name)) + t)))) (defun tab-bar--event-to-item (posn) (if (posn-window posn) @@ -246,37 +250,59 @@ a list of frames to update." (lambda (key binding) (when (eq (car-safe binding) 'menu-item) (when (> (+ column (length (nth 1 binding))) x-position) - (throw 'done (list - key (nth 2 binding) - (get-text-property - (- x-position column) 'close-tab (nth 1 binding))))) + (throw 'done (list key (nth 2 binding) + (get-text-property + (- x-position column) + 'close-tab (nth 1 binding))))) (setq column (+ column (length (nth 1 binding)))))) keymap)))))) (defun tab-bar-mouse-select-tab (event) (interactive "e") - (let ((item (tab-bar--event-to-item (event-start event)))) + (let* ((item (tab-bar--event-to-item (event-start event))) + (tab-number (tab-bar--key-to-number (nth 0 item)))) (if (nth 2 item) - (tab-bar-close-tab (tab-bar--key-to-number (nth 0 item))) + (unless (eq tab-number t) + (tab-bar-close-tab tab-number)) (if (functionp (nth 1 item)) (call-interactively (nth 1 item)) - (tab-bar-select-tab (tab-bar--key-to-number (nth 0 item))))))) + (unless (eq tab-number t) + (tab-bar-select-tab tab-number)))))) (defun tab-bar-mouse-close-tab (event) (interactive "e") - (let ((item (tab-bar--event-to-item (event-start event)))) - (tab-bar-close-tab (tab-bar--key-to-number (nth 0 item))))) + (let* ((item (tab-bar--event-to-item (event-start event))) + (tab-number (tab-bar--key-to-number (nth 0 item)))) + (unless (eq tab-number t) + (tab-bar-close-tab tab-number)))) (defun tab-bar-mouse-context-menu (event) (interactive "e") (let* ((item (tab-bar--event-to-item (event-start event))) (tab-number (tab-bar--key-to-number (nth 0 item))) - (menu (make-sparse-keymap "Context Menu"))) - - (define-key-after menu [close] - `(menu-item "Close" (lambda () (interactive) - (tab-bar-close-tab ,tab-number)) - :help "Close the tab")) + (menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))) + + (cond + ((eq tab-number t) + (define-key-after menu [new-tab] + '(menu-item "New tab" tab-bar-new-tab + :help "Create a new tab")) + (when tab-bar-closed-tabs + (define-key-after menu [undo-close] + '(menu-item "Reopen closed tab" tab-bar-undo-close-tab + :help "Undo closing the tab")))) + + (t + (define-key-after menu [duplicate-tab] + `(menu-item "Duplicate" (lambda () (interactive) + (tab-bar-duplicate-tab + nil ;; TODO: add ,tab-number + )) + :help "Duplicate the tab")) + (define-key-after menu [close] + `(menu-item "Close" (lambda () (interactive) + (tab-bar-close-tab ,tab-number)) + :help "Close the tab")))) (popup-menu menu event))) @@ -290,31 +316,6 @@ a list of frames to update." (event-end event)))))) (tab-bar-move-tab-to to from))) -(defun toggle-tab-bar-mode-from-frame (&optional arg) - "Toggle tab bar on or off, based on the status of the current frame. -Used in the Show/Hide menu, to have the toggle reflect the current frame. -See `tab-bar-mode' for more information." - (interactive (list (or current-prefix-arg 'toggle))) - (if (eq arg 'toggle) - (tab-bar-mode (if (> (frame-parameter nil 'tab-bar-lines) 0) 0 1)) - (tab-bar-mode arg))) - -(defun toggle-frame-tab-bar (&optional frame) - "Toggle tab bar of the selected frame. -When calling from Lisp, use the optional argument FRAME to toggle -the tab bar on that frame. -This is useful if you want to enable the tab bar individually -on each new frame when the global `tab-bar-mode' is disabled, -or if you want to disable the tab bar individually on each -new frame when the global `tab-bar-mode' is enabled, by using - - (add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)" - (interactive) - (set-frame-parameter frame 'tab-bar-lines - (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1)) - (set-frame-parameter frame 'tab-bar-lines-keep-state - (not (frame-parameter frame 'tab-bar-lines-keep-state)))) - (defvar tab-bar-map (let ((map (make-sparse-keymap))) (define-key map [down-mouse-1] 'tab-bar-mouse-select-tab) @@ -351,6 +352,32 @@ Its main job is to show tabs in the tab bar and to bind mouse events to the commands." (tab-bar-make-keymap-1)) + +(defun toggle-tab-bar-mode-from-frame (&optional arg) + "Toggle tab bar on or off, based on the status of the current frame. +Used in the Show/Hide menu, to have the toggle reflect the current frame. +See `tab-bar-mode' for more information." + (interactive (list (or current-prefix-arg 'toggle))) + (if (eq arg 'toggle) + (tab-bar-mode (if (> (frame-parameter nil 'tab-bar-lines) 0) 0 1)) + (tab-bar-mode arg))) + +(defun toggle-frame-tab-bar (&optional frame) + "Toggle tab bar of the selected frame. +When calling from Lisp, use the optional argument FRAME to toggle +the tab bar on that frame. +This is useful if you want to enable the tab bar individually +on each new frame when the global `tab-bar-mode' is disabled, +or if you want to disable the tab bar individually on each +new frame when the global `tab-bar-mode' is enabled, by using + + (add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)" + (interactive) + (set-frame-parameter frame 'tab-bar-lines + (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1)) + (set-frame-parameter frame 'tab-bar-lines-keep-state + (not (frame-parameter frame 'tab-bar-lines-keep-state)))) + (defcustom tab-bar-show t "Defines when to show the tab bar. @@ -1224,8 +1251,7 @@ where argument addressing is absolute." (defun tab-bar-duplicate-tab (&optional arg) "Duplicate the current tab to ARG positions to the right. -If a negative ARG, duplicate the tab to ARG positions to the left. -If ARG is zero, duplicate the tab in place of the current tab." +ARG has the same meaning as in `tab-bar-new-tab'." (interactive "P") (let ((tab-bar-new-tab-choice nil) (tab-bar-new-tab-group t)) diff --git a/src/xdisp.c b/src/xdisp.c index 45c7090fc0..d30a68570f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13774,7 +13774,7 @@ handle_tab_bar_click (struct frame *f, int x, int y, bool down_p, frame_to_window_pixel_xy (w, &x, &y); ts = get_tab_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx, &close_p); if (ts == -1) - return Qnil; + return Fcons (Qtab_bar, Qnil); /* If item is disabled, do nothing. */ enabled_p = AREF (f->tab_bar_items, prop_idx + TAB_BAR_ITEM_ENABLED_P); commit 4ee8b4d225176191bc0778ab9cbe5bb481d4704c Author: Lars Ingebrigtsen Date: Mon Sep 13 10:03:24 2021 +0200 Only do multi-isearch in eww if there's next/prev links * lisp/net/eww.el (eww-handle-link): Only do multi-isearch if there's a next/prev link in the HTML (bug#50497). (eww-setup-buffer): Clear the function. (eww-mode): Don't set it here. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 62f19925f6..16a13bbaae 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -668,9 +668,12 @@ Currently this means either text/html or application/xhtml+xml." ("home" . :home) ("contents" . :contents) ("up" . :up))))) - (and href - where - (plist-put eww-data (cdr where) href)))) + (when (and href where) + (when (memq (cdr where) '(:next :previous)) + ;; Multi-page isearch support. + (setq-local multi-isearch-next-buffer-function + #'eww-isearch-next-buffer)) + (plist-put eww-data (cdr where) href)))) (defvar eww-redirect-level 1) @@ -840,6 +843,8 @@ Currently this means either text/html or application/xhtml+xml." (remove-overlays) (erase-buffer)) (setq bidi-paragraph-direction nil) + ;; May be set later if there's a next/prev link. + (setq-local multi-isearch-next-buffer-function nil) (unless (eq major-mode 'eww-mode) (eww-mode))) @@ -1080,8 +1085,6 @@ the like." (setq-local tool-bar-map eww-tool-bar-map)) ;; desktop support (setq-local desktop-save-buffer #'eww-desktop-misc-data) - ;; multi-page isearch support - (setq-local multi-isearch-next-buffer-function #'eww-isearch-next-buffer) (setq truncate-lines t) (setq-local thing-at-point-provider-alist (append thing-at-point-provider-alist commit bb446c1d968f15c34c74e90f9319c3069bd6e025 Author: Juri Linkov Date: Mon Sep 13 10:58:44 2021 +0300 Change value of DEFAULT_TAB_BAR_BUTTON_MARGIN from 4 to 1 (bug#50424) diff --git a/src/dispextern.h b/src/dispextern.h index f4c7575b35..6aefe43e19 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3202,7 +3202,7 @@ enum tab_bar_item_idx /* Default values of the above variables. */ -#define DEFAULT_TAB_BAR_BUTTON_MARGIN 4 +#define DEFAULT_TAB_BAR_BUTTON_MARGIN 1 #define DEFAULT_TAB_BAR_BUTTON_RELIEF 1 /* The height in pixels of the default tab-bar images. */ commit 381253b7b16bda29a9cc173e7417fb9938f3c39a Author: Juri Linkov Date: Mon Sep 13 10:56:51 2021 +0300 * doc/emacs/frames.texi (Tab Bars): Improve documentation. diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index e238966428..06e2642638 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1285,7 +1285,8 @@ displayed by moving the mouse pointer to the top of the screen. On graphical displays and on text terminals, Emacs can optionally display a @dfn{Tab Bar} at the top of each frame, just below the menu -bar (@pxref{Menu Bars}) and above the tool bar (@pxref{Tool Bars}). +bar (@pxref{Menu Bars}) and above or below the tool bar (@pxref{Tool +Bars}) depending on the variable @code{tab-bar-position}. The Tab Bar is a row of @dfn{tabs}---buttons that you can click to switch between window configurations. @@ -1448,9 +1449,10 @@ with a negative argument @minus{}@var{n}, it switches to the @findex tab-switch @item C-x t @key{RET} @var{tabname} @key{RET} Switch to the tab by its name (@code{tab-switch}), with completion on -all tab names. History of used tab names is sorted by recency, so you -can use @kbd{M-n} (@code{next-history-element}) to get the name of the -last visited tab, the second last, and so on. +all tab names. The default value and the ``future history'' of tab +names is sorted by recency, so you can use @kbd{M-n} +(@code{next-history-element}) to get the name of the last visited tab, +the second last, and so on. @kindex C-1, tab bar @kindex C-9, tab bar @@ -1464,11 +1466,12 @@ Switch to the tab by its number @var{tab-number} (@code{tab-select}). After customizing the variable @code{tab-bar-select-tab-modifiers} to specify one or more @var{modifier} keys, you can select a tab by its ordinal number using one of the specified modifiers in combination -with the tab number to select. You can select any modifiers supported -by Emacs, @pxref{Modifier Keys}. To display the tab number alongside -the tab name, you can customize another variable -@code{tab-bar-tab-hints}. This will help you decide which numerical -key to press to select the tab by its number. +with the tab number to select. The number 9 can be used to select the +last tab. You can select any modifiers supported by Emacs, +@pxref{Modifier Keys}. To display the tab number alongside the tab +name, you can customize another variable @code{tab-bar-tab-hints}. +This will help you decide which numerical key to press to select the +tab by its number. @kindex C-0, tab bar @kindex M-0, tab bar commit 173c2ea8a39fbc10533c3fb390f66af302b23977 Author: Lars Ingebrigtsen Date: Mon Sep 13 09:39:45 2021 +0200 Fix detection of char regions in print-fontset-element * lisp/international/mule-diag.el (print-fontset-element): Fix the regexp for "foo .. bar " (bug#50519). diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 864cd3ce01..862c577bd5 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -882,7 +882,7 @@ The IGNORED argument is ignored." ;; the current line. (beginning-of-line) (let ((from (mule--kbd-at (point))) - (to (if (looking-at "[^.]*[.]* ") + (to (if (looking-at "[^.]+[.][.] ") (mule--kbd-at (match-end 0))))) (if (re-search-forward "[ \t]*$" nil t) (delete-region (match-beginning 0) (match-end 0))) commit c1a13395260ac5d06b5cf4c75aa318653db6f812 Author: Lars Ingebrigtsen Date: Mon Sep 13 09:24:46 2021 +0200 Add some search-whitespace-regexp examples * lisp/isearch.el (search-whitespace-regexp): Add some alternatives in the defcustom. diff --git a/lisp/isearch.el b/lisp/isearch.el index efa7db6fe9..bebc80adb3 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -133,6 +133,8 @@ tab, a carriage return (control-M), a newline, and `]+'. Don't add any capturing groups into this value; that can change the numbering of existing capture groups in unexpected ways." :type '(choice (const :tag "Match Spaces Literally" nil) + (const :tag "Tabs and spaces" "[ \t]+") + (const :tag "Tabs, spaces and line breaks" "[ \t\n]+") regexp) :version "28.1") commit d15c430a8449fc09766f76d06f538cd44d1b3a8d Author: Lars Ingebrigtsen Date: Mon Sep 13 09:20:21 2021 +0200 Mention get-byte in shortdoc * lisp/emacs-lisp/shortdoc.el (buffer): Mention `get-byte' here. diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 7d4a69f42a..adee6be379 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -889,6 +889,9 @@ There can be any number of :example/:result elements." :eg-result 67) (char-after :eval (char-after 45)) + (get-byte + :no-eval (get-byte 45) + :eg-result-string "#xff") "Altering Buffers" (delete-region :no-value (delete-region (point-min) (point-max))) commit 8454566b765c4012f0039d258bdd172de9f867f9 Author: Tassilo Horn Date: Mon Sep 13 07:22:50 2021 +0200 bug-reference.el: Adapt default debbugs bug regexp for IRC modes * lisp/progmodes/bug-reference.el (bug-reference-setup-from-irc-alist): Adapt regexp so that group 1 defines overlay region. diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 96dc2044e7..b646a47c85 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -531,7 +531,7 @@ From, and Cc against HEADER-REGEXP in `((,(concat "#" (regexp-opt '("emacs" "gnus" "org-mode" "rcirc" "erc") 'words)) "Libera.Chat" - "\\([Bb]ug ?#?\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)" + "\\([Bb]ug ?#?\\([0-9]+\\(?:#[0-9]+\\)?\\)\\)" "https://debbugs.gnu.org/%s")) "An alist for setting up `bug-reference-mode' in IRC modes. commit 7fe756c014c4150f7c96cd99d490c18c38de51b8 Author: Tassilo Horn Date: Mon Sep 13 07:11:05 2021 +0200 bug-reference.el: Adapt default debbugs bug regexp for mail modes * lisp/progmodes/bug-reference.el (bug-reference-setup-from-mail-alist): Adapt regexp so that group 1 defines overlay region. diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 54d4b14165..96dc2044e7 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -400,7 +400,7 @@ applicable." ,(regexp-opt '("@debbugs.gnu.org" "-devel@gnu.org" ;; List-Id of Gnus devel mailing list. "ding.gnus.org")) - "\\([Bb]ug ?#?\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)" + "\\([Bb]ug ?#?\\([0-9]+\\(?:#[0-9]+\\)?\\)\\)" "https://debbugs.gnu.org/%s")) "An alist for setting up `bug-reference-mode' in mail modes. commit fc6ed9a721e843e716e9ce144d4c1de49d329bd4 Author: Stefan Kangas Date: Mon Sep 13 06:29:54 2021 +0200 Declare unused function cperl-inside-parens-p obsolete * lisp/progmodes/cperl-mode.el (cperl-inside-parens-p): Declare unused function obsolete. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 8e32c5a4b7..76c82f8c73 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -2475,7 +2475,8 @@ Will untabify if `cperl-electric-backspace-untabify' is non-nil." (put 'cperl-electric-backspace 'delete-selection 'supersede) -(defun cperl-inside-parens-p () ;; NOT USED???? +(defun cperl-inside-parens-p () + (declare (obsolete nil "28.1")) ; not used (condition-case () (save-excursion (save-restriction commit f02624b34201aae3d69287e5ae86d466e5c4a6b3 Author: Stefan Kangas Date: Mon Sep 13 06:04:32 2021 +0200 ; Minor doc fixes found by checkdoc diff --git a/lisp/dnd.el b/lisp/dnd.el index e641b2843a..44316154b0 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -77,7 +77,7 @@ and is the default except for MS-Windows." (defcustom dnd-open-file-other-window nil - "If non-nil, always use find-file-other-window to open dropped files." + "If non-nil, always use `find-file-other-window' to open dropped files." :version "22.1" :type 'boolean) diff --git a/lisp/files.el b/lisp/files.el index 7e4bdab507..67c4628468 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1108,7 +1108,7 @@ customize the variable `user-emacs-directory-warning'." (defun exec-path () "Return list of directories to search programs to run in remote subprocesses. The remote host is identified by `default-directory'. For remote -hosts that do not support subprocesses, this returns `nil'. +hosts that do not support subprocesses, this returns nil. If `default-directory' is a local directory, this function returns the value of the variable `exec-path'." (let ((handler (find-file-name-handler default-directory 'exec-path))) diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el index 7ba8a69775..2cc8dfce66 100644 --- a/lisp/progmodes/bat-mode.el +++ b/lisp/progmodes/bat-mode.el @@ -175,7 +175,7 @@ ;;;###autoload (define-derived-mode bat-mode prog-mode "Bat" - "Major mode for editing DOS/Windows batch files.\n + "Major mode for editing DOS/Windows batch files. Start a new script from `bat-template'. Read help pages for DOS commands with `bat-cmd-help'. Navigate between sections using `imenu'. Run script using `bat-run' and `bat-run-args'.\n diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index a596b27cd0..54d4b14165 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -651,7 +651,7 @@ guesswork is based on these variables: "Enable `bug-reference-mode' and force auto-setup. Enabling `bug-reference-mode' runs its auto-setup only if `bug-reference-bug-regexp' and `bug-reference-url-format' are not -set already. This function sets the latter to `nil' +set already. This function sets the latter to nil buffer-locally, so that the auto-setup will always run. This is mostly intended for MUA modes like `rmail-mode' where the diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index 4649e50654..53914616cd 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el @@ -47,8 +47,8 @@ ;; (add-hook 'cfengine3-mode-hook 'eldoc-mode) ;; You may also find the command `cfengine3-reformat-json-string' -;; useful, just bind it to a key you prefer. It will take the current -;; string and reformat it as JSON. So if you're editing JSON inside +;; useful, just bind it to a key you prefer. It will take the current +;; string and reformat it as JSON. So if you're editing JSON inside ;; the policy, it's a quick way to make it more legible without ;; manually reindenting it. For instance: @@ -140,8 +140,7 @@ bundle agent rcfiles \"/tmp/netrc\" comment => \"my netrc\", perms => mog(\"600\", \"tzz\", \"tzz\"); -} -" +}" :version "24.4" :type '(list (choice (const :tag "Anchor at beginning of promise" promise) @@ -1193,7 +1192,7 @@ Intended as the value of `indent-line-function'." ;; CATEGORY: [a-zA-Z_]+: (defun cfengine3--current-function () - "Look up current CFEngine 3 function" + "Look up current CFEngine 3 function." (let* ((syntax (cfengine3-make-syntax-cache)) (flist (assq 'functions syntax))) (when flist diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index af7b8292b7..8d1486b6e6 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -86,7 +86,7 @@ This is bound before running `compilation-filter-hook'.") "This is how compilers number the first column, usually 1 or 0. If this is buffer-local in the destination buffer, Emacs obeys that value, otherwise it uses the value in the *compilation* -buffer. This enables a major-mode to specify its own value.") +buffer. This enables a major mode to specify its own value.") (defvar compilation-parse-errors-filename-function #'identity "Function to call to post-process filenames while parsing error messages. @@ -752,7 +752,7 @@ program and Emacs agree about the display width of the characters, especially the TAB character. If this is buffer-local in the destination buffer, Emacs obeys that value, otherwise it uses the value in the *compilation* -buffer. This enables a major-mode to specify its own value." +buffer. This enables a major mode to specify its own value." :type 'boolean :version "20.4") @@ -2767,7 +2767,7 @@ Actual value is never used, only the text property.") (set-window-margins w (- (car (window-margins w)) 2)))) (defun compilation--set-up-arrow-spec-in-margins () - "Set up compilation-arrow-overlay to display as an arrow in margins." + "Set up `compilation-arrow-overlay' to display as an arrow in margins." (setq overlay-arrow-string "") (setq compilation-arrow-overlay (make-overlay overlay-arrow-position overlay-arrow-position)) @@ -2780,7 +2780,7 @@ Actual value is never used, only the text property.") #'compilation--tear-down-arrow-spec-in-margins nil t)) (defun compilation--tear-down-arrow-spec-in-margins () - "Restore compilation-arrow-overlay to not using the margins, which are removed." + "Restore `compilation-arrow-overlay' to not using the margins, which are removed." (when (overlayp compilation-arrow-overlay) (overlay-put compilation-arrow-overlay 'before-string nil) (delete-overlay compilation-arrow-overlay) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 165834cc20..8e32c5a4b7 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -312,8 +312,7 @@ own abbrevs in cperl-mode, but do not want keywords to be electric, you must redefine `cperl-mode-abbrev-table': do \\[edit-abbrevs], search for `cperl-mode-abbrev-table', and, in that paragraph, delete the words that appear at the ends of lines and -that begin with \"cperl-electric\". -" +that begin with \"cperl-electric\"." :type '(choice (const null) boolean) :group 'cperl-affected-by-hairy) @@ -767,8 +766,7 @@ line-breaks/spacing between elements of the construct. 10) Uses a linear-time algorithm for indentation of regions. -11) Syntax-highlight, indentation, sexp-recognition inside regular expressions. -") +11) Syntax-highlight, indentation, sexp-recognition inside regular expressions.") (defvar cperl-speed 'please-ignore-this-line "This is an incomplete compendium of what is available in other parts @@ -865,9 +863,7 @@ In regular expressions (including character classes): backslashes of escape sequences `font-lock-variable-name-face' Interpolated constructs, embedded code, POSIX classes (inside charclasses) - `font-lock-comment-face' Embedded comments - -") + `font-lock-comment-face' Embedded comments") @@ -1452,7 +1448,7 @@ the last)." (defvar cperl-outline-regexp (rx (sequence line-start (0+ blank) (eval cperl--imenu-entries-rx))) - "The regular expression used for outline-minor-mode") + "The regular expression used for `outline-minor-mode'.") (defvar cperl-mode-syntax-table nil "Syntax table in use in CPerl mode buffers.") @@ -4840,7 +4836,7 @@ recursive calls in starting lines of here-documents." ;; Moreover, one takes positive approach (looks for else,grep etc) ;; another negative (looks for bless,tr etc) (defun cperl-after-block-p (lim &optional pre-block) - "Return true if the preceding } (if PRE-BLOCK, following {) delimits a block. + "Return non-nil if the preceding } (if PRE-BLOCK, following {) delimits a block. Would not look before LIM. Assumes that LIM is a good place to begin a statement. The kind of block we treat here is one after which a new statement would start; thus the block in ${func()} does not count." @@ -4876,7 +4872,7 @@ statement would start; thus the block in ${func()} does not count." (error nil)))) (defun cperl-after-expr-p (&optional lim chars test) - "Return true if the position is good for start of expression. + "Return non-nil if the position is good for start of expression. TEST is the expression to evaluate at the found position. If absent, CHARS is a string that contains good characters to have before us (however, `}' is treated \"smartly\" if it is not in the list)." @@ -4972,7 +4968,7 @@ CHARS is a string that contains good characters to have before us (however, (skip-chars-forward " \t")) (defun cperl-after-block-and-statement-beg (lim) - "Return true if the preceding ?} ends the statement." + "Return non-nil if the preceding ?} ends the statement." ;; We assume that we are after ?\} (and (cperl-after-block-p lim) @@ -5620,7 +5616,7 @@ comment, or POD." (defvar cperl-font-lock-keywords nil "Additional expressions to highlight in Perl mode. Default set.") (defvar cperl-font-lock-keywords-2 nil - "Additional expressions to highlight in Perl mode. Maximal set") + "Additional expressions to highlight in Perl mode. Maximal set.") (defun cperl-load-font-lock-keywords () (or cperl-faces-init (cperl-init-faces)) @@ -5635,10 +5631,10 @@ comment, or POD." cperl-font-lock-keywords-2) (defun cperl-font-lock-syntactic-face-function (state) - "Apply faces according to their syntax type. In CPerl mode, this -is used for here-documents which have been marked as c-style -comments. For everything else, delegate to the default -function." + "Apply faces according to their syntax type. +In CPerl mode, this is used for here-documents which have been +marked as c-style comments. For everything else, delegate to the +default function." (cond ;; A c-style comment is a HERE-document. Fontify if requested. ((and (eq 2 (nth 7 state)) @@ -6251,7 +6247,7 @@ side-effect of memorizing only. Examples in `cperl-style-examples'." (filename nodename &optional no-going-back strict-case)) (defun cperl-info-buffer (type) - ;; Returns buffer with documentation. Creates if missing. + ;; Return buffer with documentation. Creates if missing. ;; If TYPE, this vars buffer. ;; Special care is taken to not stomp over an existing info buffer (let* ((bname (if type "*info-perl-var*" "*info-perl*")) @@ -6385,7 +6381,7 @@ Customized by setting variables `cperl-shrink-wrap-info-frame', (declare-function imenu-choose-buffer-index "imenu" (&optional prompt alist)) (defun cperl-imenu-on-info () - "Shows imenu for Perl Info Buffer. + "Show imenu for Perl Info Buffer. Opens Perl Info buffer if needed." (interactive) (require 'imenu) @@ -6733,8 +6729,7 @@ Does not move point." "Add to TAGS data for \"pure\" Perl files in the current directory and kids. Use as emacs -batch -q -no-site-file -l emacs/cperl-mode.el \\ - -f cperl-add-tags-recurse-noxs -" + -f cperl-add-tags-recurse-noxs" (cperl-write-tags nil nil t t nil t)) (defun cperl-add-tags-recurse-noxs-fullpath () @@ -6742,16 +6737,14 @@ Use as Writes down fullpath, so TAGS is relocatable (but if the build directory is relocated, the file TAGS inside it breaks). Use as emacs -batch -q -no-site-file -l emacs/cperl-mode.el \\ - -f cperl-add-tags-recurse-noxs-fullpath -" + -f cperl-add-tags-recurse-noxs-fullpath" (cperl-write-tags nil nil t t nil t "")) (defun cperl-add-tags-recurse () "Add to TAGS file data for Perl files in the current directory and kids. Use as emacs -batch -q -no-site-file -l emacs/cperl-mode.el \\ - -f cperl-add-tags-recurse -" + -f cperl-add-tags-recurse" (cperl-write-tags nil nil t t)) (defvar cperl-tags-file-name "TAGS" @@ -7735,11 +7728,10 @@ prototype \\&SUB Returns prototype of the function given a reference. =begin formatname Start directly formatted region. =end formatname End directly formatted region. =for formatname text Paragraph in special format. -=encoding encodingname Encoding of the document. -") +=encoding encodingname Encoding of the document.") (defun cperl-switch-to-doc-buffer (&optional interactive) - "Go to the perl documentation buffer and insert the documentation." + "Go to the Perl documentation buffer and insert the documentation." (interactive "p") (let ((buf (get-buffer-create cperl-doc-buffer))) (if interactive diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 6ad55fc142..052a68547b 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -1165,7 +1165,7 @@ Please send all bug fixes and enhancements to ;;; Interface to the command system (defgroup postscript nil - "Printing with PostScript" + "Printing with PostScript." :tag "PostScript" :version "20" :group 'environment) diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index 7524c280f2..ab0329d7ee 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -3062,7 +3062,7 @@ the first derived class." (easy-menu-define ebrowse-member-name-object-menu ebrowse-member-mode-map - "Object menu for member names" + "Object menu for member names." '("Ebrowse" ["Find Definition" ebrowse-find-member-definition :help "Find this member's definition in the source files" @@ -4200,7 +4200,7 @@ EVENT is the mouse event." (easy-menu-define ebrowse-tree-buffer-class-object-menu ebrowse-tree-mode-map - "Object menu for classes in the tree buffer" + "Object menu for classes in the tree buffer." '("Class" ["Functions" ebrowse-tree-command:show-member-functions :help "Display a list of member functions" @@ -4242,7 +4242,7 @@ EVENT is the mouse event." (easy-menu-define ebrowse-tree-buffer-object-menu ebrowse-tree-mode-map - "Object menu for tree buffers" + "Object menu for tree buffers." '("Ebrowse" ["Filename Display" ebrowse-toggle-file-name-display :help "Toggle display of source files names" diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index cc12fce04a..5879bce2a7 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -626,7 +626,7 @@ associated `flymake-category' return DEFAULT." (list bitmap))))))) (defun flymake--highlight-line (diagnostic) - "Highlight buffer with info in DIGNOSTIC." + "Highlight buffer with info in DIAGNOSTIC." (let ((type (or (flymake--diag-type diagnostic) :error)) (ov (make-overlay @@ -973,7 +973,7 @@ Interactively, with a prefix arg, FORCE is t." (defvar flymake-mode-map (let ((map (make-sparse-keymap))) map) - "Keymap for `flymake-mode'") + "Keymap for `flymake-mode'.") ;;;###autoload (define-minor-mode flymake-mode diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index a2f5d7286a..7cd49a69d4 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -531,7 +531,7 @@ that form should be displayed.") ((bound-and-true-p semantic-c-takeover-hideif) (semantic-c-hideif-defined var)) ;; Here we can't use hif-lookup as an empty definition like `#define EMPTY' - ;; is considered defined but is evaluated as `nil'. + ;; is considered defined but is evaluated as nil. ((assq var hide-ifdef-env) 1) ((and (setq def (assq var hif-predefine-alist)) (funcall (cdr def))) 1) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index d57f2d5493..9f123dc816 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1156,7 +1156,7 @@ by `css--colors-regexp'. START-POINT is the start of the color, and MATCH is the string matched by the regexp. This function will either return the color, as a hex RGB string; -or `nil' if no color could be recognized. When this function +or nil if no color could be recognized. When this function returns, point will be at the end of the recognized color." (cond ((eq (aref match 0) ?#) @@ -1170,7 +1170,7 @@ returns, point will be at the end of the recognized color." (defcustom css-fontify-colors t "Whether CSS colors should be fontified using the color as the background. -When non-`nil', a text representing CSS color will be fontified +When non-nil, a text representing CSS color will be fontified such that its background is the color itself. E.g., #ff0000 will be fontified with a red background." :version "26.1" diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el index 877658a5a5..c650da43bf 100644 --- a/lisp/textmodes/enriched.el +++ b/lisp/textmodes/enriched.el @@ -34,7 +34,7 @@ ;; A separate file, enriched.txt, contains further documentation and other ;; important information about this code. It also serves as an example ;; file in text/enriched format. It should be in the etc directory of your -;; emacs distribution. +;; Emacs distribution. ;;; Code: diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 423f37762c..9b3211df57 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -546,7 +546,7 @@ in your init file. (custom-add-option 'text-mode-hook 'turn-on-flyspell) (defvar flyspell-buffers nil - "For remembering buffers running flyspell") + "For remembering buffers running flyspell.") (make-obsolete-variable 'flyspell-buffers "not used." "28.1") ;;*---------------------------------------------------------------------*/ @@ -702,8 +702,8 @@ has been used, the current word is not checked." ;;* has to be spell checked. */ ;;*---------------------------------------------------------------------*/ (defvar flyspell-pre-buffer nil "Buffer current before `this-command'.") -(defvar flyspell-pre-point nil "Point before running `this-command'") -(defvar flyspell-pre-column nil "Column before running `this-command'") +(defvar flyspell-pre-point nil "Point before running `this-command'.") +(defvar flyspell-pre-column nil "Column before running `this-command'.") (defvar flyspell-pre-pre-buffer nil) (defvar flyspell-pre-pre-point nil) (make-variable-buffer-local 'flyspell-pre-point) ;Why?? --Stef @@ -1746,7 +1746,7 @@ FLYSPELL-BUFFER." ;;* flyspell-overlay-p ... */ ;;*---------------------------------------------------------------------*/ (defun flyspell-overlay-p (o) - "Return true if O is an overlay used by flyspell." + "Return non-nil if O is an overlay used by flyspell." (and (overlayp o) (overlay-get o 'flyspell-overlay))) ;;*---------------------------------------------------------------------*/ diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 3b9f1d3512..0d95b4c115 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -60,7 +60,7 @@ ;; `a': Accept word for this session. ;; `A': Accept word and place in buffer-local dictionary. ;; `r': Replace word with typed-in value. Rechecked. -;; `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked. +;; `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked. ;; `?': Show these commands ;; `x': Exit spelling buffer. Move cursor to original point. ;; `X': Exit spelling buffer. Leaves cursor at the current point, and permits @@ -731,8 +731,7 @@ Otherwise returns the library directory name, if that is defined." result)) (defmacro ispell-with-safe-default-directory (&rest body) - "Execute the forms in BODY with a reasonable -`default-directory'." + "Execute the forms in BODY with a reasonable `default-directory'." (declare (indent 0) (debug t)) `(let ((default-directory default-directory)) (unless (file-accessible-directory-p default-directory) @@ -2530,7 +2529,7 @@ if defined." ;; `grep' returns status 1 and no output when word not found, which ;; is a perfectly normal thing. (if (stringp status) - (error "error: %s exited with signal %s" + (error "Error: %s exited with signal %s" (file-name-nondirectory prog) status) ;; Else collect words into `results' in FIFO order. (goto-char (point-max)) @@ -4090,7 +4089,7 @@ Includes LaTeX/Nroff modes and extended character mode." ;; Can kill the current ispell process (defun ispell-buffer-local-dict (&optional no-reload) - "Initializes local dictionary and local personal dictionary. + "Initialize local dictionary and local personal dictionary. If optional NO-RELOAD is non-nil, do not reload any dictionary. When a dictionary is defined in the buffer (see variable `ispell-dictionary-keyword'), it will override the local setting diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el index 87c91e8f1b..558d6b81d7 100644 --- a/lisp/textmodes/page-ext.el +++ b/lisp/textmodes/page-ext.el @@ -257,7 +257,7 @@ ;;; Addresses related variables (defcustom pages-addresses-file-name "~/addresses" - "Standard name for file of addresses. Entries separated by page-delimiter. + "Standard name for file of addresses. Entries separated by `page-delimiter'. Used by `pages-directory-for-addresses' function." :type 'file) diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 1d5d1caeab..a9b7b6dc96 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -514,7 +514,7 @@ Interactively, reads the register using `register-read-with-preview'." (move-to-column column t)))) (defun picture-yank-rectangle (&optional insertp) - "Overlay rectangle saved by \\[picture-clear-rectangle] + "Overlay rectangle saved by \\[picture-clear-rectangle]. The rectangle is positioned with upper left corner at point, overwriting existing text. With prefix argument, the rectangle is inserted instead, shifting existing text. Leaves mark at one corner of rectangle and diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el index 084b17c676..ce556be00d 100644 --- a/lisp/textmodes/refbib.el +++ b/lisp/textmodes/refbib.el @@ -195,7 +195,7 @@ This is in addition to the `r2b-capitalize-title-stop-words'.") (sit-for 0)))) (defun r2b-match (exp) - "Returns string matched in current buffer." + "Return string matched in current buffer." (buffer-substring (match-beginning exp) (match-end exp))) (defcustom r2b-out-buf-name "*Out*" diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 895064b82f..a2b745b0af 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -30,11 +30,11 @@ ;;; Variables and constants (defvar reftex-cite-regexp-hist nil - "The history list of regular expressions used for citations") + "The history list of regular expressions used for citations.") (defconst reftex-citation-prompt "Select: [n]ext [p]revious [r]estrict [ ]full_entry [q]uit RET [?]Help+more" - "Prompt and help string for citation selection") + "Prompt and help string for citation selection.") (defconst reftex-citation-help " n / p Go to next/previous entry (Cursor motion works as well). diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index 28cc7db2dc..5674d31c81 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -1150,7 +1150,7 @@ When index is restricted, select the previous section as restriction criterion." ;; Some constants and variables (defconst reftex-index-phrases-comment-regexp "^[ \t]*%.*" - "Regular expression to match comment lines in phrases buffer") + "Regular expression to match comment lines in phrases buffer.") (defconst reftex-index-phrases-macrodef-regexp "^\\(>>>INDEX_MACRO_DEFINITION:\\)[ \t]+\\(\\S-\\)\\( *\t[ \t]*\\)\\([^\t]*[^ \t]\\)\\( *\t[ \t]*\\)\\(\\S-+\\)" "Regular expression to match macro definition lines the phrases buffer.") @@ -2068,7 +2068,7 @@ both ends." (defun reftex-index-phrases-replace-space (pos) "If there is a space at POS, replace it with a newline char. -Does not do a save-excursion." +Does not do a `save-excursion'." (when (equal (char-after pos) ?\ ) (goto-char pos) (delete-char 1) diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 96065ee69e..cfdf256f70 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -433,8 +433,8 @@ This flag can be toggled from within the *toc* buffer with the `f' key." :type 'boolean) (defcustom reftex-revisit-to-follow nil - "Non-nil means, follow-mode will revisit files if necessary. -If nil, follow-mode will be suspended for stuff in unvisited files." + "Non-nil means, `follow-mode' will revisit files if necessary. +If nil, `follow-mode' will be suspended for stuff in unvisited files." :group 'reftex-table-of-contents-browser :group 'reftex-referencing-labels :type 'boolean) @@ -1694,8 +1694,8 @@ entries and for BibTeX database files with live associated buffers." "Non-nil means, echoed information for cite macros is cached. The information displayed in the echo area for cite macros is cached and even saved along with the parsing information. The -cache survives document scans. In order to clear it, use M-x -reftex-reset-mode ." +cache survives document scans. In order to clear it, use +\\[reftex-reset-mode]." :group 'reftex-viewing-cross-references :type 'boolean) diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 1cb2cf40c3..1278e4c403 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1,4 +1,5 @@ ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX -*- lexical-binding: t; -*- + ;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc. ;; Author: Carsten Dominik @@ -1930,7 +1931,7 @@ When DIE is non-nil, throw an error if file not found." (defun reftex-convert-string (string split-re invalid-re dot keep-fp nwords maxchar invalid abbrev sep ignore-words &optional downcase) - "Convert a string (a sentence) to something shorter. + "Convert STRING (a sentence) to something shorter. SPLIT-RE is the regular expression used to split the string into words. INVALID-RE matches characters which are invalid in the final string. DOT t means add dots to abbreviated words. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index fda00ec367..5bfcc1a20c 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -1208,7 +1208,7 @@ and move to the line in the SGML document that caused it." (compilation-start command)) (defsubst sgml-at-indentation-p () - "Return true if point is at the first non-whitespace character on the line." + "Return t if point is at the first non-whitespace character on the line." (save-excursion (skip-chars-backward " \t") (bolp))) @@ -2614,7 +2614,7 @@ HTML Autoview mode is a buffer-local minor mode for use with "") (define-skeleton html-html5-template - "Initial HTML5 template" + "Initial HTML5 template." nil "" \n "" \n diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 2dd52b87b7..50e44ff636 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -61,7 +61,7 @@ ;; holders. Amazingly there have been no direct support for WYSIWYG ;; table editing tasks in Emacs. Many people must have experienced ;; manipulating existing overwrite-mode and picture-mode for this task -;; and only dreamed of having such a lisp package which supports this +;; and only dreamed of having such a Lisp package which supports this ;; specific task directly. Certainly, I have been one of them. The ;; most difficult part of dealing with table editing in Emacs probably ;; is how to realize localized rectangular editing effect. Emacs has @@ -860,7 +860,7 @@ cell to cache and cache to cell.") This is always set to nil at the entry to `table-with-cache-buffer' before executing body forms.") (defvar-local table-mode-indicator nil - "For mode line indicator") + "For mode line indicator.") ;; This is not a real minor-mode but placed in the minor-mode-alist ;; so that we can show the indicator on the mode line handy. (unless (assq table-mode-indicator minor-mode-alist) @@ -3625,8 +3625,7 @@ independently. By applying `table-release', which does the opposite process, the contents become once again plain text. `table-release' works as -companion command to `table-capture' this way. -" +companion command to `table-capture' this way." (interactive (let ((col-delim-regexp) (row-delim-regexp)) @@ -4535,7 +4534,7 @@ grow into." (defun table--untabify-line (&optional from) "Untabify current line. -Unlike save-excursion this guarantees preserving the cursor location +Unlike `save-excursion' this guarantees preserving the cursor location even when the point is on a tab character which is to be removed. Optional FROM narrows the subject operation from this point to the end of line." @@ -5074,7 +5073,7 @@ signals error if the optional ABORT-ON-ERROR is non-nil." (defun table--insert-rectangle (rectangle) "Insert text of RECTANGLE with upper left corner at point. -Same as insert-rectangle except that mark operation is eliminated." +Same as `insert-rectangle' except that mark operation is eliminated." (let ((lines rectangle) (insertcolumn (current-column)) (first t)) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index d7cd0aceb2..697c0de598 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2353,7 +2353,7 @@ FILE is typically the output DVI or PDF file." collect (cons char (shell-quote-argument file)))) (defun tex-format-cmd (format fspec) - "Like `format-spec' but adds user-specified args to the command. + "Like `format-spec' but add user-specified args to the command. Only applies the FSPEC to the args part of FORMAT." (setq fspec (tex--quote-spec fspec)) (if (not (string-match "\\([^ /\\]+\\) " format)) diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 11d60e1eb0..135a404731 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -350,7 +350,7 @@ and also to be turned into Info files with \\[makeinfo-buffer] or the `makeinfo' program. These files must be written in a very restricted and modified version of TeX input format. - Editing commands are like text-mode except that the syntax table is + Editing commands are like `text-mode' except that the syntax table is set up so expression commands skip Texinfo bracket groups. To see what the Info version of a region of the Texinfo file will look like, use \\[makeinfo-region], which runs `makeinfo' on the current region. @@ -378,15 +378,15 @@ updating menus and node pointers. These functions Here are the functions: - texinfo-update-node \\[texinfo-update-node] - texinfo-every-node-update \\[texinfo-every-node-update] - texinfo-sequential-node-update + `texinfo-update-node' \\[texinfo-update-node] + `texinfo-every-node-update' \\[texinfo-every-node-update] + `texinfo-sequential-node-update' - texinfo-make-menu \\[texinfo-make-menu] - texinfo-all-menus-update \\[texinfo-all-menus-update] - texinfo-master-menu + `texinfo-make-menu' \\[texinfo-make-menu] + `texinfo-all-menus-update' \\[texinfo-all-menus-update] + `texinfo-master-menu' - texinfo-indent-menu-description (column &optional region-p) + `texinfo-indent-menu-description' (column &optional region-p) The `texinfo-column-for-description' variable specifies the column to which menu descriptions are indented. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 4a64caa36b..8a9a6b8583 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -291,7 +291,7 @@ and an optional path to which to limit history) and produce a string. The function is called with `default-directory' set to within the repository. -If no list entry produces a useful revision, return `nil'." +If no list entry produces a useful revision, return nil." :type '(repeat (choice (const :tag "Active bookmark" builtin-active-bookmark) (string :tag "Hg template") @@ -301,7 +301,7 @@ If no list entry produces a useful revision, return `nil'." (defcustom vc-hg-use-file-version-for-mode-line-version nil "When enabled, the modeline contains revision information for the visited file. When not, the revision in the modeline is for the repository -working copy. `nil' is the much faster setting for +working copy. nil is the much faster setting for large repositories." :type 'boolean :version "26.1") diff --git a/lisp/windmove.el b/lisp/windmove.el index ef970bb6c9..47a1668ee8 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -498,7 +498,7 @@ Default value of MODIFIERS is `shift'." (defcustom windmove-display-no-select nil "Whether the window should be selected after displaying the buffer in it. -If `nil', then the new window where the buffer is displayed will be selected. +If nil, then the new window where the buffer is displayed will be selected. If `ignore', then don't select a window: neither the new nor the old window, thus allowing the next command to decide what window it selects. Other non-nil values will reselect the old window that was selected before. diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index 45e0c43598..10111ca06c 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el @@ -109,7 +109,7 @@ SEVERITY-PREDICATE is used to setup (face-at-point))))) (ert-deftest perl-backend () - "Test the perl backend" + "Test the perl backend." (skip-unless (executable-find "perl")) (flymake-tests--with-flymake ("test.pl") (flymake-goto-next-error) @@ -120,7 +120,7 @@ SEVERITY-PREDICATE is used to setup (defvar ruby-mode-hook) (ert-deftest ruby-backend () - "Test the ruby backend" + "Test the ruby backend." (skip-unless (executable-find "ruby")) ;; Some versions of ruby fail if HOME doesn't exist (bug#29187). (let* ((tempdir (make-temp-file "flymake-tests-ruby" t)) @@ -234,7 +234,7 @@ SEVERITY-PREDICATE is used to setup (lambda (_report-fn) ;; HACK: Shoosh log during tests (setq-local warning-minimum-log-level :emergency) - (error "crashed")))) + (error "Crashed")))) (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore manha aliqua. Ut enim ad minim veniam, quis nostrud @@ -291,7 +291,7 @@ SEVERITY-PREDICATE is used to setup (should-error (flymake-goto-next-error nil nil t)))))) (ert-deftest recurrent-backend () - "Test a backend that calls REPORT-FN multiple times" + "Test a backend that calls REPORT-FN multiple times." (with-temp-buffer (let (tick) (cl-letf @@ -374,4 +374,4 @@ SEVERITY-PREDICATE is used to setup (provide 'flymake-tests) -;;; flymake.el ends here +;;; flymake-tests.el ends here commit 2110973351f01fb5cdf90b705acb58354b608050 Author: Stefan Kangas Date: Mon Sep 13 06:03:44 2021 +0200 Improve checkdoc abbreviation handling * lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): New helper function. (checkdoc-sentencespace-region-engine): Fix handling abbreviations after escaped parenthesis. * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests-in-abbrevation-p) (checkdoc-tests-in-abbrevation-p/with-parens) (checkdoc-tests-in-abbrevation-p/with-escaped-parens): New tests. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 00cc7777e1..1ab44e0f66 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1998,6 +1998,31 @@ The text checked is between START and LIMIT." (setq c (1+ c))) (and (< 0 c) (= (% c 2) 0)))))) +(defun checkdoc-in-abbreviation-p (begin) + "Return non-nil if point is at an abbreviation. +Examples of abbreviations handled: \"e.g.\", \"i.e.\", \"cf.\"." + (save-excursion + (goto-char begin) + (condition-case nil + (progn + (forward-sexp -1) + ;; Piece of an abbreviation. + (looking-at + (rx (or letter ; single letter, as in "a." + (seq + ;; There might exist an escaped parenthesis, as + ;; this is often used in docstrings. In this + ;; case, `forward-sexp' will have skipped over it, + ;; so we need to skip it here too. + (? "\\(") + ;; The abbreviations: + (or (seq (any "iI") "." (any "eE")) ; i.e. + (seq (any "eE") ".g") ; e.g. + (seq (any "cC") "f"))) ; c.f. + "vs") ; vs. + "."))) + (error t)))) + (defun checkdoc-proper-noun-region-engine (begin end) "Check all text between BEGIN and END for lower case proper nouns. These are Emacs centric proper nouns which should be capitalized for @@ -2060,16 +2085,7 @@ If the offending word is in a piece of quoted text, then it is skipped." (e (match-end 1))) (unless (or (checkdoc-in-sample-code-p begin end) (checkdoc-in-example-string-p begin end) - (save-excursion - (goto-char b) - (condition-case nil - (progn - (forward-sexp -1) - ;; piece of an abbreviation - ;; FIXME etc - (looking-at - "\\([a-zA-Z]\\|[iI]\\.?e\\|[eE]\\.?g\\|[cC]f\\)\\.")) - (error t)))) + (checkdoc-in-abbreviation-p b)) (if (checkdoc-autofix-ask-replace b e "There should be two spaces after a period. Fix? " diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index 2a1d8b2763..a4b252031f 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -122,4 +122,28 @@ See the comments in Bug#24998." (should (looking-at-p "\"baz\")")) (should-not (checkdoc-next-docstring)))) +(ert-deftest checkdoc-tests-in-abbrevation-p () + (with-temp-buffer + (emacs-lisp-mode) + (insert "foo bar e.g. baz") + (goto-char (point-min)) + (re-search-forward "e.g") + (should (checkdoc-in-abbreviation-p (point))))) + +(ert-deftest checkdoc-tests-in-abbrevation-p/with-parens () + (with-temp-buffer + (emacs-lisp-mode) + (insert "foo bar (e.g. baz)") + (goto-char (point-min)) + (re-search-forward "e.g") + (should (checkdoc-in-abbreviation-p (point))))) + +(ert-deftest checkdoc-tests-in-abbrevation-p/with-escaped-parens () + (with-temp-buffer + (emacs-lisp-mode) + (insert "foo\n\\(e.g. baz)") + (goto-char (point-min)) + (re-search-forward "e.g") + (should (checkdoc-in-abbreviation-p (point))))) + ;;; checkdoc-tests.el ends here commit bd601099b9332ef6bae697b23b63ee648d56b667 Author: Stefan Kangas Date: Mon Sep 13 04:41:15 2021 +0200 Remove some remaining references to XEmacs * lisp/allout.el (allout-overlay-preparations): * lisp/cedet/semantic/decorate/include.el (semantic-decoration-unknown-include-menu) (semantic-decoration-fileless-include-menu): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-setup-timers): * lisp/vc/ediff-init.el: * lisp/vc/ediff-util.el (ediff-mode): Remove some remaining references to XEmacs. diff --git a/lisp/allout.el b/lisp/allout.el index 0625ea68ab..622596310b 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -1601,7 +1601,7 @@ So `allout-post-command-business' should not reactivate it...") ;; the _transient_ opening of invisible text during isearch -- is keyed to ;; presence of the isearch-open-invisible property -- even though this ;; property controls the isearch _arrival_ behavior. This is the case at - ;; least in emacs 21, 22.1, and xemacs 21.4. + ;; least in emacs 21, 22.1. (put 'allout-exposure-category 'isearch-open-invisible #'allout-isearch-end-handler) (put 'allout-exposure-category 'insert-in-front-hooks diff --git a/lisp/cedet/semantic/decorate/include.el b/lisp/cedet/semantic/decorate/include.el index a3bf4e252f..389b3062c5 100644 --- a/lisp/cedet/semantic/decorate/include.el +++ b/lisp/cedet/semantic/decorate/include.el @@ -514,9 +514,7 @@ See the Semantic manual node on SemanticDB for more about search paths.") Argument EVENT describes the event that caused this function to be called." (interactive "e") (let* ((startwin (selected-window)) - ;; This line has an issue in XEmacs. - (win (semantic-event-window event)) - ) + (win (semantic-event-window event))) (select-window win t) (save-excursion ;(goto-char (window-start win)) @@ -557,9 +555,7 @@ searches, but you cannot visit this include.\n\n") Argument EVENT describes the event that caused this function to be called." (interactive "e") (let* ((startwin (selected-window)) - ;; This line has an issue in XEmacs. - (win (semantic-event-window event)) - ) + (win (semantic-event-window event))) (select-window win t) (save-excursion ;(goto-char (window-start win)) diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index b883573a30..c058e8a8b5 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -102,7 +102,6 @@ it is unlikely the user would be ready to type again right away." (defun semantic-idle-scheduler-setup-timers () "Lazy initialization of the auto parse idle timer." - ;; REFRESH THIS FUNCTION for XEMACS FOIBLES (or (timerp semantic-idle-scheduler-timer) (setq semantic-idle-scheduler-timer (run-with-idle-timer diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 17c4202d64..96fa0633e8 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -49,7 +49,6 @@ that Ediff doesn't know about.") (declare (obsolete nil "27.1")) window-system) -;; in XEmacs: device-type is tty on tty and stream in batch. (defun ediff-window-display-p () (and window-system (not (memq window-system '(tty pc stream))))) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 0cbea2c28d..0404380943 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -87,12 +87,10 @@ Commands: (kill-all-local-variables) (setq major-mode 'ediff-mode) (setq mode-name "Ediff") - ;; We use run-hooks instead of run-mode-hooks for two reasons. + ;; We use run-hooks instead of run-mode-hooks for one reason. ;; The ediff control buffer is read-only and it is not supposed to be ;; modified by minor modes and such. So, run-mode-hooks doesn't do anything ;; useful here on top of what run-hooks does. - ;; Second, changing run-hooks to run-mode-hooks would require an - ;; if-statement, since XEmacs doesn't have this. (run-hooks 'ediff-mode-hook)) @@ -3938,8 +3936,8 @@ If Emacs happens to dump core, this is NOT an Ediff problem---it is an Emacs bug. Report this to Emacs maintainers. Another popular topic for reports is compilation messages. Because Ediff -interfaces to several other packages and runs under Emacs and XEmacs, -byte-compilation may produce output like this: +interfaces to several other packages, byte-compilation may produce output +like this: While compiling toplevel forms in file ediff.el: ** reference to free variable zzz commit d31495104399c888911db12517a3fbab2f72401f Author: Dmitry Gutov Date: Mon Sep 13 01:33:31 2021 +0300 Extend xref-file-name-display to elisp and etags definitions And all other types of locations (with a looks-like-file-name check). * lisp/progmodes/xref.el (xref--group-name-for-display): Extract from xref-buffer-location's implementation of xref-location-group. (xref-file-location): Define trivial reader for the 'file' slot. (xref-location-group): Update docstring. (xref--analyze): Use the new function here, to be able to format group names coming from any location type. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 9a0de5f449..0f7a519497 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -86,7 +86,10 @@ (cl-defgeneric xref-location-group (location) "Return a string used to group a set of locations. -This is typically the filename.") +This is typically a file name, but can also be a package name, or +some other label. + +When it is a file name, it should be the \"expanded\" version.") (cl-defgeneric xref-location-line (_location) "Return the line number corresponding to the location." @@ -119,7 +122,7 @@ in its full absolute form." ;; FIXME: might be useful to have an optional "hint" i.e. a string to ;; search for in case the line number is slightly out of date. (defclass xref-file-location (xref-location) - ((file :type string :initarg :file) + ((file :type string :initarg :file :reader xref-location-group) (line :type fixnum :initarg :line :reader xref-location-line) (column :type fixnum :initarg :column :reader xref-file-location-column)) :documentation "A file location is a file/line/column triple. @@ -148,32 +151,6 @@ Line numbers start from 1 and columns from 0.") (forward-char column)) (point-marker)))))) -(defvar xref--project-root-memo nil - "Cons mapping `default-directory' value to the search root.") - -(cl-defmethod xref-location-group ((l xref-file-location)) - (cl-ecase xref-file-name-display - (abs - (oref l file)) - (nondirectory - (file-name-nondirectory (oref l file))) - (project-relative - (unless (and xref--project-root-memo - (equal (car xref--project-root-memo) - default-directory)) - (setq xref--project-root-memo - (cons default-directory - (let ((root - (let ((pr (project-current))) - (and pr (xref--project-root pr))))) - (and root (expand-file-name root)))))) - (let ((file (oref l file)) - (search-root (cdr xref--project-root-memo))) - (if (and search-root - (string-prefix-p search-root file)) - (substring file (length search-root)) - file))))) - (defclass xref-buffer-location (xref-location) ((buffer :type buffer :initarg :buffer) (position :type fixnum :initarg :position))) @@ -1037,13 +1014,50 @@ GROUP is a string for decoration purposes and XREF is an (xref--apply-truncation))) (run-hooks 'xref-after-update-hook)) +(defun xref--group-name-for-display (group project-root) + "Return GROUP formatted in the prefered style. + +The style is determined by the value of `xref-file-name-display'. +If GROUP looks like a file name, its value is formatted according +to that style. Otherwise it it returned unchanged." + ;; XXX: The way we verify that it's indeed a file name and not some + ;; other kind of string, e.g. Java package name or TITLE from + ;; `tags-apropos-additional-actions', is pretty lax. But we don't + ;; want to use `file-exists-p' for performance reasons. If this + ;; ever turns out to be a problem, some other alternatives are to + ;; either have every location class which uses file names format the + ;; values themselves (e.g. by piping through some public function), + ;; or adding a new accessor to locations, like GROUP-TYPE. + (cl-ecase xref-file-name-display + (abs group) + (nondirectory + (if (string-match-p "\\`~?/" group) + (file-name-nondirectory group) + group)) + (project-relative + (if (and project-root + (string-prefix-p project-root group)) + (substring group (length project-root)) + group)))) + (defun xref--analyze (xrefs) - "Find common filenames in XREFS. -Return an alist of the form ((FILENAME . (XREF ...)) ...)." - (xref--alistify xrefs - (lambda (x) - (xref-location-group (xref-item-location x))) - #'equal)) + "Find common groups in XREFS and format group names. +Return an alist of the form ((GROUP . (XREF ...)) ...)." + (let* ((alist + (xref--alistify xrefs + (lambda (x) + (xref-location-group (xref-item-location x))) + #'equal)) + (project (and + (eq xref-file-name-display 'project-relative) + (project-current))) + (project-root (and project + (expand-file-name (project-root project))))) + (mapcar + (lambda (pair) + (cons (xref--group-name-for-display (car pair) project-root) + (cdr pair))) + alist))) (defun xref--show-xref-buffer (fetcher alist) (cl-assert (functionp fetcher)) commit 85d0ed097efc97b8a8056150328fba998c131df9 Author: Amin Bandali Date: Sun Sep 12 14:12:50 2021 -0400 ERC: Use 'string-replace' only on Emacs 28 and later * lisp/erc/erc-dcc.el (erc-dcc-unquote-filename): * lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy) (erc-update-mode-line-buffer, erc-message-english-PART): Use 'string-replace' only on Emacs 28 and later, otherwise use 'replace-regexp-in-string' on older Emacsen. diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index df53270831..b80f1832d7 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -632,8 +632,13 @@ that subcommand." (define-inline erc-dcc-unquote-filename (filename) (inline-quote - (string-replace "\\\\" "\\" - (string-replace "\\\"" "\"" ,filename)))) + (if (>= emacs-major-version 28) + (string-replace + "\\\\" "\\" + (string-replace "\\\"" "\"" ,filename)) + (replace-regexp-in-string + "\\\\\\\\" "\\" + (replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t)))) (defun erc-dcc-handle-ctcp-send (proc query nick login host to) "This is called if a CTCP DCC SEND subcommand is sent to the client. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index b18eb0a228..f01a99a30a 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3597,7 +3597,9 @@ If S is non-nil, it will be used as the quit reason." If S is non-nil, it will be used as the quit reason." (or s (if (fboundp 'yow) - (string-replace "\n" "" (yow)) + (if (>= emacs-major-version 28) + (string-replace "\n" "" (yow)) + (replace-regexp-in-string "\n" "" (yow))) (erc-quit/part-reason-default)))) (make-obsolete 'erc-quit-reason-zippy "it will be removed." "24.4") @@ -3624,7 +3626,9 @@ If S is non-nil, it will be used as the part reason." If S is non-nil, it will be used as the quit reason." (or s (if (fboundp 'yow) - (string-replace "\n" "" (yow)) + (if (>= emacs-major-version 28) + (string-replace "\n" "" (yow)) + (replace-regexp-in-string "\n" "" (yow))) (erc-quit/part-reason-default)))) (make-obsolete 'erc-part-reason-zippy "it will be removed." "24.4") @@ -6530,13 +6534,21 @@ if `erc-away' is non-nil." (fill-region (point-min) (point-max)) (buffer-string)))) (setq header-line-format - (string-replace - "%" - "%%" - (if face - (propertize header 'help-echo help-echo - 'face face) - (propertize header 'help-echo help-echo)))))) + (if (>= emacs-major-version 28) + (string-replace + "%" + "%%" + (if face + (propertize header 'help-echo help-echo + 'face face) + (propertize header 'help-echo help-echo))) + (replace-regexp-in-string + "%" + "%%" + (if face + (propertize header 'help-echo help-echo + 'face face) + (propertize header 'help-echo help-echo))))))) (t (setq header-line-format (if face (propertize header 'face face) @@ -6806,7 +6818,9 @@ functions." nick user host channel (if (not (string= reason "")) (format ": %s" - (string-replace "%" "%%" reason)) + (if (>= emacs-major-version 28) + (string-replace "%" "%%" reason) + (replace-regexp-in-string "%" "%%" reason))) ""))))) commit e20bae005e9fff0f7f9cdb54a8d797c65e01e7ee Author: Amin Bandali Date: Sun Sep 12 14:09:53 2021 -0400 ERC: Use 'string-search' only on Emacs 28 and later * lisp/erc/erc-backend.el (erc-parse-server-response): * lisp/erc/erc-dcc.el (erc-dcc-member): * lisp/erc/erc-speedbar.el (erc-speedbar-expand-server) (erc-speedbar-expand-channel, erc-speedbar-expand-user): * lisp/erc/erc.el (erc-send-input): Use 'string-search' only on Emacs 28 and later, otherwise use 'string-match' on older Emacsen. diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 6d84665873..ad9719380a 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -950,15 +950,22 @@ PROCs `process-buffer' is `current-buffer' when this function is called." (unless (string= string "") ;; Ignore empty strings (save-match-data (let* ((tag-list (when (eq (aref string 0) ?@) - (substring string 1 (string-search " " string)))) + (substring string 1 + (if (>= emacs-major-version 28) + (string-search " " string) + (string-match " " string))))) (msg (make-erc-response :unparsed string :tags (when tag-list (erc-parse-tags tag-list)))) (string (if tag-list - (substring string (+ 1 (string-search " " string))) + (substring string (+ 1 (if (>= emacs-major-version 28) + (string-search " " string) + (string-match " " string)))) string)) (posn (if (eq (aref string 0) ?:) - (string-search " " string) + (if (>= emacs-major-version 28) + (string-search " " string) + (string-match " " string)) 0))) (setf (erc-response.sender msg) @@ -968,7 +975,9 @@ PROCs `process-buffer' is `current-buffer' when this function is called." (setf (erc-response.command msg) (let* ((bposn (string-match "[^ \n]" string posn)) - (eposn (string-search " " string bposn))) + (eposn (if (>= emacs-major-version 28) + (string-search " " string bposn) + (string-match " " string bposn)))) (setq posn (and eposn (string-match "[^ \n]" string eposn))) (substring string bposn eposn))) @@ -976,7 +985,9 @@ PROCs `process-buffer' is `current-buffer' when this function is called." (while (and posn (not (eq (aref string posn) ?:))) (push (let* ((bposn posn) - (eposn (string-search " " string bposn))) + (eposn (if (>= emacs-major-version 28) + (string-search " " string bposn) + (string-match " " string bposn)))) (setq posn (and eposn (string-match "[^ \n]" string eposn))) (substring string bposn eposn)) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index de72624aaa..df53270831 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -187,7 +187,9 @@ compared with `erc-nick-equal-p' which is IRC case-insensitive." (plist-get elt prop))) ;; if the property exists and is equal, we continue, else, try the ;; next element of the list - (or (and (eq prop :nick) (string-search "!" val) + (or (and (eq prop :nick) (if (>= emacs-major-version 28) + (string-search "!" val) + (string-match "!" val)) test (string-equal test val)) (and (eq prop :nick) test val diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el index e61e741302..84854e3be5 100644 --- a/lisp/erc/erc-speedbar.el +++ b/lisp/erc/erc-speedbar.el @@ -139,7 +139,9 @@ This will add a speedbar major display mode." t)))) (defun erc-speedbar-expand-server (text server indent) - (cond ((string-search "+" text) + (cond ((if (>= emacs-major-version 28) + (string-search "+" text) + (string-match "\\+" text)) (speedbar-change-expand-button-char ?-) (if (speedbar-with-writable (save-excursion @@ -147,7 +149,10 @@ This will add a speedbar major display mode." (erc-speedbar-channel-buttons nil (1+ indent) server))) (speedbar-change-expand-button-char ?-) (speedbar-change-expand-button-char ??))) - ((string-search "-" text) ;we have to contract this node + (;; we have to contract this node + (if (>= emacs-major-version 28) + (string-search "-" text) + (string-match "-" text)) (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) @@ -184,7 +189,9 @@ This will add a speedbar major display mode." "For the line matching TEXT, in CHANNEL, expand or contract a line. INDENT is the current indentation level." (cond - ((string-search "+" text) + ((if (>= emacs-major-version 28) + (string-search "+" text) + (string-match "\\+" text)) (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -233,7 +240,9 @@ INDENT is the current indentation level." (speedbar-with-writable (dolist (entry names) (erc-speedbar-insert-user entry ?+ (1+ indent)))))))))) - ((string-search "-" text) + ((if (>= emacs-major-version 28) + (string-search "-" text) + (string-match "-" text)) (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) @@ -284,7 +293,9 @@ The update is only done when the channel is actually expanded already." (erc-speedbar-expand-channel "+" buffer 1))))) (defun erc-speedbar-expand-user (text token indent) - (cond ((string-search "+" text) + (cond ((if (>= emacs-major-version 28) + (string-search "+" text) + (string-match "\\+" text)) (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -307,7 +318,9 @@ The update is only done when the channel is actually expanded already." nil nil nil nil info nil nil nil (1+ indent))))))) - ((string-search "-" text) + ((if (>= emacs-major-version 28) + (string-search "-" text) + (string-match "-" text)) (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index e0fda41f8e..b18eb0a228 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -5587,7 +5587,9 @@ This returns non-nil only if we actually send anything." (when (and (erc-input-sendp state) erc-send-this) (let ((string (erc-input-string state))) - (if (or (string-search "\n" string) + (if (or (if (>= emacs-major-version 28) + (string-search "\n" string) + (string-match "\n" string)) (not (string-match erc-command-regexp string))) (mapc (lambda (line) commit 911043845d8c0a8e67407ac80ded3bf6362bb972 Author: Juri Linkov Date: Sun Sep 12 21:30:06 2021 +0300 * lisp/tab-bar.el (tab-bar-get-buffer-tab): Use 'remq' instead of 'seq-remove' diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index e30a5c4411..2684ff998b 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1945,7 +1945,7 @@ Otherwise, prefer buffers of the current tab." (frame . ,frame))))) (let* ((tabs (funcall tab-bar-tabs-function frame)) (current-tab (tab-bar--current-tab-find tabs))) - (seq-remove (lambda (tab) (eq (car tab) 'current-tab)) tabs) + (setq tabs (remq current-tab tabs)) (if ignore-current-tab ;; Use tabs without current-tab. tabs commit aa33e38e21e09045bc2ab598e34f3c1510442cb0 Author: Juri Linkov Date: Sun Sep 12 20:55:57 2021 +0300 Allow region-related context menu to be used on selected region with one click * lisp/mouse.el (mouse-drag-track): Don't deactivate the mark for the context menu invoked by down-mouse-3. https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg01577.html diff --git a/lisp/mouse.el b/lisp/mouse.el index bd11ec50d5..c107322815 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1583,8 +1583,15 @@ The region will be defined with mark and point." t (lambda () (setq track-mouse old-track-mouse) (setq auto-hscroll-mode auto-hscroll-mode-saved) - (deactivate-mark) - (pop-mark))))) + ;; Don't deactivate the mark when the context menu was invoked + ;; by down-mouse-3 immediately after down-mouse-1 and without + ;; releasing the mouse button with mouse-1. This allows to use + ;; region-related context menu to operate on the selected region. + (unless (and context-menu-mode + (eq (car-safe (aref (this-command-keys-vector) 0)) + 'down-mouse-3)) + (deactivate-mark) + (pop-mark)))))) (defun mouse--drag-set-mark-and-point (start click click-count) (let* ((range (mouse-start-end start click click-count)) commit bd917088e69e71e77c15069f0751096141ca3f1a Author: Juri Linkov Date: Sun Sep 12 20:32:02 2021 +0300 * lisp/thingatpt.el (thing-at-mouse): New function (bug#50256). * lisp/net/dictionary.el: Add 'context-menu-dictionary' to 'context-menu-functions'. (dictionary-search-word-at-mouse): New function. (context-menu-dictionary): New function that uses 'thing-at-mouse'. (dictionary-mouse-popup-matching-words): Remove stray 'selected-window'. * lisp/textmodes/flyspell.el (flyspell-context-menu): Add '_click' arg. diff --git a/etc/NEWS b/etc/NEWS index ca269aabaa..8385128f69 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2503,6 +2503,8 @@ This allows mode-specific alterations to how 'thing-at-point' works. 'symbol-at-point') will narrow to the current field (if any) before trying to identify the thing at point. +*** New function 'thing-at-mouse'. + ** image-dired --- diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 0f42af0911..5a6f3b555d 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1211,7 +1211,6 @@ allows editing it." (save-excursion (mouse-set-point event) (current-word))))) - (selected-window) (dictionary-popup-matching-words word))) ;;;###autoload @@ -1368,5 +1367,26 @@ any buffer where (dictionary-tooltip-mode 1) has been called." (if on #'dictionary-tooltip-track-mouse #'ignore)) on)) +;;; Context menu support + +(defun dictionary-search-word-at-mouse (event) + (interactive "e") + (let ((word (save-window-excursion + (save-excursion + (mouse-set-point event) + (current-word))))) + (dictionary-search word))) + +(defun context-menu-dictionary (menu click) + "Dictionary context menu." + (when (thing-at-mouse click 'word) + (define-key menu [dictionary-separator] menu-bar-separator) + (define-key menu [dictionary-search-word-at-mouse] + '(menu-item "Dictionary Search" dictionary-search-word-at-mouse + :help "Search the word at mouse click in dictionary"))) + menu) + +(add-hook 'context-menu-functions 'context-menu-dictionary 15) + (provide 'dictionary) ;;; dictionary.el ends here diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 975f540936..423f37762c 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -470,7 +470,7 @@ See also `flyspell-duplicate-distance'." (defvar flyspell-overlay nil) -(defun flyspell-context-menu (_menu) +(defun flyspell-context-menu (_menu _click) "Context menu for `context-menu-mode'." ;; TODO: refactor `flyspell-correct-word' and related functions to return ;; a keymap menu where every menu item is bound to a lambda that calls diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index ab17748df5..8782c9eeb5 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -151,6 +151,15 @@ positions of the thing found." (if (and (<= real-beg orig) (<= orig end) (< real-beg end)) (cons real-beg end)))))))))) +;;;###autoload +(defun thing-at-mouse (event thing &optional no-properties) + "Return the THING at mouse click. +Like `thing-at-point', but tries to use the event +where the mouse button is clicked to find a thing nearby." + (save-excursion + (mouse-set-point event) + (thing-at-point thing no-properties))) + ;;;###autoload (defun thing-at-point (thing &optional no-properties) "Return the THING at point. commit 4877ddeaf739af3a683d8686d1e2fa5e51960623 Author: Juri Linkov Date: Sun Sep 12 20:11:52 2021 +0300 * lisp/mouse.el (context-menu-map): Add 'click' arg to called funs (bug#50256) (context-menu-toolbar, context-menu-global, context-menu-local) (context-menu-minor, context-menu-buffers, context-menu-vc) (context-menu-undo, context-menu-region, context-menu-ffap): Add 'click' arg. * lisp/dired.el (dired-context-menu): * lisp/help-mode.el (help-mode-context-menu): * lisp/info.el (Info-context-menu): * lisp/net/eww.el (eww-context-menu): * lisp/net/goto-addr.el (goto-address-context-menu): * lisp/progmodes/prog-mode.el (prog-context-menu): Add 'click' arg. diff --git a/lisp/dired.el b/lisp/dired.el index 958677cd0c..1ed83cb95a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2193,8 +2193,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ["Delete Image Tag..." image-dired-delete-tag :help "Delete image tag from current or marked files"])) -(defun dired-context-menu (menu) - (when (mouse-posn-property (event-start last-input-event) 'dired-filename) +(defun dired-context-menu (menu click) + (when (mouse-posn-property (event-start click) 'dired-filename) (define-key menu [dired-separator] menu-bar-separator) (let ((easy-menu (make-sparse-keymap "Immediate"))) (easy-menu-define nil easy-menu nil diff --git a/lisp/help-mode.el b/lisp/help-mode.el index d224bdcbcf..d341b4c9e4 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -70,7 +70,7 @@ ["Customize" help-customize :help "Customize variable or face"])) -(defun help-mode-context-menu (menu) +(defun help-mode-context-menu (menu click) (define-key menu [help-mode-separator] menu-bar-separator) (let ((easy-menu (make-sparse-keymap "Help-Mode"))) (easy-menu-define nil easy-menu nil @@ -85,7 +85,7 @@ (when (consp item) (define-key menu (vector (car item)) (cdr item))))) - (when (mouse-posn-property (event-start last-input-event) 'mouse-face) + (when (mouse-posn-property (event-start click) 'mouse-face) (define-key menu [help-mode-push-button] '(menu-item "Follow Link" (lambda (event) (interactive "e") diff --git a/lisp/info.el b/lisp/info.el index c09c75ad48..b861fff744 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4151,7 +4151,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'." "---" ["Exit" quit-window :help "Stop reading Info"])) -(defun Info-context-menu (menu) +(defun Info-context-menu (menu click) (define-key menu [Info-separator] menu-bar-separator) (let ((easy-menu (make-sparse-keymap "Info"))) (easy-menu-define nil easy-menu nil @@ -4164,7 +4164,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'." (when (consp item) (define-key menu (vector (car item)) (cdr item))))) - (when (mouse-posn-property (event-start last-input-event) 'mouse-face) + (when (mouse-posn-property (event-start click) 'mouse-face) (define-key menu [Info-mouse-follow-nearest-node] '(menu-item "Follow Link" Info-mouse-follow-nearest-node :help "Follow a link where you click"))) diff --git a/lisp/mouse.el b/lisp/mouse.el index f7ade5f89a..bd11ec50d5 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -284,8 +284,8 @@ not it is actually displayed." context-menu-local context-menu-minor) "List of functions that produce the contents of the context menu. -Each function receives the menu as its argument and should return -the same menu with changes such as added new menu items." +Each function receives the menu and the mouse click event as its arguments +and should return the same menu with changes such as added new menu items." :type '(repeat (choice (function-item context-menu-undo) (function-item context-menu-region) @@ -304,17 +304,18 @@ the same menu with changes such as added new menu items." :type '(choice (const nil) function) :version "28.1") -(defun context-menu-map () +(defun context-menu-map (&optional click) "Return composite menu map." - (let ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))) - (let ((fun (mouse-posn-property (event-start last-input-event) - 'context-menu-function))) - (if (functionp fun) - (setq menu (funcall fun menu)) - (run-hook-wrapped 'context-menu-functions - (lambda (fun) - (setq menu (funcall fun menu)) - nil)))) + (let* ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t))) + (click (or click last-input-event)) + (fun (mouse-posn-property (event-start click) + 'context-menu-function))) + (if (functionp fun) + (setq menu (funcall fun menu click)) + (run-hook-wrapped 'context-menu-functions + (lambda (fun) + (setq menu (funcall fun menu click)) + nil))) ;; Remove duplicate separators (let ((l menu)) @@ -325,10 +326,10 @@ the same menu with changes such as added new menu items." (setq l (cdr l)))) (when (functionp context-menu-filter-function) - (setq menu (funcall context-menu-filter-function menu))) + (setq menu (funcall context-menu-filter-function menu click))) menu)) -(defun context-menu-toolbar (menu) +(defun context-menu-toolbar (menu _click) "Tool bar menu items." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) (define-key-after menu [separator-toolbar] menu-bar-separator) @@ -339,7 +340,7 @@ the same menu with changes such as added new menu items." (lookup-key global-map [tool-bar])) menu) -(defun context-menu-global (menu) +(defun context-menu-global (menu _click) "Global submenus." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) (define-key-after menu [separator-global] menu-bar-separator) @@ -350,7 +351,7 @@ the same menu with changes such as added new menu items." (lookup-key global-map [menu-bar])) menu) -(defun context-menu-local (menu) +(defun context-menu-local (menu _click) "Major mode submenus." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) (define-key-after menu [separator-local] menu-bar-separator) @@ -363,7 +364,7 @@ the same menu with changes such as added new menu items." keymap))) menu) -(defun context-menu-minor (menu) +(defun context-menu-minor (menu _click) "Minor modes submenus." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) (define-key-after menu [separator-minor] menu-bar-separator) @@ -376,7 +377,7 @@ the same menu with changes such as added new menu items." (cdr mode)))) menu) -(defun context-menu-buffers (menu) +(defun context-menu-buffers (menu _click) "Submenus with buffers." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) (define-key-after menu [separator-buffers] menu-bar-separator) @@ -387,13 +388,13 @@ the same menu with changes such as added new menu items." (mouse-buffer-menu-keymap)) menu) -(defun context-menu-vc (menu) +(defun context-menu-vc (menu _click) "Version Control menu." (define-key-after menu [separator-vc] menu-bar-separator) (define-key-after menu [vc-menu] vc-menu-entry) menu) -(defun context-menu-undo (menu) +(defun context-menu-undo (menu _click) "Undo menu." (define-key-after menu [separator-undo] menu-bar-separator) (when (and (not buffer-read-only) @@ -411,7 +412,7 @@ the same menu with changes such as added new menu items." :help "Redo last undone edits"))) menu) -(defun context-menu-region (menu) +(defun context-menu-region (menu _click) "Region commands menu." (define-key-after menu [separator-region] menu-bar-separator) (when (and mark-active (not buffer-read-only)) @@ -456,10 +457,10 @@ the same menu with changes such as added new menu items." :help "Mark the whole buffer for a subsequent cut/copy")) menu) -(defun context-menu-ffap (menu) +(defun context-menu-ffap (menu click) "File at point menu." (save-excursion - (mouse-set-point last-input-event) + (mouse-set-point click) (when (ffap-guess-file-name-at-point) (define-key menu [ffap-separator] menu-bar-separator) (define-key menu [ffap-at-mouse] diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 90301e92ac..62f19925f6 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1021,7 +1021,7 @@ the like." ["Toggle Paragraph Direction" eww-toggle-paragraph-direction])) map)) -(defun eww-context-menu (menu) +(defun eww-context-menu (menu click) (define-key menu [eww-separator] menu-bar-separator) (let ((easy-menu (make-sparse-keymap "Eww"))) (easy-menu-define nil easy-menu nil @@ -1035,8 +1035,8 @@ the like." (when (consp item) (define-key menu (vector (car item)) (cdr item))))) - (when (or (mouse-posn-property (event-start last-input-event) 'shr-url) - (mouse-posn-property (event-start last-input-event) 'image-url)) + (when (or (mouse-posn-property (event-start click) 'shr-url) + (mouse-posn-property (event-start click) 'image-url)) (define-key menu [shr-mouse-browse-url-new-window] `(menu-item "Follow URL in new window" ,(if browse-url-new-window-flag 'shr-mouse-browse-url diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el index 2c43d0f753..97230f42fe 100644 --- a/lisp/net/goto-addr.el +++ b/lisp/net/goto-addr.el @@ -124,8 +124,8 @@ will have no effect.") m) "Keymap to hold goto-addr's mouse key defs under highlighted URLs.") -(defun goto-address-context-menu (menu) - (when (mouse-posn-property (event-start last-input-event) 'goto-address) +(defun goto-address-context-menu (menu click) + (when (mouse-posn-property (event-start click) 'goto-address) (define-key menu [goto-address-separator] menu-bar-separator) (define-key menu [goto-address-at-mouse] '(menu-item "Follow Link" goto-address-at-mouse diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index be9b72e47e..bd2c653638 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -43,12 +43,12 @@ display-line-numbers-mode prettify-symbols-mode)) -(defun prog-context-menu (menu) +(defun prog-context-menu (menu click) (require 'xref) (define-key-after menu [prog-separator] menu-bar-separator 'mark-whole-buffer) (when (save-excursion - (mouse-set-point last-input-event) + (mouse-set-point click) (xref-backend-identifier-at-point (xref-find-backend))) (define-key-after menu [xref-find-def] @@ -56,7 +56,7 @@ :help "Find definition of identifier") 'prog-separator)) (when (save-excursion - (mouse-set-point last-input-event) + (mouse-set-point click) (xref-backend-identifier-at-point (xref-find-backend))) (define-key-after menu [xref-find-ref] commit ff4de1bd88b8be4a7071884910ff601eb10fbad5 Author: Eli Zaretskii Date: Sun Sep 12 19:51:06 2021 +0300 Fix quoting style in Lisp comments * lisp/textmodes/rst.el: * lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions): * lisp/org/org.el: * lisp/org/org-list.el (org-list-to-generic): * lisp/org/org-compat.el: * lisp/hexl.el (hexl-ascii-region): * lisp/emacs-lisp/lisp-mode.el: * lisp/calendar/calendar.el: In comments, quote 'like this'. diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index fd97192c46..ebce2ae3dd 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -119,11 +119,11 @@ ;; Calendar has historically relied heavily on dynamic scoping. ;; Concretely, this manifests in the use of references to let-bound variables ;; in Custom vars as well as code in diary files. -;; `eval' is hence the core of the culprit. It's used on: +;; 'eval' is hence the core of the culprit. It's used on: ;; - calendar-date-display-form ;; - calendar-time-display-form ;; - calendar-chinese-time-zone -;; - in cal-dst's there are various calls to `eval' but they seem not to refer +;; - in cal-dst's there are various calls to 'eval' but they seem not to refer ;; to let-bound variables, surprisingly. ;; - calendar-date-echo-text ;; - calendar-mode-line-format diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 677da81144..9bbc7f8bba 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -624,7 +624,7 @@ Value for `adaptive-fill-function'." (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") "")) ;; Maybe this should be discouraged/obsoleted and users should be -;; encouraged to use `lisp-data-mode' instead. +;; encouraged to use 'lisp-data-mode' instead. (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive elisp) "Common initialization routine for lisp modes. diff --git a/lisp/hexl.el b/lisp/hexl.el index f236498288..3b048ba650 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -93,7 +93,7 @@ as that will override any bit grouping options set here." "Face used in address area of Hexl mode buffer.") (defface hexl-ascii-region - ;; Copied from `header-line'. We used to inherit from it, but that + ;; Copied from 'header-line'. We used to inherit from it, but that ;; looks awful when the headerline is given a variable-pitch font or ;; (even worse) a 3D look. '((((class color grayscale) (background light)) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 82611d907a..7f97ac9c2a 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -179,9 +179,9 @@ This is a floating point number if the size is too large for an integer." Case is significant." (string< s1 s2))) -;; The time- functions below translate nil to `current-time' and -;; accept an integer as of Emacs 25. `decode-time' and -;; `format-time-string' accept nil on Emacs 24 but don't accept an +;; The time- functions below translate nil to 'current-time' and +;; accept an integer as of Emacs 25. 'decode-time' and +;; 'format-time-string' accept nil on Emacs 24 but don't accept an ;; integer until Emacs 25. (if (< emacs-major-version 25) (let ((convert diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index b26e47aba9..ddb47dd190 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -3355,7 +3355,7 @@ Valid parameters are: (when (and backend (symbolp backend) (not (org-export-get-backend backend))) (user-error "Unknown :backend value")) (unless backend (require 'ox-org)) - ;; When `:raw' property has a non-nil value, turn all objects back + ;; When ':raw' property has a non-nil value, turn all objects back ;; into Org syntax. (when (and backend (plist-get params :raw)) (org-element-map data org-element-all-objects diff --git a/lisp/org/org.el b/lisp/org/org.el index dc56948b53..d03676e3fb 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -19651,15 +19651,15 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks." ;; example-block) don't accept comments. Usual Emacs comment commands ;; cannot cope with those requirements. Therefore, Org replaces them. -;; Org still relies on `comment-dwim', but cannot trust -;; `comment-only-p'. So, `comment-region-function' and -;; `uncomment-region-function' both point -;; to `org-comment-or-uncomment-region'. Eventually, -;; `org-insert-comment' takes care of insertion of comments at the +;; Org still relies on 'comment-dwim', but cannot trust +;; 'comment-only-p'. So, 'comment-region-function' and +;; 'uncomment-region-function' both point +;; to 'org-comment-or-uncomment-region'. Eventually, +;; 'org-insert-comment' takes care of insertion of comments at the ;; beginning of line. -;; `org-setup-comments-handling' install comments related variables -;; during `org-mode' initialization. +;; 'org-setup-comments-handling' install comments related variables +;; during 'org-mode' initialization. (defun org-setup-comments-handling () (interactive) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 22150c7d82..8befae0dec 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -883,7 +883,7 @@ there are no matches for variables." (secondary-xrefs nil)) ; other xrefs (let ((temp elisp-xref-find-def-functions)) - ;; FIXME: The `elisp-xref-find-def-functions' function interface does + ;; FIXME: The 'elisp-xref-find-def-functions' function interface does ;; not allow for namespace filtering so we tacitly assume they all match. (while (and (null xrefs) temp) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 46654b6076..ed1d721f82 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -2444,7 +2444,7 @@ PREFER-ROMAN roman numbering is preferred over using letters." tab)) ;; FIXME: At least the continuation may be folded into -;; `newline-and-indent'. However, this may not be wanted by everyone so +;; 'newline-and-indent'. However, this may not be wanted by everyone so ;; it should be possible to switch this off. (defun rst-insert-list (&optional prefer-roman) ;; testcover: ok. @@ -2915,7 +2915,7 @@ error if there is no working link at the given position." (pop-to-buffer (marker-buffer mrkr)) (goto-char mrkr) ;; FIXME: Should be a customizable number of lines from beginning or end of - ;; window just like the argument to `recenter'. It would be ideal if + ;; window just like the argument to 'recenter'. It would be ideal if ;; the adornment is always completely visible. (recenter 5))) @@ -2995,7 +2995,7 @@ burying it." (define-derived-mode rst-toc-mode special-mode "ReST-TOC" "Major mode for output from \\[rst-toc], the table-of-contents for the document. \\{rst-toc-mode-map}" - ;; FIXME: `revert-buffer-function' must be defined so `revert-buffer' works + ;; FIXME: 'revert-buffer-function' must be defined so 'revert-buffer' works ;; as expected for a special mode. In particular the referred buffer ;; needs to be rescanned and the TOC must be updated accordingly. ;; FIXME: Should contain the name of the buffer this is the toc of. @@ -3217,7 +3217,7 @@ Return a list of tabs sorted by likeliness to continue writing like `rst-line-tabs'. Nearer lines have generally a higher likeliness than farther lines. Return nil if no tab is found in the text above." - ;; FIXME: See test `indent-for-tab-command-BUGS'. + ;; FIXME: See test 'indent-for-tab-command-BUGS'. (save-excursion (goto-char pt) (let (leftmost ; Leftmost column found so far. commit 1ccc31eff5b6993042cea7df565d6484984701c2 Author: Juri Linkov Date: Sun Sep 12 19:47:20 2021 +0300 * lisp/mouse.el (context-menu-map): Remove duplicate separators (bug#50067). * lisp/mouse.el (context-menu-undo, context-menu-region): * lisp/progmodes/prog-mode.el (prog-context-menu): Use 'when' instead of ':visible' that allows to remove duplicate separators created between empty submenus. diff --git a/lisp/mouse.el b/lisp/mouse.el index 8c6fb2c71b..f7ade5f89a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -315,7 +315,15 @@ the same menu with changes such as added new menu items." (lambda (fun) (setq menu (funcall fun menu)) nil)))) - ;; TODO: remove double separators + + ;; Remove duplicate separators + (let ((l menu)) + (while l + (when (and (equal (cdr-safe (car l)) menu-bar-separator) + (equal (cdr-safe (cadr l)) menu-bar-separator)) + (setcdr l (cddr l))) + (setq l (cdr l)))) + (when (functionp context-menu-filter-function) (setq menu (funcall context-menu-filter-function menu))) menu)) @@ -387,68 +395,62 @@ the same menu with changes such as added new menu items." (defun context-menu-undo (menu) "Undo menu." - (when (cddr menu) - (define-key-after menu [separator-undo] menu-bar-separator)) - (define-key-after menu [undo] - '(menu-item "Undo" undo - :visible (and (not buffer-read-only) - (not (eq t buffer-undo-list)) - (if (eq last-command 'undo) - (listp pending-undo-list) - (consp buffer-undo-list))) - :help "Undo last edits")) - (define-key-after menu [undo-redo] - '(menu-item "Redo" undo-redo - :visible (and (not buffer-read-only) - (undo--last-change-was-undo-p buffer-undo-list)) - :help "Redo last undone edits")) + (define-key-after menu [separator-undo] menu-bar-separator) + (when (and (not buffer-read-only) + (not (eq t buffer-undo-list)) + (if (eq last-command 'undo) + (listp pending-undo-list) + (consp buffer-undo-list))) + (define-key-after menu [undo] + '(menu-item "Undo" undo + :help "Undo last edits"))) + (when (and (not buffer-read-only) + (undo--last-change-was-undo-p buffer-undo-list)) + (define-key-after menu [undo-redo] + '(menu-item "Redo" undo-redo + :help "Redo last undone edits"))) menu) (defun context-menu-region (menu) "Region commands menu." - (when (cddr menu) - (define-key-after menu [separator-region] menu-bar-separator)) - (define-key-after menu [cut] - '(menu-item "Cut" kill-region - :visible (and mark-active (not buffer-read-only)) - :help - "Cut (kill) text in region between mark and current position")) - (define-key-after menu [copy] - ;; ns-win.el said: Substitute a Copy function that works better - ;; under X (for GNUstep). - `(menu-item "Copy" ,(if (featurep 'ns) - 'ns-copy-including-secondary - 'kill-ring-save) - :visible mark-active - :help "Copy text in region between mark and current position" - :keys ,(if (featurep 'ns) - "\\[ns-copy-including-secondary]" - "\\[kill-ring-save]"))) - (define-key-after menu [paste] - `(menu-item "Paste" mouse-yank-at-click - :visible (funcall - ',(lambda () - (and (or - (gui-backend-selection-exists-p 'CLIPBOARD) - (if (featurep 'ns) ; like paste-from-menu - (cdr yank-menu) - kill-ring)) - (not buffer-read-only)))) - :help "Paste (yank) text most recently cut/copied")) - (define-key-after menu (if (featurep 'ns) [select-paste] - [paste-from-menu]) - ;; ns-win.el said: Change text to be more consistent with - ;; surrounding menu items `paste', etc." - `(menu-item ,(if (featurep 'ns) "Select and Paste" "Paste from Kill Menu") - yank-menu - :visible (and (cdr yank-menu) (not buffer-read-only)) - :help "Choose a string from the kill ring and paste it")) - (define-key-after menu [clear] - '(menu-item "Clear" delete-active-region - :visible (and mark-active - (not buffer-read-only)) - :help - "Delete the text in region between mark and current position")) + (define-key-after menu [separator-region] menu-bar-separator) + (when (and mark-active (not buffer-read-only)) + (define-key-after menu [cut] + '(menu-item "Cut" kill-region + :help + "Cut (kill) text in region between mark and current position"))) + (when mark-active + (define-key-after menu [copy] + ;; ns-win.el said: Substitute a Copy function that works better + ;; under X (for GNUstep). + `(menu-item "Copy" ,(if (featurep 'ns) + 'ns-copy-including-secondary + 'kill-ring-save) + :help "Copy text in region between mark and current position" + :keys ,(if (featurep 'ns) + "\\[ns-copy-including-secondary]" + "\\[kill-ring-save]")))) + (when (and (or (gui-backend-selection-exists-p 'CLIPBOARD) + (if (featurep 'ns) ; like paste-from-menu + (cdr yank-menu) + kill-ring)) + (not buffer-read-only)) + (define-key-after menu [paste] + `(menu-item "Paste" mouse-yank-at-click + :help "Paste (yank) text most recently cut/copied"))) + (when (and (cdr yank-menu) (not buffer-read-only)) + (define-key-after menu (if (featurep 'ns) [select-paste] + [paste-from-menu]) + ;; ns-win.el said: Change text to be more consistent with + ;; surrounding menu items `paste', etc." + `(menu-item ,(if (featurep 'ns) "Select and Paste" "Paste from Kill Menu") + yank-menu + :help "Choose a string from the kill ring and paste it"))) + (when (and mark-active (not buffer-read-only)) + (define-key-after menu [clear] + '(menu-item "Clear" delete-active-region + :help + "Delete the text in region between mark and current position"))) (define-key-after menu [mark-whole-buffer] '(menu-item "Select All" mark-whole-buffer :help "Mark the whole buffer for a subsequent cut/copy")) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index f75a3039d3..be9b72e47e 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -47,27 +47,27 @@ (require 'xref) (define-key-after menu [prog-separator] menu-bar-separator 'mark-whole-buffer) - (define-key-after menu [xref-find-def] - '(menu-item "Find Definition" xref-find-definitions-at-mouse - :visible (save-excursion - (mouse-set-point last-input-event) - (xref-backend-identifier-at-point - (xref-find-backend))) - :help "Find definition of identifier") - 'prog-separator) - (define-key-after menu [xref-find-ref] - '(menu-item "Find References" xref-find-references-at-mouse - :visible (save-excursion - (mouse-set-point last-input-event) - (xref-backend-identifier-at-point - (xref-find-backend))) - :help "Find references to identifier") - 'xref-find-def) - (define-key-after menu [xref-pop] - '(menu-item "Back Definition" xref-pop-marker-stack - :visible (not (xref-marker-stack-empty-p)) - :help "Back to the position of the last search") - 'xref-find-ref) + (when (save-excursion + (mouse-set-point last-input-event) + (xref-backend-identifier-at-point + (xref-find-backend))) + (define-key-after menu [xref-find-def] + '(menu-item "Find Definition" xref-find-definitions-at-mouse + :help "Find definition of identifier") + 'prog-separator)) + (when (save-excursion + (mouse-set-point last-input-event) + (xref-backend-identifier-at-point + (xref-find-backend))) + (define-key-after menu [xref-find-ref] + '(menu-item "Find References" xref-find-references-at-mouse + :help "Find references to identifier") + 'xref-find-def)) + (when (not (xref-marker-stack-empty-p)) + (define-key-after menu [xref-pop] + '(menu-item "Back Definition" xref-pop-marker-stack + :help "Back to the position of the last search") + 'xref-find-ref)) menu) (defvar prog-mode-map commit fc4b956c7cb2fba8ed2a18865a7686c6cfa5d030 Author: Stefan Kangas Date: Sun Sep 12 18:33:03 2021 +0200 ; Fix symbol quoting typos diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el index 914f8d2f1b..162a3ec23c 100644 --- a/lisp/auth-source-pass.el +++ b/lisp/auth-source-pass.el @@ -176,7 +176,7 @@ CONTENTS is the contents of a password-store formatted file." lines)))) (defun auth-source-pass--do-debug (&rest msg) - "Call `auth-source-do-debug` with MSG and a prefix." + "Call `auth-source-do-debug' with MSG and a prefix." (apply #'auth-source-do-debug (cons (concat "auth-source-pass: " (car msg)) (cdr msg)))) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 7c929ebed0..fd97192c46 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -119,7 +119,7 @@ ;; Calendar has historically relied heavily on dynamic scoping. ;; Concretely, this manifests in the use of references to let-bound variables ;; in Custom vars as well as code in diary files. -;; `eval` is hence the core of the culprit. It's used on: +;; `eval' is hence the core of the culprit. It's used on: ;; - calendar-date-display-form ;; - calendar-time-display-form ;; - calendar-chinese-time-zone diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index d6ef796047..5d34b308d0 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -198,7 +198,7 @@ Argument COLLECTOR is an object which can be used to calculate a list of possible hits. See `semantic-completion-collector-engine' for details on COLLECTOR. Argument DISPLAYER is an object used to display a list of possible -completions for a given prefix. See`semantic-completion-display-engine' +completions for a given prefix. See `semantic-completion-display-engine' for details on DISPLAYER. PROMPT is a string to prompt with. DEFAULT-TAG is a semantic tag or string to use as the default value. @@ -746,7 +746,7 @@ Argument COLLECTOR is an object which can be used to calculate a list of possible hits. See `semantic-completion-collector-engine' for details on COLLECTOR. Argument DISPLAYER is an object used to display a list of possible -completions for a given prefix. See`semantic-completion-display-engine' +completions for a given prefix. See `semantic-completion-display-engine' for details on DISPLAYER. BUFFER is the buffer in which completion will take place. START is a location for the start of the full symbol. diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el index efebe21a94..0694b9c232 100644 --- a/lisp/cedet/semantic/dep.el +++ b/lisp/cedet/semantic/dep.el @@ -133,7 +133,7 @@ Changes made by this function are not persistent." ;;;###autoload (defun semantic-remove-system-include (dir &optional mode) "Add a system include DIR to path for MODE. -Modifies a mode-local version of`semantic-dependency-system-include-path'. +Modifies a mode-local version of `semantic-dependency-system-include-path'. Changes made by this function are not persistent." (interactive (list diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4ea583d28f..16308b3a59 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3277,7 +3277,7 @@ the form NAME which is a shorthand for (NAME NAME)." (defun cl-struct-sequence-type (struct-type) "Return the sequence used to build STRUCT-TYPE. STRUCT-TYPE is a symbol naming a struct type. Return `record', -`vector`, or `list' if STRUCT-TYPE is a struct type, nil otherwise." +`vector', or `list' if STRUCT-TYPE is a struct type, nil otherwise." (declare (side-effect-free t) (pure t)) (cl--struct-class-type (cl--struct-get-class struct-type))) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 51fb88502a..677da81144 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -624,7 +624,7 @@ Value for `adaptive-fill-function'." (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") "")) ;; Maybe this should be discouraged/obsoleted and users should be -;; encouraged to use `lisp-data-mode` instead. +;; encouraged to use `lisp-data-mode' instead. (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive elisp) "Common initialization routine for lisp modes. diff --git a/lisp/files-x.el b/lisp/files-x.el index 9e1954256a..c7cc076f84 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -673,7 +673,7 @@ in order." (defun hack-connection-local-variables (criteria) "Read connection-local variables according to CRITERIA. Store the connection-local variables in buffer local -variable`connection-local-variables-alist'. +variable `connection-local-variables-alist'. This does nothing if `enable-connection-local-variables' is nil." (when enable-connection-local-variables diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index d52bd26a2c..5009507208 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2140,8 +2140,9 @@ instance, to switch off all visual things except menus, you can say: Valid elements include `summary-highlight', `group-highlight', `article-highlight', `mouse-face', `summary-menu', `group-menu', -`article-menu', `tree-highlight', `menu', `highlight', `browse-menu', -`server-menu', `page-marker', `tree-menu', `binary-menu', and`pick-menu'." +`article-menu', `tree-highlight', `menu', `highlight', +`browse-menu', `server-menu', `page-marker', `tree-menu', +`binary-menu', and `pick-menu'." :group 'gnus-meta :group 'gnus-visual :type '(set (const summary-highlight) diff --git a/lisp/hexl.el b/lisp/hexl.el index 8bfc1fb89e..f236498288 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -93,7 +93,7 @@ as that will override any bit grouping options set here." "Face used in address area of Hexl mode buffer.") (defface hexl-ascii-region - ;; Copied from `header-line`. We used to inherit from it, but that + ;; Copied from `header-line'. We used to inherit from it, but that ;; looks awful when the headerline is given a variable-pitch font or ;; (even worse) a 3D look. '((((class color grayscale) (background light)) diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 542cbef9f5..586e4233c5 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -8735,7 +8735,7 @@ BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running MODE-hook. Before the actual body code, you can write keyword arguments, i.e. alternating keywords and values. If you provide BODY, then you must - provide at least one keyword argument (e.g. `:lighter nil`). + provide at least one keyword argument (e.g. `:lighter nil'). The following special keywords are supported (other keywords are passed to `defcustom' if the minor mode is global): diff --git a/lisp/obsolete/rcompile.el b/lisp/obsolete/rcompile.el index d7020f0d07..ff7d1dcdce 100644 --- a/lisp/obsolete/rcompile.el +++ b/lisp/obsolete/rcompile.el @@ -108,7 +108,7 @@ nil means run no commands." ;;;; entry point -;; We use the Tramp internal function`tramp-make-tramp-file-name'. +;; We use the Tramp internal function `tramp-make-tramp-file-name'. ;; Better would be, if there are functions to provide user, host and ;; localname of a remote filename, independent of Tramp's implementation. ;; The function calls are wrapped by `funcall' in order to pacify the byte diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el index 947acef1b2..0a08925d4f 100644 --- a/lisp/org/ob-sql.el +++ b/lisp/org/ob-sql.el @@ -189,8 +189,8 @@ Otherwise, use Emacs' standard conversion function." "Return database connection parameter NAME. Given a parameter NAME, if :dbconnection is defined in PARAMS then look for the parameter into the corresponding connection -defined in `sql-connection-alist`, otherwise look into PARAMS. -Look `sql-connection-alist` (part of SQL mode) for how to define +defined in `sql-connection-alist', otherwise look into PARAMS. +See `sql-connection-alist' (part of SQL mode) for how to define database connections." (if (assq :dbconnection params) (let* ((dbconnection (cdr (assq :dbconnection params))) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index b68e5b58fc..82611d907a 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -179,9 +179,9 @@ This is a floating point number if the size is too large for an integer." Case is significant." (string< s1 s2))) -;; The time- functions below translate nil to `current-time` and -;; accept an integer as of Emacs 25. `decode-time` and -;; `format-time-string` accept nil on Emacs 24 but don't accept an +;; The time- functions below translate nil to `current-time' and +;; accept an integer as of Emacs 25. `decode-time' and +;; `format-time-string' accept nil on Emacs 24 but don't accept an ;; integer until Emacs 25. (if (< emacs-major-version 25) (let ((convert diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index f97164ee33..b26e47aba9 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -3355,7 +3355,7 @@ Valid parameters are: (when (and backend (symbolp backend) (not (org-export-get-backend backend))) (user-error "Unknown :backend value")) (unless backend (require 'ox-org)) - ;; When`:raw' property has a non-nil value, turn all objects back + ;; When `:raw' property has a non-nil value, turn all objects back ;; into Org syntax. (when (and backend (plist-get params :raw)) (org-element-map data org-element-all-objects diff --git a/lisp/org/org.el b/lisp/org/org.el index f560c65dc4..dc56948b53 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -19654,7 +19654,7 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks." ;; Org still relies on `comment-dwim', but cannot trust ;; `comment-only-p'. So, `comment-region-function' and ;; `uncomment-region-function' both point -;; to`org-comment-or-uncomment-region'. Eventually, +;; to `org-comment-or-uncomment-region'. Eventually, ;; `org-insert-comment' takes care of insertion of comments at the ;; beginning of line. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 4f3ca924dd..165834cc20 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1304,7 +1304,7 @@ package name and for the version.") (regexp ,cperl--version-regexp))) ,cperl--ws*-rx (group-n 3 (or ";" "{"))) - "A regular expression to collect package names for `imenu`. + "A regular expression to collect package names for `imenu'. Catches \"package NAME;\", \"package NAME VERSION;\", \"package NAME BLOCK\" and \"package NAME VERSION BLOCK.\" Contains three groups: One for the keyword \"package\", one for the package @@ -1345,7 +1345,7 @@ heading text.") `(or ,cperl--package-for-imenu-rx ,cperl--sub-name-for-imenu-rx ,cperl--pod-heading-rx) - "A regular expression to collect stuff that goes into the `imenu` index. + "A regular expression to collect stuff that goes into the `imenu' index. Covers packages, subroutines, and POD headings.") ;; end of eval-and-compiled stuff @@ -5454,7 +5454,7 @@ indentation and initial hashes. Behaves usually outside of comment." (defvar cperl-imenu-pod-keywords '("=head")) (defun cperl-imenu--create-perl-index () - "Implement `imenu-create-index-function` for CPerl mode. + "Implement `imenu-create-index-function' for CPerl mode. This function relies on syntaxification to exclude lines which look like declarations but actually are part of a string, a comment, or POD." diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 483bf9d2ed..22150c7d82 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -883,7 +883,7 @@ there are no matches for variables." (secondary-xrefs nil)) ; other xrefs (let ((temp elisp-xref-find-def-functions)) - ;; FIXME: The `elisp-xref-find-def-functions` function interface does + ;; FIXME: The `elisp-xref-find-def-functions' function interface does ;; not allow for namespace filtering so we tacitly assume they all match. (while (and (null xrefs) temp) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 1471be0ecd..46654b6076 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -2444,7 +2444,7 @@ PREFER-ROMAN roman numbering is preferred over using letters." tab)) ;; FIXME: At least the continuation may be folded into -;; `newline-and-indent`. However, this may not be wanted by everyone so +;; `newline-and-indent'. However, this may not be wanted by everyone so ;; it should be possible to switch this off. (defun rst-insert-list (&optional prefer-roman) ;; testcover: ok. @@ -2915,7 +2915,7 @@ error if there is no working link at the given position." (pop-to-buffer (marker-buffer mrkr)) (goto-char mrkr) ;; FIXME: Should be a customizable number of lines from beginning or end of - ;; window just like the argument to `recenter`. It would be ideal if + ;; window just like the argument to `recenter'. It would be ideal if ;; the adornment is always completely visible. (recenter 5))) @@ -2995,7 +2995,7 @@ burying it." (define-derived-mode rst-toc-mode special-mode "ReST-TOC" "Major mode for output from \\[rst-toc], the table-of-contents for the document. \\{rst-toc-mode-map}" - ;; FIXME: `revert-buffer-function` must be defined so `revert-buffer` works + ;; FIXME: `revert-buffer-function' must be defined so `revert-buffer' works ;; as expected for a special mode. In particular the referred buffer ;; needs to be rescanned and the TOC must be updated accordingly. ;; FIXME: Should contain the name of the buffer this is the toc of. @@ -3217,7 +3217,7 @@ Return a list of tabs sorted by likeliness to continue writing like `rst-line-tabs'. Nearer lines have generally a higher likeliness than farther lines. Return nil if no tab is found in the text above." - ;; FIXME: See test `indent-for-tab-command-BUGS`. + ;; FIXME: See test `indent-for-tab-command-BUGS'. (save-excursion (goto-char pt) (let (leftmost ; Leftmost column found so far. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index f6ae27075f..4fcba65ab4 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -515,7 +515,7 @@ ;; ;; Turn on the mode used for editing the check in log. This ;; defaults to `log-edit-mode'. If changed, it should use a mode -;; derived from`log-edit-mode'. +;; derived from `log-edit-mode'. ;; ;; - check-headers () ;; diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el index d050ac5b69..a0a97eca5e 100644 --- a/test/lisp/auth-source-pass-tests.el +++ b/test/lisp/auth-source-pass-tests.el @@ -56,10 +56,10 @@ ("key2" . "please: keep my space after colon")))))) (defvar auth-source-pass--debug-log nil - "Contains a list of all messages passed to `auth-source-do-debug`.") + "Contains a list of all messages passed to `auth-source-do-debug'.") (defun auth-source-pass--have-message-matching (regexp) - "Return non-nil iff at least one `auth-source-do-debug` match REGEXP." + "Return non-nil iff at least one `auth-source-do-debug' match REGEXP." (seq-find (lambda (message) (string-match regexp message)) auth-source-pass--debug-log)) @@ -75,8 +75,8 @@ REGEXP is the same as in `auth-source-pass--have-message-matching'." (put #'auth-source-pass--have-message-matching 'ert-explainer #'auth-source-pass--explain--have-message-matching) (defun auth-source-pass--debug (&rest msg) - "Format MSG and add that to `auth-source-pass--debug-log`. -This function is intended to be set to `auth-source-debug`." + "Format MSG and add that to `auth-source-pass--debug-log'. +This function is intended to be set to `auth-source-debug'." (add-to-list 'auth-source-pass--debug-log (apply #'format msg) t)) (defvar auth-source-pass--parse-log nil) diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index bda1b663c2..45e0c43598 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el @@ -60,7 +60,7 @@ (cl-defun flymake-tests--call-with-fixture (fn file &key (severity-predicate nil sev-pred-supplied-p)) - "Call FN after flymake setup in FILE, using `flymake-proc`. + "Call FN after flymake setup in FILE, using `flymake-proc'. SEVERITY-PREDICATE is used to setup `flymake-proc-diagnostic-type-pred'" (let* ((file (expand-file-name file flymake-tests-data-directory)) commit 79113b5e4a7d69ec0fb3401b763292d91b54632e Author: Juri Linkov Date: Sun Sep 12 19:31:49 2021 +0300 Use window-point in event-start and event-end (bug#50256) * lisp/subr.el (event-start, event-end): Provide window-point as an arg for posn-at-point, and for the constructed list. * lisp/help-mode.el (help-mode-context-menu): Remove a kludge that checked if window-buffer is current-buffer. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 08182b71be..d224bdcbcf 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -85,12 +85,7 @@ (when (consp item) (define-key menu (vector (car item)) (cdr item))))) - (when (and - ;; First check if `help-fns--list-local-commands' - ;; used `where-is-internal' to call this function - ;; with wrong `last-input-event'. - (eq (current-buffer) (window-buffer (posn-window (event-start last-input-event)))) - (mouse-posn-property (event-start last-input-event) 'mouse-face)) + (when (mouse-posn-property (event-start last-input-event) 'mouse-face) (define-key menu [help-mode-push-button] '(menu-item "Follow Link" (lambda (event) (interactive "e") diff --git a/lisp/subr.el b/lisp/subr.el index 6ae6d242a4..be13fc0d65 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1510,8 +1510,10 @@ nil or (STRING . POSITION)'. For more information, see Info node `(elisp)Click Events'." (if (consp event) (nth 1 event) - (or (posn-at-point) - (list (selected-window) (point) '(0 . 0) 0)))) + ;; Use `window-point' for the case when the current buffer + ;; is temporarily switched to some other buffer (bug#50256) + (or (posn-at-point (window-point)) + (list (selected-window) (window-point) '(0 . 0) 0)))) (defun event-end (event) "Return the ending position of EVENT. @@ -1519,8 +1521,10 @@ EVENT should be a click, drag, or key press event. See `event-start' for a description of the value returned." (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) - (or (posn-at-point) - (list (selected-window) (point) '(0 . 0) 0)))) + ;; Use `window-point' for the case when the current buffer + ;; is temporarily switched to some other buffer (bug#50256) + (or (posn-at-point (window-point)) + (list (selected-window) (window-point) '(0 . 0) 0)))) (defsubst event-click-count (event) "Return the multi-click count of EVENT, a click or drag event. commit 64c5cd5a8c30779a32bbb676c892c120b17fd35f Author: Juri Linkov Date: Sun Sep 12 19:10:02 2021 +0300 * lisp/tab-bar.el: Improve logic of 'ignore-current-tab'. * lisp/tab-bar.el (tab-bar-get-buffer-tab): Prefer the current tab when 'ignore-current-tab' is nil. (display-buffer-in-tab): Use alist entry 'ignore-current-tab' as the third arg of 'tab-bar-get-buffer-tab'. Improve docstring. Suggested by Feng Shu https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg00955.html diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index ab6595e45e..e30a5c4411 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1917,11 +1917,12 @@ The optional argument ALL-FRAMES specifies the frames to consider: - A frame means consider all tabs on that frame only. -Any other value of ALL-FRAMES means consider all tabs on the +- Any other value of ALL-FRAMES means consider all tabs on the selected frame and no others. When the optional argument IGNORE-CURRENT-TAB is non-nil, -don't take into account the buffers in the currently selected tab." +don't take into account the buffers in the currently selected tab. +Otherwise, prefer buffers of the current tab." (let ((buffer (if buffer-or-name (get-buffer buffer-or-name) (current-buffer)))) @@ -1931,8 +1932,7 @@ don't take into account the buffers in the currently selected tab." (seq-some (lambda (tab) (when (if (eq (car tab) 'current-tab) - (unless ignore-current-tab - (get-buffer-window buffer frame)) + (get-buffer-window buffer frame) (let* ((state (alist-get 'ws tab)) (buffers (when state (window-state-buffers state)))) @@ -1943,7 +1943,14 @@ don't take into account the buffers in the currently selected tab." (member (buffer-name buffer) buffers)))) (append tab `((index . ,(tab-bar--tab-index tab nil frame)) (frame . ,frame))))) - (funcall tab-bar-tabs-function frame))) + (let* ((tabs (funcall tab-bar-tabs-function frame)) + (current-tab (tab-bar--current-tab-find tabs))) + (seq-remove (lambda (tab) (eq (car tab) 'current-tab)) tabs) + (if ignore-current-tab + ;; Use tabs without current-tab. + tabs + ;; Make sure current-tab is at the beginning of tabs. + (cons current-tab tabs))))) (tab-bar--reusable-frames all-frames))))) (defun display-buffer-in-tab (buffer alist) @@ -1963,19 +1970,26 @@ The ALIST entry `tab-group' (string or function) defines the tab group. If ALIST contains a `reusable-frames' entry, its value determines which frames to search for a reusable tab: - nil -- the selected frame (actually the last non-minibuffer frame) - A frame -- just that frame - `visible' -- all visible frames - 0 -- all frames on the current terminal - t -- all frames. + nil -- do not reuse any frames; + a frame -- just that frame; + `visible' -- all visible frames; + 0 -- all frames on the current terminal; + t -- all frames; + other non-nil values -- use the selected frame. + +If ALIST contains a non-nil `ignore-current-tab' entry, then the buffers +of the current tab are skipped when searching for a reusable tab. +Otherwise, prefer buffers of the current tab. This is an action function for buffer display, see Info node `(elisp) Buffer Display Action Functions'. It should be called only by `display-buffer' or a function directly or indirectly called by the latter." (let* ((reusable-frames (alist-get 'reusable-frames alist)) + (ignore-current-tab (alist-get 'ignore-current-tab alist)) (reusable-tab (when reusable-frames - (tab-bar-get-buffer-tab buffer reusable-frames)))) + (tab-bar-get-buffer-tab buffer reusable-frames + ignore-current-tab)))) (if reusable-tab (let* ((frame (alist-get 'frame reusable-tab)) (index (alist-get 'index reusable-tab))) commit 8f3199788beceb6c513809a11e6f99b66b8feb5c Author: Hanno Perrey Date: Sun Sep 12 17:22:25 2021 +0200 ; * lisp/eshell/em-unix.el (nil-blank-string): Doc fix * lisp/eshell/em-unix.el (nil-blank-string): Fix doc string (bug#50549). Copyright-paperwork-exempt: yes diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 7e48a9c757..5b400c74fc 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -968,7 +968,7 @@ Show wall-clock time elapsed during execution of COMMAND.") (set-window-configuration eshell-diff-window-config))) (defun nil-blank-string (string) - "Return STRING, or nil if STRING contains only non-blank characters." + "Return STRING, or nil if STRING contains only blank characters." (cond ((string-match "[^[:blank:]]" string) string) (nil))) commit 914d4523c3f0455dfd071d54b776a1db278aac4c Author: Eli Zaretskii Date: Sun Sep 12 18:04:02 2021 +0300 Minor copyedits in Emacs FAQ * doc/misc/efaq.texi (What was XEmacs?, Colors on a TTY): Fix wording and improve the description. diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index d5d1eb5e65..46f78220fe 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -1425,16 +1425,17 @@ of files from Macintosh, Microsoft, and Unix platforms. @cindex XEmacs XEmacs was a branch version of Emacs that is no longer actively -developed. XEmacs last released a new version on January 30, 2009, -and it lacks many important features that exist in Emacs. Since its -development has stopped, we do not expect to see any new releases. +developed. Originally known as ``Lucid Emacs'', XEmacs was forked +from a prerelease version of Emacs 19. XEmacs last released a new +version on January 30, 2009, which lacks many important features that +exist in Emacs. Since its development has stopped, we do not expect +to see any new releases. In the past, it was not uncommon for Emacs packages to include code for compatibility with XEmacs. Nowadays, most built-in and third party packages have either stopped supporting XEmacs or were developed exclusively for Emacs. -XEmacs was initially derived from a prerelease version of Emacs 19. If you want to talk about these two versions and distinguish them, please call them ``Emacs'' and ``XEmacs.'' To contrast ``XEmacs'' with ``GNU Emacs'' would be misleading, since XEmacs too has its @@ -1565,7 +1566,7 @@ capabilities. The command @kbd{M-x list-colors-display} pops up a window which exhibits all the colors Emacs knows about on the current display. -Syntax highlighting is on by default. +Syntax highlighting is also on by default on text-only terminals. @cindex direct color in terminals Emacs 26.1 and later support direct color mode in terminals. If Emacs commit 88beddbc40cea071c4c7f12c5d7eb4b0249506ba Author: Stefan Kangas Date: Sun Sep 12 13:14:34 2021 +0200 ; * doc/misc/efaq.texi (What was XEmacs?): Restore pre-merge text. diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index ea43c36dd0..d5d1eb5e65 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -1425,17 +1425,9 @@ of files from Macintosh, Microsoft, and Unix platforms. @cindex XEmacs XEmacs was a branch version of Emacs that is no longer actively -developed. XEmacs was first called Lucid Emacs, and was initially -derived from a prerelease version of Emacs 19. In this FAQ, we use -the name ``Emacs'' only for the official version. - -XEmacs last released a new version on January 30, 2009, and it lacks -many important features that exist in Emacs. In the past, it was not -uncommon for Emacs packages to include code for compatibility with -XEmacs. Nowadays, although some packages still maintain such -compatibility code, several of the more popular built-in and third -party packages have either stopped supporting XEmacs or were developed -exclusively for Emacs. +developed. XEmacs last released a new version on January 30, 2009, +and it lacks many important features that exist in Emacs. Since its +development has stopped, we do not expect to see any new releases. In the past, it was not uncommon for Emacs packages to include code for compatibility with XEmacs. Nowadays, most built-in and third party commit db5fbc7af85daafaff9dde39d1966b8c97a4abd2 Author: Lars Ingebrigtsen Date: Sun Sep 12 14:11:53 2021 +0200 Fix read-no-blanks-input doc string typo * lisp/minibuffer.el (read-no-blanks-input): Fix doc string typo. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 8a0122ae5f..539a2c28cd 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2683,7 +2683,7 @@ Such values are treated as in `read-from-minibuffer', but are normally not useful in this function.) Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits -the current input method and the setting of`enable-multibyte-characters'. +the current input method and the setting of `enable-multibyte-characters'. If `inhibit-interaction' is non-nil, this function will signal an `inhibited-interaction' error." commit ac2498ad1c25088f4b9561898d39948f33c57124 Author: dick r. chiang Date: Sun Sep 12 14:11:16 2021 +0200 Fix read-no-blanks-input history argument * lisp/minibuffer.el (read-no-blanks-input): Use the `minibuffer-history' symbol, not the value (bug#50535). diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 68e4fa17fc..8a0122ae5f 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2688,7 +2688,7 @@ the current input method and the setting of`enable-multibyte-characters'. If `inhibit-interaction' is non-nil, this function will signal an `inhibited-interaction' error." (read-from-minibuffer prompt initial minibuffer-local-ns-map - nil minibuffer-history nil inherit-input-method)) + nil 'minibuffer-history nil inherit-input-method)) ;;; Major modes for the minibuffer commit 4a44ac987e1357c8d4fdd18dd8cf902f5eec5401 Author: Mattias Engdegård Date: Tue Sep 7 18:21:57 2021 +0200 Infer identifier namespace in elisp xref backend Improve the accuracy of `xref-find-definitions` by inferring the likely namespace of the sought identifier from its context. This reduces the number of irrelevant search hits when it is clear what kind of identifier is being looked for (such as showing a variable when the user looks for a function). Co-written with Dmitry Gutov. * lisp/progmodes/elisp-mode.el (elisp--xref-list-index) (elisp--xref-infer-namespace, xref-backend-identifier-at-point): New. (xref-backend-definitions): Use the buffer position for inferring. (elisp--xref-find-definitions): Use the inferred namespace. (xref-backend-apropos): Adapt call. * test/lisp/progmodes/elisp-mode-tests.el (elisp-mode-test--with-buffer) (elisp-mode-with-buffer, elisp-mode-infer-namespace): New tests. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index ef36c1f087..483bf9d2ed 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -696,27 +696,207 @@ Each function should return a list of xrefs, or nil; the first non-nil result supersedes the xrefs produced by `elisp--xref-find-definitions'.") +(defun elisp--xref-list-index () + "Return the list index of the form at point, moving to the start. +If the buffer start was reached, return nil." + (let ((i 0)) + (while (condition-case nil + (let ((pt (point))) + (backward-sexp) + (< (point) pt)) + (scan-error nil)) + (setq i (1+ i))) + (and (not (bobp)) i))) + +(defun elisp--xref-infer-namespace (pos) + "Find the likely namespace of the identifier at POS. +Return one of `function', `variable' `maybe-variable', `feature', `face', or +`any' (indicating any namespace). `maybe-variable' indicates a variable +namespace but with lower confidence." + (save-excursion + (goto-char pos) + (cl-flet ((looking-at-sym () + (let ((val (save-excursion + (ignore-errors (read (current-buffer)))))) + (and (symbolp val) val)))) + (cond + ((and (eq (char-before pos) ?\') + (eq (char-before (1- pos)) ?#)) + ;; #'IDENT + 'function) + ((memq (char-before pos) '(?\' ?`)) + ;; 'IDENT or `IDENT -- try to disambiguate. + (backward-char) ; Step over ' + (let ((i (elisp--xref-list-index)) + (sym (looking-at-sym))) + (cond + ((eql i 1) + (cond + ((memq sym '( featurep require provide)) + 'feature) + ((memq sym + '( + ;; We are mostly interested in functions that take a + ;; function symbol as argument: + fboundp symbol-function fset + ;; ... but we include some common higher-order functions + ;; as well, even though the argument really should + ;; be #'-quoted: + function-get function-put + func-arity functionp + funcall funcall-interactively + apply mapcar mapc mapcan mapconcat + apply-partially + substitute-key-definition)) + 'function) + ((memq sym + '( + ;; Functions taking a variable symbol as first argument. + ;; More of these could be added for greater precision. + boundp set symbol-value + special-variable-p local-variable-p + local-variable-if-set-p + make-variable-buffer-local + default-value set-default make-local-variable + buffer-local-value)) + 'variable) + ((memq sym + '( + ;; FIXME: Add more functions taking a face + ;; symbol for greater precision. + facep face-name face-id)) + 'face) + (t 'any))) + ((and (eql i 2) + (memq sym '( global-set-key local-set-key + substitute-key-definition + add-hook))) + 'function) + ((and (eql i 3) + (memq sym '( define-key add-function))) + 'function) + (t 'any)))) + ((or (and (eq (char-before (1- pos)) ?,) + (eq (char-before pos) ?@)) + (eq (char-before pos) ?,)) + ;; ,IDENT or ,@IDENT + 'variable) + (t + ;; Unquoted name -- look at the context. General scheme: + ;; (K-HEAD ... (J-HEAD ... (I-HEAD ... IDENT + ;; ^ index K ^ index J ^ index I + (let* ((i (elisp--xref-list-index)) + (i-head (looking-at-sym)) + (i-paren (and i-head (eq (char-before) ?\() + (progn (backward-char) t))) + (i-quoted (and i-paren (memq (char-before) '(?\' ?`)))) + (j (and i-paren (elisp--xref-list-index))) + (j-head (and j (looking-at-sym))) + (j-paren (and j-head (eq (char-before) ?\() + (progn (backward-char) t))) + (j-quoted (and j-paren (memq (char-before) '(?\' ?`)))) + (k (and j-paren (elisp--xref-list-index))) + (k-head (and k (looking-at-sym))) + (k-paren (and k-head (eq (char-before) ?\() + (progn (backward-char) t))) + (k-quoted (and k-paren (memq (char-before) '(?\' ?`))))) + (cond + ((or i-quoted j-quoted k-quoted) + ;; '(... IDENT or '(... (... IDENT or '(... (... (... IDENT + 'any) + ((and (eql j 1) + (memq j-head '( let let* letrec dlet lambda))) + ;; (let (... IDENT + 'variable) + ((and (eql j 2) + (memq j-head '( defun defmacro defsubst + define-inline declare-function + defadvice + cl-defmethod cl-defgeneric))) + ;; (defun FUNC (... IDENT + 'variable) + ((eq j-head 'cond) + ;; (cond ... (... IDENT + 'variable) + ((and (eql k 1) + (memq k-head '( let let* letrec dlet ))) + ;; (let (... (... IDENT + 'variable) + ((eql i 0) + ;; (IDENT ... + 'function) + ((functionp i-head) + ;; (FUNC ... IDENT + 'variable) + ((and (eql i 1) + (cond + ((memq i-head '( function + defun defmacro defsubst + define-inline declare-function + defadvice + cl-defmethod cl-defgeneric)) + 'function) + ((memq i-head '( defvar defvar-local defconst defcustom)) + 'variable) + ((eq i-head 'defface) + 'face)))) + ((memq i-head '( if while and or when unless progn prog1 + let let* lambda defun defsubst defvar defconst)) + ;; arg to some common non-function forms + 'variable) + ;; Anything else: probably a variable, but since i-head may be + ;; a macro we cannot be sure. + (t 'maybe-variable)))))))) + +(cl-defmethod xref-backend-identifier-at-point ((_backend (eql 'elisp))) + (let ((bounds (bounds-of-thing-at-point 'symbol))) + (and bounds + (let ((ident (buffer-substring-no-properties + (car bounds) (cdr bounds)))) + ;; Use a property to transport the location of the identifier. + (propertize ident 'pos (car bounds)))))) + + (cl-defmethod xref-backend-definitions ((_backend (eql 'elisp)) identifier) (require 'find-func) - ;; FIXME: use information in source near point to filter results: - ;; (dvc-log-edit ...) - exclude 'feature - ;; (require 'dvc-log-edit) - only 'feature - ;; Semantic may provide additional information - ;; (let ((sym (intern-soft identifier))) (when sym - (elisp--xref-find-definitions sym)))) - -(defun elisp--xref-find-definitions (symbol) + (let* ((pos (get-text-property 0 'pos identifier)) + (namespace (if pos + (elisp--xref-infer-namespace pos) + 'any))) + (elisp--xref-find-definitions sym namespace))))) + +(defun elisp--xref-find-definitions (symbol &optional namespace) + "Return xrefs of definitions for SYMBOL in NAMESPACE. +NAMESPACE is one of: `function', `variable', `maybe-variable', `feature', +`face' or `any' (indicating any namespace). `maybe-variable' indicates a +variable namespace but will include definitions in other namespaces if +there are no matches for variables." + ;; FIXME: fix callers instead of having an optional argument + (unless namespace + (setq namespace 'any)) ;; The file name is not known when `symbol' is defined via interactive eval. - (let (xrefs) + (let ((maybe (eq namespace 'maybe-variable)) + (namespace (if (eq namespace 'maybe-variable) 'variable namespace)) + (xrefs nil) ; xrefs from NAMESPACE + (secondary-xrefs nil)) ; other xrefs (let ((temp elisp-xref-find-def-functions)) + ;; FIXME: The `elisp-xref-find-def-functions` function interface does + ;; not allow for namespace filtering so we tacitly assume they all match. (while (and (null xrefs) temp) (setq xrefs (append xrefs (funcall (pop temp) symbol))))) (unless xrefs + (cl-flet ((add-xref (found-in-ns type symbol file &optional summary) + (let ((xref (elisp--xref-make-xref type symbol file summary))) + (push xref (if (or (eq namespace found-in-ns) + (eq namespace 'any)) + xrefs + secondary-xrefs))))) + ;; alphabetical by result type symbol ;; FIXME: advised function; list of advice functions @@ -725,153 +905,161 @@ non-nil result supersedes the xrefs produced by ;; Coding system symbols do not appear in ‘load-history’, ;; so we can’t get a location for them. - (when (and (symbolp symbol) - (symbol-function symbol) - (symbolp (symbol-function symbol))) - ;; aliased function - (let* ((alias-symbol symbol) - (alias-file (symbol-file alias-symbol)) - (real-symbol (symbol-function symbol)) - (real-file (find-lisp-object-file-name real-symbol 'defun))) - - (when real-file - (push (elisp--xref-make-xref nil real-symbol real-file) xrefs)) - - (when alias-file - (push (elisp--xref-make-xref 'defalias alias-symbol alias-file) xrefs)))) - - (when (facep symbol) - (let ((file (find-lisp-object-file-name symbol 'defface))) - (when file - (push (elisp--xref-make-xref 'defface symbol file) xrefs)))) - - (when (fboundp symbol) - (let ((file (find-lisp-object-file-name symbol (symbol-function symbol))) - generic doc) - (when file - (cond - ((eq file 'C-source) - ;; First call to find-lisp-object-file-name for an object - ;; defined in C; the doc strings from the C source have - ;; not been loaded yet. Second call will return "src/*.c" - ;; in file; handled by 't' case below. - (push (elisp--xref-make-xref nil symbol (help-C-file-name (symbol-function symbol) 'subr)) xrefs)) - - ((and (setq doc (documentation symbol t)) - ;; This doc string is defined in cl-macs.el cl-defstruct - (string-match "Constructor for objects of type `\\(.*\\)'" doc)) - ;; `symbol' is a name for the default constructor created by - ;; cl-defstruct, so return the location of the cl-defstruct. - (let* ((type-name (match-string 1 doc)) - (type-symbol (intern type-name)) - (file (find-lisp-object-file-name type-symbol 'define-type)) - (summary (format elisp--xref-format-extra - 'cl-defstruct - (concat "(" type-name) - (concat "(:constructor " (symbol-name symbol) "))")))) - (push (elisp--xref-make-xref 'define-type type-symbol file summary) xrefs) - )) - - ((setq generic (cl--generic symbol)) - ;; FIXME: move this to elisp-xref-find-def-functions, in cl-generic.el - - ;; A generic function. If there is a default method, it - ;; will appear in the method table, with no - ;; specializers. - ;; - ;; If the default method is declared by the cl-defgeneric - ;; declaration, it will have the same location as the - ;; cl-defgeneric, so we want to exclude it from the - ;; result. In this case, it will have a null doc - ;; string. User declarations of default methods may also - ;; have null doc strings, but we hope that is - ;; rare. Perhaps this heuristic will discourage that. - (dolist (method (cl--generic-method-table generic)) - (let* ((info (cl--generic-method-info method));; qual-string combined-args doconly - (specializers (cl--generic-method-specializers method)) - (non-default nil) - (met-name (cl--generic-load-hist-format - symbol - (cl--generic-method-qualifiers method) - specializers)) - (file (find-lisp-object-file-name met-name 'cl-defmethod))) - (dolist (item specializers) - ;; default method has all 't' in specializers - (setq non-default (or non-default (not (equal t item))))) - - (when (and file - (or non-default - (nth 2 info))) ;; assuming only co-located default has null doc string - (if specializers - (let ((summary (format elisp--xref-format-extra 'cl-defmethod symbol (nth 1 info)))) - (push (elisp--xref-make-xref 'cl-defmethod met-name file summary) xrefs)) - - (let ((summary (format elisp--xref-format-extra 'cl-defmethod symbol "()"))) - (push (elisp--xref-make-xref 'cl-defmethod met-name file summary) xrefs)))) - )) - - (if (and (setq doc (documentation symbol t)) - ;; This doc string is created somewhere in - ;; cl--generic-make-function for an implicit - ;; defgeneric. - (string-match "\n\n(fn ARG &rest ARGS)" doc)) - ;; This symbol is an implicitly defined defgeneric, so - ;; don't return it. - nil - (push (elisp--xref-make-xref 'cl-defgeneric symbol file) xrefs)) - ) - - (t - (push (elisp--xref-make-xref nil symbol file) xrefs)) - )))) - - (when (boundp symbol) - ;; A variable - (let ((file (find-lisp-object-file-name symbol 'defvar))) - (when file - (cond - ((eq file 'C-source) - ;; The doc strings from the C source have not been loaded - ;; yet; help-C-file-name does that. Second call will - ;; return "src/*.c" in file; handled below. - (push (elisp--xref-make-xref 'defvar symbol (help-C-file-name symbol 'var)) xrefs)) - - ((string= "src/" (substring file 0 4)) - ;; The variable is defined in a C source file; don't check - ;; for define-minor-mode. - (push (elisp--xref-make-xref 'defvar symbol file) xrefs)) - - ((memq symbol minor-mode-list) - ;; The symbol is a minor mode. These should be defined by - ;; "define-minor-mode", which means the variable and the - ;; function are declared in the same place. So we return only - ;; the function, arbitrarily. - ;; - ;; There is an exception, when the variable is defined in C - ;; code, as for abbrev-mode. - ;; - ;; IMPROVEME: If the user is searching for the identifier at - ;; point, we can determine whether it is a variable or - ;; function by looking at the source code near point. - ;; - ;; IMPROVEME: The user may actually be asking "do any - ;; variables by this name exist"; we need a way to specify - ;; that. - nil) - - (t - (push (elisp--xref-make-xref 'defvar symbol file) xrefs)) - - )))) - - (when (featurep symbol) - (let ((file (ignore-errors - (find-library-name (symbol-name symbol))))) - (when file - (push (elisp--xref-make-xref 'feature symbol file) xrefs)))) - );; 'unless xrefs' - - xrefs)) + (when (and (symbolp symbol) + (symbol-function symbol) + (symbolp (symbol-function symbol))) + ;; aliased function + (let* ((alias-symbol symbol) + (alias-file (symbol-file alias-symbol)) + (real-symbol (symbol-function symbol)) + (real-file (find-lisp-object-file-name real-symbol 'defun))) + + (when real-file + (add-xref 'function nil real-symbol real-file)) + + (when alias-file + (add-xref 'function 'defalias alias-symbol alias-file)))) + + (when (facep symbol) + (let ((file (find-lisp-object-file-name symbol 'defface))) + (when file + (add-xref 'face 'defface symbol file)))) + + (when (fboundp symbol) + (let ((file (find-lisp-object-file-name symbol + (symbol-function symbol))) + generic doc) + (when file + (cond + ((eq file 'C-source) + ;; First call to find-lisp-object-file-name for an object + ;; defined in C; the doc strings from the C source have + ;; not been loaded yet. Second call will return "src/*.c" + ;; in file; handled by 't' case below. + (add-xref 'function nil symbol + (help-C-file-name (symbol-function symbol) 'subr))) + + ((and (setq doc (documentation symbol t)) + ;; This doc string is defined in cl-macs.el cl-defstruct + (string-match "Constructor for objects of type `\\(.*\\)'" + doc)) + ;; `symbol' is a name for the default constructor created by + ;; cl-defstruct, so return the location of the cl-defstruct. + (let* ((type-name (match-string 1 doc)) + (type-symbol (intern type-name)) + (file (find-lisp-object-file-name type-symbol + 'define-type)) + (summary (format elisp--xref-format-extra + 'cl-defstruct + (concat "(" type-name) + (concat "(:constructor " + (symbol-name symbol) + "))")))) + (add-xref 'function 'define-type type-symbol file summary))) + + ((setq generic (cl--generic symbol)) + ;; FIXME: move this to elisp-xref-find-def-functions, + ;; in cl-generic.el + + ;; A generic function. If there is a default method, it + ;; will appear in the method table, with no + ;; specializers. + ;; + ;; If the default method is declared by the cl-defgeneric + ;; declaration, it will have the same location as the + ;; cl-defgeneric, so we want to exclude it from the + ;; result. In this case, it will have a null doc + ;; string. User declarations of default methods may also + ;; have null doc strings, but we hope that is + ;; rare. Perhaps this heuristic will discourage that. + (dolist (method (cl--generic-method-table generic)) + (let* ((info (cl--generic-method-info method)) + ;; qual-string combined-args doconly + (specializers (cl--generic-method-specializers method)) + (non-default nil) + (met-name (cl--generic-load-hist-format + symbol + (cl--generic-method-qualifiers method) + specializers)) + (file (find-lisp-object-file-name met-name + 'cl-defmethod))) + (dolist (item specializers) + ;; default method has all 't' in specializers + (setq non-default (or non-default (not (equal t item))))) + + (when (and file + (or non-default + ;; assuming only co-located default has null + ;; doc string + (nth 2 info))) + (if specializers + (let ((summary (format elisp--xref-format-extra + 'cl-defmethod symbol + (nth 1 info)))) + (add-xref 'function + 'cl-defmethod met-name file summary)) + + (let ((summary (format elisp--xref-format-extra + 'cl-defmethod symbol "()"))) + (add-xref 'function + 'cl-defmethod met-name file summary)))))) + + (if (and (setq doc (documentation symbol t)) + ;; This doc string is created somewhere in + ;; cl--generic-make-function for an implicit + ;; defgeneric. + (string-match "\n\n(fn ARG &rest ARGS)" doc)) + ;; This symbol is an implicitly defined defgeneric, so + ;; don't return it. + nil + (add-xref 'function 'cl-defgeneric symbol file))) + + (t + (add-xref 'function nil symbol file)))))) + + (when (boundp symbol) + ;; A variable + (let ((file (find-lisp-object-file-name symbol 'defvar))) + (when file + (cond + ((eq file 'C-source) + ;; The doc strings from the C source have not been loaded + ;; yet; help-C-file-name does that. Second call will + ;; return "src/*.c" in file; handled below. + (add-xref 'variable + 'defvar symbol (help-C-file-name symbol 'var))) + + ((string= "src/" (substring file 0 4)) + ;; The variable is defined in a C source file; don't check + ;; for define-minor-mode. + (add-xref 'variable 'defvar symbol file)) + + ((memq symbol minor-mode-list) + ;; The symbol is a minor mode. These should be defined by + ;; "define-minor-mode", which means the variable and the + ;; function are declared in the same place. So we return only + ;; the function, arbitrarily, unless the search is in + ;; variable context, since it would be silly to have the + ;; user choose between both. + ;; + ;; There is an exception, when the variable is defined in C + ;; code, as for abbrev-mode. + (when (eq namespace 'variable) + (add-xref 'variable 'defvar symbol file))) + + (t + (add-xref 'variable 'defvar symbol file)))))) + + (when (featurep symbol) + (let ((file (ignore-errors + (find-library-name (symbol-name symbol))))) + (when file + (add-xref 'feature 'feature symbol file)))) + )) + + ;; If no xrefs consistent with the specified namespace were found + ;; and we weren't sure, use all other hits. + (or xrefs (and maybe secondary-xrefs)))) (declare-function xref-apropos-regexp "xref" (pattern)) @@ -880,7 +1068,8 @@ non-nil result supersedes the xrefs produced by (let ((regexp (xref-apropos-regexp pattern)) lst) (dolist (sym (apropos-internal regexp)) - (push (elisp--xref-find-definitions sym) lst)) + (push (elisp--xref-find-definitions sym 'any) + lst)) (nreverse lst)))) (defvar elisp--xref-identifier-completion-table diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 2745aff670..f80aca0ad4 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -899,5 +899,116 @@ to (xref-elisp-test-descr-to-target xref)." "(\\(when\\)") nil))) +(defmacro elisp-mode-test--with-buffer (text-with-pos &rest body) + "Eval BODY with buffer and variables from TEXT-WITH-POS. +All occurrences of {NAME} are removed from TEXT-WITH-POS and +the remaining text put in a buffer in `elisp-mode'. +Each NAME is then bound to its position in the text during the +evaluation of BODY." + (declare (indent 1)) + (let* ((annot-text (eval text-with-pos t)) + (pieces nil) + (positions nil) + (tlen (length annot-text)) + (ofs 0) + (text-ofs 0)) + (while + (and (< ofs tlen) + (let ((m (string-match (rx "{" (group (+ (not "}"))) "}") + annot-text ofs))) + (and m + (let ((var (intern (match-string 1 annot-text)))) + (push (substring annot-text ofs m) pieces) + (setq text-ofs (+ text-ofs (- m ofs))) + (push (list var (1+ text-ofs)) positions) + (setq ofs (match-end 0)) + t))))) + (push (substring annot-text ofs tlen) pieces) + (let ((text (apply #'concat (nreverse pieces))) + (bindings (nreverse positions))) + `(with-temp-buffer + (ert-info (,text :prefix "text: ") + (emacs-lisp-mode) + (insert ,text) + (let ,bindings . ,body)))))) + +(ert-deftest elisp-mode-with-buffer () + ;; Sanity test of macro, also demonstrating how it works. + (elisp-mode-test--with-buffer + "{a}123{b}45{c}6" + (should (equal a 1)) + (should (equal b 4)) + (should (equal c 6)) + (should (equal (buffer-string) "123456")))) + +(ert-deftest elisp-mode-infer-namespace () + (elisp-mode-test--with-buffer + (concat " ({p1}alphaX {p2}beta {p3}gamma '{p4}delta\n" + " #'{p5}epsilon `{p6}zeta `(,{p7}eta ,@{p8}theta))\n") + (should (equal (elisp--xref-infer-namespace p1) 'function)) + (should (equal (elisp--xref-infer-namespace p2) 'maybe-variable)) + (should (equal (elisp--xref-infer-namespace p3) 'maybe-variable)) + (should (equal (elisp--xref-infer-namespace p4) 'any)) + (should (equal (elisp--xref-infer-namespace p5) 'function)) + (should (equal (elisp--xref-infer-namespace p6) 'any)) + (should (equal (elisp--xref-infer-namespace p7) 'variable)) + (should (equal (elisp--xref-infer-namespace p8) 'variable))) + + (elisp-mode-test--with-buffer + (concat "(let ({p1}alpha {p2}beta ({p3}gamma {p4}delta))\n" + " ({p5}epsilon {p6}zeta)\n" + " {p7}eta)\n") + (should (equal (elisp--xref-infer-namespace p1) 'variable)) + (should (equal (elisp--xref-infer-namespace p2) 'variable)) + (should (equal (elisp--xref-infer-namespace p3) 'variable)) + (should (equal (elisp--xref-infer-namespace p4) 'variable)) + (should (equal (elisp--xref-infer-namespace p5) 'function)) + (should (equal (elisp--xref-infer-namespace p6) 'maybe-variable)) + (should (equal (elisp--xref-infer-namespace p7) 'variable))) + + (elisp-mode-test--with-buffer + (concat "(defun {p1}alpha () {p2}beta)\n" + "(defface {p3}gamma ...)\n" + "(defvar {p4}delta {p5}epsilon)\n" + "(function {p6}zeta)\n") + (should (equal (elisp--xref-infer-namespace p1) 'function)) + (should (equal (elisp--xref-infer-namespace p2) 'variable)) + (should (equal (elisp--xref-infer-namespace p3) 'face)) + (should (equal (elisp--xref-infer-namespace p4) 'variable)) + (should (equal (elisp--xref-infer-namespace p5) 'variable)) + (should (equal (elisp--xref-infer-namespace p6) 'function))) + + (elisp-mode-test--with-buffer + (concat "(require '{p1}alpha)\n" + "(fboundp '{p2}beta)\n" + "(boundp '{p3}gamma)\n" + "(facep '{p4}delta)\n" + "(define-key map [f1] '{p5}epsilon)\n") + (should (equal (elisp--xref-infer-namespace p1) 'feature)) + (should (equal (elisp--xref-infer-namespace p2) 'function)) + (should (equal (elisp--xref-infer-namespace p3) 'variable)) + (should (equal (elisp--xref-infer-namespace p4) 'face)) + (should (equal (elisp--xref-infer-namespace p5) 'function))) + + (elisp-mode-test--with-buffer + (concat "(list {p1}alpha {p2}beta)\n" + "(progn {p3}gamma {p4}delta)\n" + "(lambda ({p5}epsilon {p6}zeta) {p7}eta)\n") + (should (equal (elisp--xref-infer-namespace p1) 'variable)) + (should (equal (elisp--xref-infer-namespace p2) 'variable)) + (should (equal (elisp--xref-infer-namespace p3) 'variable)) + (should (equal (elisp--xref-infer-namespace p4) 'variable)) + (should (equal (elisp--xref-infer-namespace p5) 'variable)) + (should (equal (elisp--xref-infer-namespace p6) 'variable)) + (should (equal (elisp--xref-infer-namespace p7) 'variable))) + + (elisp-mode-test--with-buffer + (concat "'({p1}alpha {p2}beta\n" + " ({p3}gamma ({p4}delta)))\n") + (should (equal (elisp--xref-infer-namespace p1) 'any)) + (should (equal (elisp--xref-infer-namespace p2) 'any)) + (should (equal (elisp--xref-infer-namespace p3) 'any)) + (should (equal (elisp--xref-infer-namespace p4) 'any)))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here commit 4793c980a1b8428ee21f0853b0e9cbf71c75bb89 Author: Martin Rudalics Date: Sun Sep 12 11:38:24 2021 +0200 ;* lisp/window.el (switch-to-prev-buffer): Fix typo in doc-string. diff --git a/lisp/window.el b/lisp/window.el index 52cc2bdf0b..2960384e15 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4632,7 +4632,7 @@ another window. Also, if WINDOW's frame has a `buffer-predicate' parameter, that predicate may inhibit switching to certain buffers. -This function is called by `prev-buffer'." +This function is called by `previous-buffer'." (interactive) (let* ((window (window-normalize-window window t)) (frame (window-frame window)) commit 1293bf5bb7e18912f986c3acc2bd1ec584762608 Author: Martin Rudalics Date: Sun Sep 12 11:11:41 2021 +0200 Improve doc-strings of some buffer display options (Bug#50518) * lisp/window.el (pop-up-frame-alist, same-window-buffer-names) (same-window-regexps, pop-up-frames, pop-up-windows): In doc-strings say that these options are maintained for backward compatibility only (Bug#50518). diff --git a/lisp/window.el b/lisp/window.el index e14d472cf3..52cc2bdf0b 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -6567,9 +6567,6 @@ of the window used." (make-obsolete-variable 'display-buffer-function 'display-buffer-alist "24.3") -;; Eventually, we want to turn this into a defvar; instead of -;; customizing this, the user should use a `pop-up-frame-parameters' -;; alist entry in `display-buffer-base-action'. (defcustom pop-up-frame-alist nil "Alist of parameters for automatically generated new frames. If non-nil, the value you specify here is used by the default @@ -6579,7 +6576,12 @@ Since `pop-up-frame-function' is used by `display-buffer' for making new frames, any value specified here by default affects the automatic generation of new frames via `display-buffer' and all functions based on it. The behavior of `make-frame' is not -affected by this variable." +affected by this variable. + +This option is provided for backward compatibility only. New +code should use a `pop-up-frame-parameters' action alist entry in +`display-buffer-alist' instead. See Info node `(elisp) Choosing +Window Options' in the Emacs Lisp manual." :type '(repeat (cons :format "%v" (symbol :tag "Parameter") (sexp :tag "Value"))) @@ -6851,6 +6853,11 @@ the buffer name. This is for compatibility with `special-display-buffer-names'; the cdr of the cons cell is ignored. +This variable is provided for backward compatibility only and +should not be used in new code. Customize `display-buffer-alist' +instead. See Info node `(elisp) Choosing Window Options' in the +Emacs Lisp manual for an example. + See also `same-window-regexps'." :type '(repeat (string :format "%v")) :group 'windows) @@ -6866,6 +6873,11 @@ string. In that case, the cell's car must be a regexp matching the buffer name. This is for compatibility with `special-display-regexps'; the cdr of the cons cell is ignored. +This variable is provided for backward compatibility only and +should not be used in new code. Customize `display-buffer-alist' +instead. See Info node `(elisp) Choosing Window Options' in the +Emacs Lisp manual for an example. + See also `same-window-buffer-names'." :type '(repeat (regexp :format "%v")) :group 'windows) @@ -6897,7 +6909,13 @@ selected rather than (as usual) some other window. See If nil, never make a separate frame. If the value is `graphic-only', make a separate frame on graphic displays only. -Any other non-nil value means always make a separate frame." +Any other non-nil value means always make a separate frame. + +This variable is provided mainly for backward compatibility and +should not be used in new code. To make `display-buffer' behave +as if this were t, customize `display-buffer-base-action' +instead. See Info node `(elisp) Choosing Window Options' in the +Emacs Lisp manual for an example." :type '(choice (const :tag "Never" nil) (const :tag "On graphic displays only" graphic-only) @@ -6918,7 +6936,12 @@ that frame." "24.3") (defcustom pop-up-windows t - "Non-nil means `display-buffer' should make a new window." + "Non-nil means `display-buffer' should make a new window. +This variable is provided mainly for backward compatibility and +should not be used in new code. To make `display-buffer' behave +as if this were t, customize `display-buffer-base-action' +instead. See Info node `(elisp) Choosing Window Options' in the +Emacs Lisp manual for an example." :type 'boolean :group 'windows)