212 |
major-mode))))) |
major-mode))))) |
213 |
(ibuffer-update nil t)) |
(ibuffer-update nil t)) |
214 |
|
|
|
;;;###autoload |
|
215 |
(define-ibuffer-op shell-command-pipe (command) |
(define-ibuffer-op shell-command-pipe (command) |
216 |
"Pipe the contents of each marked buffer to shell command COMMAND." |
"Pipe the contents of each marked buffer to shell command COMMAND." |
217 |
(:interactive "sPipe to shell command: " |
(:interactive "sPipe to shell command: " |
221 |
(point-min) (point-max) command |
(point-min) (point-max) command |
222 |
(get-buffer-create "* ibuffer-shell-output*"))) |
(get-buffer-create "* ibuffer-shell-output*"))) |
223 |
|
|
|
;;;###autoload |
|
224 |
(define-ibuffer-op shell-command-pipe-replace (command) |
(define-ibuffer-op shell-command-pipe-replace (command) |
225 |
"Replace the contents of marked buffers with output of pipe to COMMAND." |
"Replace the contents of marked buffers with output of pipe to COMMAND." |
226 |
(:interactive "sPipe to shell command (replace): " |
(:interactive "sPipe to shell command (replace): " |
232 |
(shell-command-on-region (point-min) (point-max) |
(shell-command-on-region (point-min) (point-max) |
233 |
command nil t))) |
command nil t))) |
234 |
|
|
|
;;;###autoload |
|
235 |
(define-ibuffer-op shell-command-file (command) |
(define-ibuffer-op shell-command-file (command) |
236 |
"Run shell command COMMAND separately on files of marked buffers." |
"Run shell command COMMAND separately on files of marked buffers." |
237 |
(:interactive "sShell command on buffer's file: " |
(:interactive "sShell command on buffer's file: " |
244 |
(make-temp-file |
(make-temp-file |
245 |
(substring (buffer-name) 0 (min 10 (length (buffer-name)))))))))) |
(substring (buffer-name) 0 (min 10 (length (buffer-name)))))))))) |
246 |
|
|
|
;;;###autoload |
|
247 |
(define-ibuffer-op eval (form) |
(define-ibuffer-op eval (form) |
248 |
"Evaluate FORM in each of the buffers. |
"Evaluate FORM in each of the buffers. |
249 |
Does not display the buffer during evaluation. See |
Does not display the buffer during evaluation. See |
253 |
:modifier-p :maybe) |
:modifier-p :maybe) |
254 |
(eval form)) |
(eval form)) |
255 |
|
|
|
;;;###autoload |
|
256 |
(define-ibuffer-op view-and-eval (form) |
(define-ibuffer-op view-and-eval (form) |
257 |
"Evaluate FORM while displaying each of the marked buffers. |
"Evaluate FORM while displaying each of the marked buffers. |
258 |
To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." |
To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." |
267 |
(eval form)) |
(eval form)) |
268 |
(switch-to-buffer ibuffer-buf)))) |
(switch-to-buffer ibuffer-buf)))) |
269 |
|
|
|
;;;###autoload |
|
270 |
(define-ibuffer-op rename-uniquely () |
(define-ibuffer-op rename-uniquely () |
271 |
"Rename marked buffers as with `rename-uniquely'." |
"Rename marked buffers as with `rename-uniquely'." |
272 |
(:opstring "renamed" |
(:opstring "renamed" |
273 |
:modifier-p t) |
:modifier-p t) |
274 |
(rename-uniquely)) |
(rename-uniquely)) |
275 |
|
|
|
;;;###autoload |
|
276 |
(define-ibuffer-op revert () |
(define-ibuffer-op revert () |
277 |
"Revert marked buffers as with `revert-buffer'." |
"Revert marked buffers as with `revert-buffer'." |
278 |
(:dangerous t |
(:dangerous t |
281 |
:modifier-p :maybe) |
:modifier-p :maybe) |
282 |
(revert-buffer t t)) |
(revert-buffer t t)) |
283 |
|
|
|
;;;###autoload |
|
284 |
(define-ibuffer-op replace-regexp (from-str to-str) |
(define-ibuffer-op replace-regexp (from-str to-str) |
285 |
"Perform a `replace-regexp' in marked buffers." |
"Perform a `replace-regexp' in marked buffers." |
286 |
(:interactive |
(:interactive |
300 |
(replace-match to-str)))) |
(replace-match to-str)))) |
301 |
t)) |
t)) |
302 |
|
|
|
;;;###autoload |
|
303 |
(define-ibuffer-op query-replace (&rest args) |
(define-ibuffer-op query-replace (&rest args) |
304 |
"Perform a `query-replace' in marked buffers." |
"Perform a `query-replace' in marked buffers." |
305 |
(:interactive |
(:interactive |
315 |
(apply #'query-replace args))) |
(apply #'query-replace args))) |
316 |
t)) |
t)) |
317 |
|
|
|
;;;###autoload |
|
318 |
(define-ibuffer-op query-replace-regexp (&rest args) |
(define-ibuffer-op query-replace-regexp (&rest args) |
319 |
"Perform a `query-replace-regexp' in marked buffers." |
"Perform a `query-replace-regexp' in marked buffers." |
320 |
(:interactive |
(:interactive |
330 |
(apply #'query-replace-regexp args))) |
(apply #'query-replace-regexp args))) |
331 |
t)) |
t)) |
332 |
|
|
|
;;;###autoload |
|
333 |
(define-ibuffer-op print () |
(define-ibuffer-op print () |
334 |
"Print marked buffers as with `print-buffer'." |
"Print marked buffers as with `print-buffer'." |
335 |
(:opstring "printed" |
(:opstring "printed" |
569 |
|
|
570 |
;;; Extra operation definitions |
;;; Extra operation definitions |
571 |
|
|
|
;;;###autoload |
|
572 |
(define-ibuffer-filter mode |
(define-ibuffer-filter mode |
573 |
"Toggle current view to buffers with major mode QUALIFIER." |
"Toggle current view to buffers with major mode QUALIFIER." |
574 |
(:description "major mode" |
(:description "major mode" |
586 |
""))))) |
""))))) |
587 |
(eq qualifier (with-current-buffer buf major-mode))) |
(eq qualifier (with-current-buffer buf major-mode))) |
588 |
|
|
|
;;;###autoload |
|
589 |
(define-ibuffer-filter name |
(define-ibuffer-filter name |
590 |
"Toggle current view to buffers with name matching QUALIFIER." |
"Toggle current view to buffers with name matching QUALIFIER." |
591 |
(:description "buffer name" |
(:description "buffer name" |
593 |
(read-from-minibuffer "Filter by name (regexp): ")) |
(read-from-minibuffer "Filter by name (regexp): ")) |
594 |
(string-match qualifier (buffer-name buf))) |
(string-match qualifier (buffer-name buf))) |
595 |
|
|
|
;;;###autoload |
|
596 |
(define-ibuffer-filter filename |
(define-ibuffer-filter filename |
597 |
"Toggle current view to buffers with filename matching QUALIFIER." |
"Toggle current view to buffers with filename matching QUALIFIER." |
598 |
(:description "filename" |
(:description "filename" |
601 |
(ibuffer-awhen (buffer-file-name buf) |
(ibuffer-awhen (buffer-file-name buf) |
602 |
(string-match qualifier it))) |
(string-match qualifier it))) |
603 |
|
|
|
;;;###autoload |
|
604 |
(define-ibuffer-filter size-gt |
(define-ibuffer-filter size-gt |
605 |
"Toggle current view to buffers with size greater than QUALIFIER." |
"Toggle current view to buffers with size greater than QUALIFIER." |
606 |
(:description "size greater than" |
(:description "size greater than" |
609 |
(> (with-current-buffer buf (buffer-size)) |
(> (with-current-buffer buf (buffer-size)) |
610 |
qualifier)) |
qualifier)) |
611 |
|
|
|
;;;###autoload |
|
612 |
(define-ibuffer-filter size-lt |
(define-ibuffer-filter size-lt |
613 |
"Toggle current view to buffers with size less than QUALIFIER." |
"Toggle current view to buffers with size less than QUALIFIER." |
614 |
(:description "size less than" |
(:description "size less than" |
617 |
(< (with-current-buffer buf (buffer-size)) |
(< (with-current-buffer buf (buffer-size)) |
618 |
qualifier)) |
qualifier)) |
619 |
|
|
|
;;;###autoload |
|
620 |
(define-ibuffer-filter content |
(define-ibuffer-filter content |
621 |
"Toggle current view to buffers whose contents match QUALIFIER." |
"Toggle current view to buffers whose contents match QUALIFIER." |
622 |
(:description "content" |
(:description "content" |
627 |
(goto-char (point-min)) |
(goto-char (point-min)) |
628 |
(re-search-forward qualifier nil t)))) |
(re-search-forward qualifier nil t)))) |
629 |
|
|
|
;;;###autoload |
|
630 |
(define-ibuffer-filter predicate |
(define-ibuffer-filter predicate |
631 |
"Toggle current view to buffers for which QUALIFIER returns non-nil." |
"Toggle current view to buffers for which QUALIFIER returns non-nil." |
632 |
(:description "predicate" |
(:description "predicate" |
670 |
"normal")) |
"normal")) |
671 |
(ibuffer-redisplay t)) |
(ibuffer-redisplay t)) |
672 |
|
|
|
;;;###autoload |
|
673 |
(define-ibuffer-sorter major-mode |
(define-ibuffer-sorter major-mode |
674 |
"Sort the buffers by major modes. |
"Sort the buffers by major modes. |
675 |
Ordering is lexicographic." |
Ordering is lexicographic." |
683 |
(car b) |
(car b) |
684 |
major-mode))))) |
major-mode))))) |
685 |
|
|
|
;;;###autoload |
|
686 |
(define-ibuffer-sorter alphabetic |
(define-ibuffer-sorter alphabetic |
687 |
"Sort the buffers by their names. |
"Sort the buffers by their names. |
688 |
Ordering is lexicographic." |
Ordering is lexicographic." |
691 |
(buffer-name (car a)) |
(buffer-name (car a)) |
692 |
(buffer-name (car b)))) |
(buffer-name (car b)))) |
693 |
|
|
|
;;;###autoload |
|
694 |
(define-ibuffer-sorter size |
(define-ibuffer-sorter size |
695 |
"Sort the buffers by their size." |
"Sort the buffers by their size." |
696 |
(:description "size") |
(:description "size") |