mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 11:23:24 +00:00
Improve 'define-ibuffer-op' macro (bug#76222)
* lisp/ibuf-macs.el (define-ibuffer-op): Change defun to defalias and place it before the macro-local lets. * lisp/ibuffer.el: (ibuffer-do-toggle-lock): Remove declare-function. (ibuffer-do-toggle-read-only): Remove declare-function. (ibuffer-do-save): Remove declare-function. (ibuffer-do-delete): Remove declare-function. (ibuffer-do-toggle-modified): Remove declare-function. (ibuffer-do-kill-on-deletion-marks): Remove declare-function.
This commit is contained in:
parent
7ae069b676
commit
5d75c6e44d
2 changed files with 51 additions and 60 deletions
|
@ -218,12 +218,10 @@ buffer object.
|
||||||
(let ((opstring-sym (make-symbol "opstring"))
|
(let ((opstring-sym (make-symbol "opstring"))
|
||||||
(active-opstring-sym (make-symbol "active-opstring")))
|
(active-opstring-sym (make-symbol "active-opstring")))
|
||||||
`(progn
|
`(progn
|
||||||
(let ((,opstring-sym ,opstring)
|
(defalias ',(intern (concat (if (string-match "^ibuffer-do" (symbol-name op))
|
||||||
(,active-opstring-sym ,active-opstring))
|
|
||||||
(defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op))
|
|
||||||
"" "ibuffer-do-")
|
"" "ibuffer-do-")
|
||||||
(symbol-name op)))
|
(symbol-name op)))
|
||||||
,args
|
(lambda ,args
|
||||||
,(if (stringp documentation)
|
,(if (stringp documentation)
|
||||||
documentation
|
documentation
|
||||||
(format "%s marked buffers." (if (functionp active-opstring)
|
(format "%s marked buffers." (if (functionp active-opstring)
|
||||||
|
@ -234,6 +232,8 @@ buffer object.
|
||||||
'(interactive))
|
'(interactive))
|
||||||
(cl-assert (derived-mode-p 'ibuffer-mode))
|
(cl-assert (derived-mode-p 'ibuffer-mode))
|
||||||
(setq ibuffer-did-modification nil)
|
(setq ibuffer-did-modification nil)
|
||||||
|
(let ((,opstring-sym ,opstring)
|
||||||
|
(,active-opstring-sym ,active-opstring))
|
||||||
(let ((marked-names (,(pcase mark
|
(let ((marked-names (,(pcase mark
|
||||||
(:deletion
|
(:deletion
|
||||||
'ibuffer-deletion-marked-buffer-names)
|
'ibuffer-deletion-marked-buffer-names)
|
||||||
|
@ -299,7 +299,7 @@ buffer object.
|
||||||
marked-names)
|
marked-names)
|
||||||
,body)
|
,body)
|
||||||
body))))
|
body))))
|
||||||
:autoload-end))))
|
:autoload-end)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(cl-defmacro define-ibuffer-filter (name documentation
|
(cl-defmacro define-ibuffer-filter (name documentation
|
||||||
|
|
|
@ -372,15 +372,6 @@ directory, like `default-directory'."
|
||||||
(regexp :tag "From")
|
(regexp :tag "From")
|
||||||
(regexp :tag "To"))))
|
(regexp :tag "To"))))
|
||||||
|
|
||||||
;; These declarations are here to avoid byte-compiler warnings about
|
|
||||||
;; functions defined later via 'define-ibuffer-op'.
|
|
||||||
(declare-function ibuffer-do-toggle-lock "ibuffer.el")
|
|
||||||
(declare-function ibuffer-do-toggle-read-only "ibuffer.el")
|
|
||||||
(declare-function ibuffer-do-save "ibuffer.el")
|
|
||||||
(declare-function ibuffer-do-delete "ibuffer.el")
|
|
||||||
(declare-function ibuffer-do-toggle-modified "ibuffer.el")
|
|
||||||
(declare-function ibuffer-do-kill-on-deletion-marks "ibuffer.el")
|
|
||||||
|
|
||||||
(defvar-keymap ibuffer--filter-map
|
(defvar-keymap ibuffer--filter-map
|
||||||
"RET" #'ibuffer-filter-by-mode
|
"RET" #'ibuffer-filter-by-mode
|
||||||
"SPC" #'ibuffer-filter-chosen-by-completion
|
"SPC" #'ibuffer-filter-chosen-by-completion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue