mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
(define-ibuffer-op): Minor tweak to Shipmints's patch
* lisp/ibuf-macs.el (define-ibuffer-op): Evaluate `(active-)opstring` args when defining the operation rather than every time the operation is used. Move the `:autoload-end` marker back to the level of `progn`.
This commit is contained in:
parent
5d75c6e44d
commit
5815bd5227
1 changed files with 46 additions and 41 deletions
|
|
@ -221,10 +221,13 @@ buffer object.
|
||||||
(defalias ',(intern (concat (if (string-match "^ibuffer-do" (symbol-name op))
|
(defalias ',(intern (concat (if (string-match "^ibuffer-do" (symbol-name op))
|
||||||
"" "ibuffer-do-")
|
"" "ibuffer-do-")
|
||||||
(symbol-name op)))
|
(symbol-name op)))
|
||||||
|
(let ((,opstring-sym ,opstring)
|
||||||
|
(,active-opstring-sym ,active-opstring))
|
||||||
(lambda ,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)
|
||||||
|
;; FIXME: Unused?
|
||||||
(funcall active-opstring)
|
(funcall active-opstring)
|
||||||
active-opstring)))
|
active-opstring)))
|
||||||
,(if (not (null interactive))
|
,(if (not (null interactive))
|
||||||
|
|
@ -232,8 +235,6 @@ 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)
|
||||||
|
|
@ -243,7 +244,8 @@ buffer object.
|
||||||
(cl-assert (get-text-property (line-beginning-position)
|
(cl-assert (get-text-property (line-beginning-position)
|
||||||
'ibuffer-properties)
|
'ibuffer-properties)
|
||||||
nil "No buffer on this line")
|
nil "No buffer on this line")
|
||||||
(setq marked-names (list (buffer-name (ibuffer-current-buffer))))
|
(setq marked-names
|
||||||
|
(list (buffer-name (ibuffer-current-buffer))))
|
||||||
(ibuffer-set-mark ,(pcase mark
|
(ibuffer-set-mark ,(pcase mark
|
||||||
(:deletion
|
(:deletion
|
||||||
'ibuffer-deletion-char)
|
'ibuffer-deletion-char)
|
||||||
|
|
@ -258,6 +260,7 @@ buffer object.
|
||||||
`((ibuffer-redisplay t)
|
`((ibuffer-redisplay t)
|
||||||
(message (concat "Operation finished; "
|
(message (concat "Operation finished; "
|
||||||
(if (functionp ,opstring-sym)
|
(if (functionp ,opstring-sym)
|
||||||
|
;; FIXME: Unused?
|
||||||
(funcall ,opstring-sym)
|
(funcall ,opstring-sym)
|
||||||
,opstring-sym)
|
,opstring-sym)
|
||||||
" %s %s")
|
" %s %s")
|
||||||
|
|
@ -270,7 +273,8 @@ buffer object.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
,@body))
|
,@body))
|
||||||
t)))
|
t)))
|
||||||
(body `(let ((_ ,before) ; pre-operation form.
|
(body
|
||||||
|
`(let ((_ ,before) ; pre-operation form.
|
||||||
(count
|
(count
|
||||||
(,(pcase mark
|
(,(pcase mark
|
||||||
(:deletion
|
(:deletion
|
||||||
|
|
@ -285,8 +289,8 @@ buffer object.
|
||||||
`(let ((ibuffer-tmp-previous-buffer-modification
|
`(let ((ibuffer-tmp-previous-buffer-modification
|
||||||
(buffer-modified-p buf)))
|
(buffer-modified-p buf)))
|
||||||
(prog1 ,inner-body
|
(prog1 ,inner-body
|
||||||
(when (not (eq ibuffer-tmp-previous-buffer-modification
|
(unless (eq ibuffer-tmp-previous-buffer-modification
|
||||||
(buffer-modified-p buf)))
|
(buffer-modified-p buf))
|
||||||
(setq
|
(setq
|
||||||
ibuffer-did-modification t))))
|
ibuffer-did-modification t))))
|
||||||
inner-body)))))
|
inner-body)))))
|
||||||
|
|
@ -294,12 +298,13 @@ buffer object.
|
||||||
(if dangerous
|
(if dangerous
|
||||||
`(when (ibuffer-confirm-operation-on
|
`(when (ibuffer-confirm-operation-on
|
||||||
(if (functionp ,active-opstring-sym)
|
(if (functionp ,active-opstring-sym)
|
||||||
|
;; FIXME: Unused?
|
||||||
(funcall ,active-opstring-sym)
|
(funcall ,active-opstring-sym)
|
||||||
,active-opstring-sym)
|
,active-opstring-sym)
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue