From 49cd3f7f2a77dfb1782dabcf8d55bf4a6810df0e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 25 Mar 2025 13:43:53 -0400 Subject: [PATCH] bookmark.el: Cosmetic changes * lisp/bookmark.el: Prefer # to quote function arguments. (bookmark-watch-bookmark-file): Remove redundant `:group`. (bookmark-bmenu-mode): Let `define-derived-mode` take care of `mode-class` property. (cherry picked from commit bc2b815f098751be700243cd0c47806a0d08dc68) --- lisp/bookmark.el | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 76dcbd07fe4..2cc04b8b228 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -98,8 +98,7 @@ This file defaults to `bookmark-default-file'. But during an Emacs session, :version "27.1" :type '(choice (const :tag "Suggest to reload bookmark file if changed" t) (const :tag "Silently reload bookmark file if changed" silent) - (const :tag "Ignore changes of bookmark file" nil)) - :group 'bookmark) + (const :tag "Ignore changes of bookmark file" nil))) (defcustom bookmark-version-control 'nospecial "Whether or not to make numbered backups of the bookmark file. @@ -377,7 +376,7 @@ type is read from the symbol property named (defun bookmark-all-names () "Return a list of all current bookmark names." (bookmark-maybe-load-default-file) - (mapcar 'bookmark-name-from-full-record bookmark-alist)) + (mapcar #'bookmark-name-from-full-record bookmark-alist)) (defun bookmark-get-bookmark (bookmark-name-or-record &optional noerror) @@ -617,7 +616,7 @@ If DEFAULT is nil then return empty string for empty input." (bookmark-maybe-load-default-file) ; paranoia (if (listp last-nonmenu-event) (bookmark-menu-popup-paned-menu t prompt - (mapcar 'bookmark-name-from-full-record + (mapcar #'bookmark-name-from-full-record (bookmark-maybe-sort-alist))) (let ((default (unless (equal "" default) default))) (minibuffer-with-setup-hook @@ -656,7 +655,7 @@ If DEFAULT is nil then return empty string for empty input." (concat "type=" (prin1-to-string (substring-no-properties type)))))) -(defvar bookmark-make-record-function 'bookmark-make-record-default +(defvar bookmark-make-record-function #'bookmark-make-record-default "A function that should be called to create a bookmark record. Modes may set this variable buffer-locally to enable bookmarking of locations that should be treated specially, such as Info nodes, @@ -967,7 +966,7 @@ CODING is the symbol of the coding-system in which the file is encoded." ;;; Core code: -(define-obsolete-function-alias 'bookmark-maybe-message 'message "27.1") +(define-obsolete-function-alias 'bookmark-maybe-message #'message "27.1") (defvar-keymap bookmark-minibuffer-read-name-map :doc "This variable is obsolete and no longer used.") @@ -1329,7 +1328,7 @@ DISPLAY-FUNC would be `switch-to-buffer-other-window'." (list (bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark))) (unless bookmark (error "No bookmark specified")) - (bookmark--jump-via bookmark (or display-func 'switch-to-buffer))) + (bookmark--jump-via bookmark (or display-func #'switch-to-buffer))) (put 'bookmark-jump 'minibuffer-action 'bookmark-display) @@ -1339,7 +1338,7 @@ DISPLAY-FUNC would be `switch-to-buffer-other-window'." (interactive (list (bookmark-completing-read "Jump to bookmark (in another window)" bookmark-current-bookmark))) - (bookmark-jump bookmark 'switch-to-buffer-other-window)) + (bookmark-jump bookmark #'switch-to-buffer-other-window)) ;;;###autoload (defun bookmark-jump-other-frame (bookmark) @@ -1360,7 +1359,7 @@ BOOKMARK-NAME-OR-RECORD has a file, but that file no longer exists, then offer interactively to relocate BOOKMARK-NAME-OR-RECORD." (condition-case err (funcall (or (bookmark-get-handler bookmark-name-or-record) - 'bookmark-default-handler) + #'bookmark-default-handler) (bookmark-get-bookmark bookmark-name-or-record)) (bookmark-error-no-filename ;file-error ;; We were unable to find the marked file, so ask if user wants to @@ -1388,7 +1387,7 @@ then offer interactively to relocate BOOKMARK-NAME-OR-RECORD." (bookmark-relocate bookmark-name-or-record) ;; Try again. (funcall (or (bookmark-get-handler bookmark-name-or-record) - 'bookmark-default-handler) + #'bookmark-default-handler) (bookmark-get-bookmark bookmark-name-or-record))) (message "Bookmark not relocated; consider removing it (%s)." @@ -1474,7 +1473,7 @@ Optional second argument is obsolete and ignored." (insert (bookmark-location bookmark-name))) ;;;###autoload -(defalias 'bookmark-locate 'bookmark-insert-location) +(defalias 'bookmark-locate #'bookmark-insert-location) (defun bookmark-location (bookmark-name-or-record) "Return a description of the location of BOOKMARK-NAME-OR-RECORD." @@ -1877,11 +1876,6 @@ unique numeric suffixes \"<2>\", \"<3>\", etc." ["Save Bookmarks" bookmark-bmenu-save t] ["Load Bookmarks" bookmark-bmenu-load t])) -;; Bookmark Buffer Menu mode is suitable only for specially formatted -;; data. -(put 'bookmark-bmenu-mode 'mode-class 'special) - - ;; todo: need to display whether or not bookmark exists as a buffer in ;; flag column. @@ -1980,9 +1974,9 @@ deletion, or > if it is flagged for displaying." (bookmark-bmenu--revert)) ;;;###autoload -(defalias 'list-bookmarks 'bookmark-bmenu-list) +(defalias 'list-bookmarks #'bookmark-bmenu-list) ;;;###autoload -(defalias 'edit-bookmarks 'bookmark-bmenu-list) +(defalias 'edit-bookmarks #'bookmark-bmenu-list) (define-obsolete-function-alias 'bookmark-bmenu-set-header #'tabulated-list-init-header "28.1") @@ -2276,7 +2270,7 @@ the related behaviors of `bookmark-save' and `bookmark-bmenu-save'." (pop-up-windows t)) (delete-other-windows) (switch-to-buffer (other-buffer) nil t) - (bookmark--jump-via bmrk 'pop-to-buffer) + (bookmark--jump-via bmrk #'pop-to-buffer) (bury-buffer menu))) @@ -2289,7 +2283,7 @@ the related behaviors of `bookmark-save' and `bookmark-bmenu-save'." "Select this line's bookmark in other window, leaving bookmark menu visible." (interactive nil bookmark-bmenu-mode) (let ((bookmark (bookmark-bmenu-bookmark))) - (bookmark--jump-via bookmark 'switch-to-buffer-other-window))) + (bookmark--jump-via bookmark #'switch-to-buffer-other-window))) (defun bookmark-bmenu-other-frame () "Select this line's bookmark in other frame." @@ -2615,7 +2609,7 @@ This also runs `bookmark-exit-hook'." (bookmark-save))) (unless noninteractive - (add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal)) + (add-hook 'kill-emacs-hook #'bookmark-exit-hook-internal)) (defun bookmark-unload-function () "Unload the Bookmark library." -- 2.39.5