diff options
| author | Colin Walters | 2002-04-24 23:27:02 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-04-24 23:27:02 +0000 |
| commit | 365e1cfbc7cf38150c93a50db7abaf33075b48b7 (patch) | |
| tree | c9f8221290a6e1e411f69befb98f54d59e2be907 | |
| parent | 696c9dc676d506a9fa98b0c7c03141aadafd4ba5 (diff) | |
| download | emacs-365e1cfbc7cf38150c93a50db7abaf33075b48b7.tar.gz emacs-365e1cfbc7cf38150c93a50db7abaf33075b48b7.zip | |
(toplevel): Remove byte-compile-dynamic. Try to set up autoloads manually.
(ibuffer-split-list): New function.
(ibuffer-filtering-groups): New variable.
(ibuffer-hidden-filtering-groups): New variable.
(ibuffer-mouse-toggle-filter-group): New function.
(ibuffer-toggle-filter-group): New function.
(ibuffer-toggle-filter-group-1): New function.
(ibuffer-forward-filter-group): New function.
(ibuffer-backward-filter-group): New funtion.
(ibuffer-generate-filter-groups): New function.
(ibuffer-filters-to-filter-group): New function.
(ibuffer-pop-filter-group): New function.
(ibuffer-jump-to-filter-group): New function.
(ibuffer-do-occur): Just use `occur-read-primary-args'
| -rw-r--r-- | lisp/ibuf-ext.el | 192 |
1 files changed, 163 insertions, 29 deletions
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 6669846ebc0..59d2e82d5de 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ibuf-ext.el --- extensions for ibuffer -*-byte-compile-dynamic: t;-*- | 1 | ;;; ibuf-ext.el --- extensions for ibuffer |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Created: 2 Dec 2001 | 6 | ;; Created: 2 Dec 2001 |
| 7 | ;; Keywords: buffer, convenience | 7 | ;; Keywords: buffer, convenience |
| 8 | 8 | ||
| 9 | ;; This file is not currently part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| 11 | ;; This program is free software; you can redistribute it and/or | 11 | ;; This program is free software; you can redistribute it and/or |
| 12 | ;; modify it under the terms of the GNU General Public License as | 12 | ;; modify it under the terms of the GNU General Public License as |
| @@ -46,6 +46,16 @@ | |||
| 46 | (setq alist (delete entry alist))) | 46 | (setq alist (delete entry alist))) |
| 47 | alist)) | 47 | alist)) |
| 48 | 48 | ||
| 49 | (defun ibuffer-split-list (ibuffer-split-list-fn ibuffer-split-list-elts) | ||
| 50 | (let ((hip-crowd nil) | ||
| 51 | (lamers nil)) | ||
| 52 | (dolist (ibuffer-split-list-elt ibuffer-split-list-elts) | ||
| 53 | (if (funcall ibuffer-split-list-fn ibuffer-split-list-elt) | ||
| 54 | (push ibuffer-split-list-elt hip-crowd) | ||
| 55 | (push ibuffer-split-list-elt lamers))) | ||
| 56 | ;; Too bad Emacs Lisp doesn't have multiple values. | ||
| 57 | (list (nreverse hip-crowd) (nreverse lamers)))) | ||
| 58 | |||
| 49 | (defcustom ibuffer-never-show-predicates nil | 59 | (defcustom ibuffer-never-show-predicates nil |
| 50 | "A list of predicates (a regexp or function) for buffers not to display. | 60 | "A list of predicates (a regexp or function) for buffers not to display. |
| 51 | If a regexp, then it will be matched against the buffer's name. | 61 | If a regexp, then it will be matched against the buffer's name. |
| @@ -136,6 +146,13 @@ to this variable." | |||
| 136 | (defvar ibuffer-cached-filter-formats nil) | 146 | (defvar ibuffer-cached-filter-formats nil) |
| 137 | (defvar ibuffer-compiled-filter-formats nil) | 147 | (defvar ibuffer-compiled-filter-formats nil) |
| 138 | 148 | ||
| 149 | (defvar ibuffer-filtering-groups nil | ||
| 150 | "A list like ((\"NAME\" ((SYMBOL . QUALIFIER) ...) ...) which groups buffers. | ||
| 151 | See also `ibuffer-filtering-alist'.") | ||
| 152 | |||
| 153 | (defvar ibuffer-hidden-filtering-groups nil | ||
| 154 | "A list of filtering groups which are currently hidden.") | ||
| 155 | |||
| 139 | (defcustom ibuffer-old-time 72 | 156 | (defcustom ibuffer-old-time 72 |
| 140 | "The number of hours before a buffer is considered \"old\"." | 157 | "The number of hours before a buffer is considered \"old\"." |
| 141 | :type '(choice (const :tag "72 hours (3 days)" 72) | 158 | :type '(choice (const :tag "72 hours (3 days)" 72) |
| @@ -218,6 +235,68 @@ With numeric ARG, enable auto-update if and only if ARG is positive." | |||
| 218 | major-mode))))) | 235 | major-mode))))) |
| 219 | (ibuffer-update nil t)) | 236 | (ibuffer-update nil t)) |
| 220 | 237 | ||
| 238 | ;;;###autoload | ||
| 239 | (defun ibuffer-mouse-toggle-filter-group (event) | ||
| 240 | "Toggle the display status of the filter group chosen with the mouse." | ||
| 241 | (interactive "e") | ||
| 242 | (ibuffer-toggle-filter-group-1 (save-excursion | ||
| 243 | (mouse-set-point event) | ||
| 244 | (point)))) | ||
| 245 | |||
| 246 | ;;;###autoload | ||
| 247 | (defun ibuffer-toggle-filter-group () | ||
| 248 | "Toggle the display status of the filter group on this line." | ||
| 249 | (interactive) | ||
| 250 | (ibuffer-toggle-filter-group-1 (point))) | ||
| 251 | |||
| 252 | (defun ibuffer-toggle-filter-group-1 (posn) | ||
| 253 | (let ((name (get-text-property posn 'ibuffer-filter-group-name))) | ||
| 254 | (unless (stringp name) | ||
| 255 | (error "No filtering group name present")) | ||
| 256 | (if (member name ibuffer-hidden-filtering-groups) | ||
| 257 | (setq ibuffer-hidden-filtering-groups | ||
| 258 | (delete name ibuffer-hidden-filtering-groups)) | ||
| 259 | (push name ibuffer-hidden-filtering-groups)) | ||
| 260 | (ibuffer-update nil t))) | ||
| 261 | |||
| 262 | ;;;###autoload | ||
| 263 | (defun ibuffer-forward-filter-group (&optional count) | ||
| 264 | "Move point forwards by COUNT filtering groups." | ||
| 265 | (interactive "P") | ||
| 266 | (unless count | ||
| 267 | (setq count 1)) | ||
| 268 | (when (> count 0) | ||
| 269 | (when (get-text-property (point) 'ibuffer-filter-group-name) | ||
| 270 | (goto-char (next-single-property-change | ||
| 271 | (point) 'ibuffer-filter-group-name | ||
| 272 | nil (point-max)))) | ||
| 273 | (goto-char (next-single-property-change | ||
| 274 | (point) 'ibuffer-filter-group-name | ||
| 275 | nil (point-max))) | ||
| 276 | (ibuffer-forward-filter-group (1- count))) | ||
| 277 | (ibuffer-forward-line 0)) | ||
| 278 | |||
| 279 | ;;;###autoload | ||
| 280 | (defun ibuffer-backward-filter-group (&optional count) | ||
| 281 | "Move point backwards by COUNT filtering groups." | ||
| 282 | (interactive "P") | ||
| 283 | (unless count | ||
| 284 | (setq count 1)) | ||
| 285 | (when (> count 0) | ||
| 286 | (when (get-text-property (point) 'ibuffer-filter-group-name) | ||
| 287 | (goto-char (previous-single-property-change | ||
| 288 | (point) 'ibuffer-filter-group-name | ||
| 289 | nil (point-min)))) | ||
| 290 | (goto-char (previous-single-property-change | ||
| 291 | (point) 'ibuffer-filter-group-name | ||
| 292 | nil (point-min))) | ||
| 293 | (ibuffer-backward-filter-group (1- count))) | ||
| 294 | (when (= (point) (point-min)) | ||
| 295 | (goto-char (point-max)) | ||
| 296 | (ibuffer-backward-filter-group 1)) | ||
| 297 | (ibuffer-forward-line 0)) | ||
| 298 | |||
| 299 | ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe "ibuf-ext.el") | ||
| 221 | (define-ibuffer-op shell-command-pipe (command) | 300 | (define-ibuffer-op shell-command-pipe (command) |
| 222 | "Pipe the contents of each marked buffer to shell command COMMAND." | 301 | "Pipe the contents of each marked buffer to shell command COMMAND." |
| 223 | (:interactive "sPipe to shell command: " | 302 | (:interactive "sPipe to shell command: " |
| @@ -227,6 +306,7 @@ With numeric ARG, enable auto-update if and only if ARG is positive." | |||
| 227 | (point-min) (point-max) command | 306 | (point-min) (point-max) command |
| 228 | (get-buffer-create "* ibuffer-shell-output*"))) | 307 | (get-buffer-create "* ibuffer-shell-output*"))) |
| 229 | 308 | ||
| 309 | ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe-replace "ibuf-ext.el") | ||
| 230 | (define-ibuffer-op shell-command-pipe-replace (command) | 310 | (define-ibuffer-op shell-command-pipe-replace (command) |
| 231 | "Replace the contents of marked buffers with output of pipe to COMMAND." | 311 | "Replace the contents of marked buffers with output of pipe to COMMAND." |
| 232 | (:interactive "sPipe to shell command (replace): " | 312 | (:interactive "sPipe to shell command (replace): " |
| @@ -238,6 +318,7 @@ With numeric ARG, enable auto-update if and only if ARG is positive." | |||
| 238 | (shell-command-on-region (point-min) (point-max) | 318 | (shell-command-on-region (point-min) (point-max) |
| 239 | command nil t))) | 319 | command nil t))) |
| 240 | 320 | ||
| 321 | ;;;###autoload (autoload 'ibuffer-do-shell-command-file "ibuf-ext.el") | ||
| 241 | (define-ibuffer-op shell-command-file (command) | 322 | (define-ibuffer-op shell-command-file (command) |
| 242 | "Run shell command COMMAND separately on files of marked buffers." | 323 | "Run shell command COMMAND separately on files of marked buffers." |
| 243 | (:interactive "sShell command on buffer's file: " | 324 | (:interactive "sShell command on buffer's file: " |
| @@ -249,7 +330,8 @@ With numeric ARG, enable auto-update if and only if ARG is positive." | |||
| 249 | buffer-file-name | 330 | buffer-file-name |
| 250 | (make-temp-file | 331 | (make-temp-file |
| 251 | (substring (buffer-name) 0 (min 10 (length (buffer-name)))))))))) | 332 | (substring (buffer-name) 0 (min 10 (length (buffer-name)))))))))) |
| 252 | 333 | ||
| 334 | ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext.el") | ||
| 253 | (define-ibuffer-op eval (form) | 335 | (define-ibuffer-op eval (form) |
| 254 | "Evaluate FORM in each of the buffers. | 336 | "Evaluate FORM in each of the buffers. |
| 255 | Does not display the buffer during evaluation. See | 337 | Does not display the buffer during evaluation. See |
| @@ -259,6 +341,7 @@ Does not display the buffer during evaluation. See | |||
| 259 | :modifier-p :maybe) | 341 | :modifier-p :maybe) |
| 260 | (eval form)) | 342 | (eval form)) |
| 261 | 343 | ||
| 344 | ;;;###autoload (autoload 'ibuffer-do-view-and-eval "ibuf-ext.el") | ||
| 262 | (define-ibuffer-op view-and-eval (form) | 345 | (define-ibuffer-op view-and-eval (form) |
| 263 | "Evaluate FORM while displaying each of the marked buffers. | 346 | "Evaluate FORM while displaying each of the marked buffers. |
| 264 | To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | 347 | To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." |
| @@ -273,12 +356,14 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | |||
| 273 | (eval form)) | 356 | (eval form)) |
| 274 | (switch-to-buffer ibuffer-buf)))) | 357 | (switch-to-buffer ibuffer-buf)))) |
| 275 | 358 | ||
| 359 | ;;;###autoload (autoload 'ibuffer-do-rename-uniquely "ibuf-ext.el") | ||
| 276 | (define-ibuffer-op rename-uniquely () | 360 | (define-ibuffer-op rename-uniquely () |
| 277 | "Rename marked buffers as with `rename-uniquely'." | 361 | "Rename marked buffers as with `rename-uniquely'." |
| 278 | (:opstring "renamed" | 362 | (:opstring "renamed" |
| 279 | :modifier-p t) | 363 | :modifier-p t) |
| 280 | (rename-uniquely)) | 364 | (rename-uniquely)) |
| 281 | 365 | ||
| 366 | ;;;###autoload (autoload 'ibuffer-do-revert "ibuf-ext.el") | ||
| 282 | (define-ibuffer-op revert () | 367 | (define-ibuffer-op revert () |
| 283 | "Revert marked buffers as with `revert-buffer'." | 368 | "Revert marked buffers as with `revert-buffer'." |
| 284 | (:dangerous t | 369 | (:dangerous t |
| @@ -287,6 +372,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | |||
| 287 | :modifier-p :maybe) | 372 | :modifier-p :maybe) |
| 288 | (revert-buffer t t)) | 373 | (revert-buffer t t)) |
| 289 | 374 | ||
| 375 | ;;;###autoload (autoload 'ibuffer-do-replace-regexp "ibuf-ext.el") | ||
| 290 | (define-ibuffer-op replace-regexp (from-str to-str) | 376 | (define-ibuffer-op replace-regexp (from-str to-str) |
| 291 | "Perform a `replace-regexp' in marked buffers." | 377 | "Perform a `replace-regexp' in marked buffers." |
| 292 | (:interactive | 378 | (:interactive |
| @@ -306,6 +392,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | |||
| 306 | (replace-match to-str)))) | 392 | (replace-match to-str)))) |
| 307 | t)) | 393 | t)) |
| 308 | 394 | ||
| 395 | ;;;###autoload (autoload 'ibuffer-do-query-replace "ibuf-ext.el") | ||
| 309 | (define-ibuffer-op query-replace (&rest args) | 396 | (define-ibuffer-op query-replace (&rest args) |
| 310 | "Perform a `query-replace' in marked buffers." | 397 | "Perform a `query-replace' in marked buffers." |
| 311 | (:interactive | 398 | (:interactive |
| @@ -321,6 +408,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | |||
| 321 | (apply #'query-replace args))) | 408 | (apply #'query-replace args))) |
| 322 | t)) | 409 | t)) |
| 323 | 410 | ||
| 411 | ;;;###autoload (autoload 'ibuffer-do-query-replace-regexp "ibuf-ext.el") | ||
| 324 | (define-ibuffer-op query-replace-regexp (&rest args) | 412 | (define-ibuffer-op query-replace-regexp (&rest args) |
| 325 | "Perform a `query-replace-regexp' in marked buffers." | 413 | "Perform a `query-replace-regexp' in marked buffers." |
| 326 | (:interactive | 414 | (:interactive |
| @@ -336,6 +424,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | |||
| 336 | (apply #'query-replace-regexp args))) | 424 | (apply #'query-replace-regexp args))) |
| 337 | t)) | 425 | t)) |
| 338 | 426 | ||
| 427 | ;;;###autoload (autoload 'ibuffer-do-print "ibuf-ext.el") | ||
| 339 | (define-ibuffer-op print () | 428 | (define-ibuffer-op print () |
| 340 | "Print marked buffers as with `print-buffer'." | 429 | "Print marked buffers as with `print-buffer'." |
| 341 | (:opstring "printed" | 430 | (:opstring "printed" |
| @@ -388,6 +477,59 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." | |||
| 388 | buf | 477 | buf |
| 389 | (cdr filter)))))))))) | 478 | (cdr filter)))))))))) |
| 390 | 479 | ||
| 480 | (defun ibuffer-generate-filter-groups (bmarklist) | ||
| 481 | (let ((filtering-group-alist (append ibuffer-filtering-groups | ||
| 482 | (list (cons "Default" nil))))) | ||
| 483 | ;; (dolist (hidden ibuffer-hidden-filtering-groups) | ||
| 484 | ;; (setq filtering-group-alist (ibuffer-delete-alist | ||
| 485 | ;; hidden filtering-group-alist))) | ||
| 486 | (let ((vec (make-vector (length filtering-group-alist) nil)) | ||
| 487 | (i 0)) | ||
| 488 | (dolist (filtergroup filtering-group-alist) | ||
| 489 | (let ((filterset (cdr filtergroup))) | ||
| 490 | (multiple-value-bind (hip-crowd lamers) | ||
| 491 | (ibuffer-split-list (lambda (bufmark) | ||
| 492 | (ibuffer-included-in-filters-p (car bufmark) | ||
| 493 | filterset)) | ||
| 494 | bmarklist) | ||
| 495 | (aset vec i hip-crowd) | ||
| 496 | (incf i) | ||
| 497 | (setq bmarklist lamers)))) | ||
| 498 | (let ((ret nil)) | ||
| 499 | (dotimes (j i ret) | ||
| 500 | (push (cons (car (nth j filtering-group-alist)) | ||
| 501 | (aref vec j)) | ||
| 502 | ret)))))) | ||
| 503 | |||
| 504 | ;;;###autoload | ||
| 505 | (defun ibuffer-filters-to-filter-group (name) | ||
| 506 | "Make the current filters into a filtering group." | ||
| 507 | (interactive "sName for filtering group: ") | ||
| 508 | (when (null ibuffer-filtering-qualifiers) | ||
| 509 | (error "No filters in effect")) | ||
| 510 | (push (cons name ibuffer-filtering-qualifiers) ibuffer-filtering-groups) | ||
| 511 | (ibuffer-filter-disable)) | ||
| 512 | |||
| 513 | ;;;###autoload | ||
| 514 | (defun ibuffer-pop-filter-group () | ||
| 515 | "Remove the first filtering group." | ||
| 516 | (interactive) | ||
| 517 | (when (null ibuffer-filtering-groups) | ||
| 518 | (error "No filtering groups active")) | ||
| 519 | (pop ibuffer-filtering-groups) | ||
| 520 | (ibuffer-update nil t)) | ||
| 521 | |||
| 522 | ;;;###autoload | ||
| 523 | (defun ibuffer-jump-to-filter-group (name) | ||
| 524 | "Move point to the filter group whose name is NAME." | ||
| 525 | (interactive (list nil)) | ||
| 526 | (let ((table (ibuffer-current-filter-groups))) | ||
| 527 | (when (interactive-p) | ||
| 528 | (setq name (completing-read "Jump to filter group: " table nil t))) | ||
| 529 | (ibuffer-aif (assoc name table) | ||
| 530 | (goto-char (cdr it)) | ||
| 531 | (error "No filter group with name %s" name)))) | ||
| 532 | |||
| 391 | ;;;###autoload | 533 | ;;;###autoload |
| 392 | (defun ibuffer-filter-disable () | 534 | (defun ibuffer-filter-disable () |
| 393 | "Disable all filters currently in effect in this buffer." | 535 | "Disable all filters currently in effect in this buffer." |
| @@ -511,7 +653,7 @@ Interactively, prompt for NAME, and use the current filters." | |||
| 511 | ibuffer-filtering-qualifiers))) | 653 | ibuffer-filtering-qualifiers))) |
| 512 | (ibuffer-aif (assoc name ibuffer-saved-filters) | 654 | (ibuffer-aif (assoc name ibuffer-saved-filters) |
| 513 | (setcdr it filters) | 655 | (setcdr it filters) |
| 514 | (push (list name filters) ibuffer-saved-filters)) | 656 | (push (list name filters) ibuffer-saved-filters)) |
| 515 | (ibuffer-maybe-save-saved-filters) | 657 | (ibuffer-maybe-save-saved-filters) |
| 516 | (ibuffer-update-mode-name)) | 658 | (ibuffer-update-mode-name)) |
| 517 | 659 | ||
| @@ -575,6 +717,7 @@ of replacing the current filters." | |||
| 575 | 717 | ||
| 576 | ;;; Extra operation definitions | 718 | ;;; Extra operation definitions |
| 577 | 719 | ||
| 720 | ;;;###autoload (autoload 'ibuffer-filter-by-mode "ibuf-ext.el") | ||
| 578 | (define-ibuffer-filter mode | 721 | (define-ibuffer-filter mode |
| 579 | "Toggle current view to buffers with major mode QUALIFIER." | 722 | "Toggle current view to buffers with major mode QUALIFIER." |
| 580 | (:description "major mode" | 723 | (:description "major mode" |
| @@ -592,21 +735,22 @@ of replacing the current filters." | |||
| 592 | ""))))) | 735 | ""))))) |
| 593 | (eq qualifier (with-current-buffer buf major-mode))) | 736 | (eq qualifier (with-current-buffer buf major-mode))) |
| 594 | 737 | ||
| 738 | ;;;###autoload (autoload 'ibuffer-filter-by-name "ibuf-ext.el") | ||
| 595 | (define-ibuffer-filter name | 739 | (define-ibuffer-filter name |
| 596 | "Toggle current view to buffers with name matching QUALIFIER." | 740 | "Toggle current view to buffers with name matching QUALIFIER." |
| 597 | (:description "buffer name" | 741 | (:description "buffer name" |
| 598 | :reader | 742 | :reader (read-from-minibuffer "Filter by name (regexp): ")) |
| 599 | (read-from-minibuffer "Filter by name (regexp): ")) | ||
| 600 | (string-match qualifier (buffer-name buf))) | 743 | (string-match qualifier (buffer-name buf))) |
| 601 | 744 | ||
| 745 | ;;;###autoload (autoload 'ibuffer-filter-by-filename "ibuf-ext.el") | ||
| 602 | (define-ibuffer-filter filename | 746 | (define-ibuffer-filter filename |
| 603 | "Toggle current view to buffers with filename matching QUALIFIER." | 747 | "Toggle current view to buffers with filename matching QUALIFIER." |
| 604 | (:description "filename" | 748 | (:description "filename" |
| 605 | :reader | 749 | :reader (read-from-minibuffer "Filter by filename (regexp): ")) |
| 606 | (read-from-minibuffer "Filter by filename (regexp): ")) | ||
| 607 | (ibuffer-awhen (buffer-file-name buf) | 750 | (ibuffer-awhen (buffer-file-name buf) |
| 608 | (string-match qualifier it))) | 751 | (string-match qualifier it))) |
| 609 | 752 | ||
| 753 | ;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext.el") | ||
| 610 | (define-ibuffer-filter size-gt | 754 | (define-ibuffer-filter size-gt |
| 611 | "Toggle current view to buffers with size greater than QUALIFIER." | 755 | "Toggle current view to buffers with size greater than QUALIFIER." |
| 612 | (:description "size greater than" | 756 | (:description "size greater than" |
| @@ -615,6 +759,7 @@ of replacing the current filters." | |||
| 615 | (> (with-current-buffer buf (buffer-size)) | 759 | (> (with-current-buffer buf (buffer-size)) |
| 616 | qualifier)) | 760 | qualifier)) |
| 617 | 761 | ||
| 762 | ;;;###autoload (autoload 'ibuffer-filter-by-size-lt "ibuf-ext.el") | ||
| 618 | (define-ibuffer-filter size-lt | 763 | (define-ibuffer-filter size-lt |
| 619 | "Toggle current view to buffers with size less than QUALIFIER." | 764 | "Toggle current view to buffers with size less than QUALIFIER." |
| 620 | (:description "size less than" | 765 | (:description "size less than" |
| @@ -622,22 +767,22 @@ of replacing the current filters." | |||
| 622 | (string-to-number (read-from-minibuffer "Filter by size less than: "))) | 767 | (string-to-number (read-from-minibuffer "Filter by size less than: "))) |
| 623 | (< (with-current-buffer buf (buffer-size)) | 768 | (< (with-current-buffer buf (buffer-size)) |
| 624 | qualifier)) | 769 | qualifier)) |
| 625 | 770 | ||
| 771 | ;;;###autoload (autoload 'ibuffer-filter-by-content "ibuf-ext.el") | ||
| 626 | (define-ibuffer-filter content | 772 | (define-ibuffer-filter content |
| 627 | "Toggle current view to buffers whose contents match QUALIFIER." | 773 | "Toggle current view to buffers whose contents match QUALIFIER." |
| 628 | (:description "content" | 774 | (:description "content" |
| 629 | :reader | 775 | :reader (read-from-minibuffer "Filter by content (regexp): ")) |
| 630 | (read-from-minibuffer "Filter by content (regexp): ")) | ||
| 631 | (with-current-buffer buf | 776 | (with-current-buffer buf |
| 632 | (save-excursion | 777 | (save-excursion |
| 633 | (goto-char (point-min)) | 778 | (goto-char (point-min)) |
| 634 | (re-search-forward qualifier nil t)))) | 779 | (re-search-forward qualifier nil t)))) |
| 635 | 780 | ||
| 781 | ;;;###autoload (autoload 'ibuffer-filter-by-predicate "ibuf-ext.el") | ||
| 636 | (define-ibuffer-filter predicate | 782 | (define-ibuffer-filter predicate |
| 637 | "Toggle current view to buffers for which QUALIFIER returns non-nil." | 783 | "Toggle current view to buffers for which QUALIFIER returns non-nil." |
| 638 | (:description "predicate" | 784 | (:description "predicate" |
| 639 | :reader | 785 | :reader (read-minibuffer "Filter by predicate (form): ")) |
| 640 | (read-minibuffer "Filter by predicate (form): ")) | ||
| 641 | (with-current-buffer buf | 786 | (with-current-buffer buf |
| 642 | (eval qualifier))) | 787 | (eval qualifier))) |
| 643 | 788 | ||
| @@ -672,6 +817,7 @@ Default sorting modes are: | |||
| 672 | "normal")) | 817 | "normal")) |
| 673 | (ibuffer-redisplay t)) | 818 | (ibuffer-redisplay t)) |
| 674 | 819 | ||
| 820 | ;;;###autoload (autoload 'ibuffer-do-sort-by-major-mode "ibuf-ext.el") | ||
| 675 | (define-ibuffer-sorter major-mode | 821 | (define-ibuffer-sorter major-mode |
| 676 | "Sort the buffers by major modes. | 822 | "Sort the buffers by major modes. |
| 677 | Ordering is lexicographic." | 823 | Ordering is lexicographic." |
| @@ -685,6 +831,7 @@ Ordering is lexicographic." | |||
| 685 | (car b) | 831 | (car b) |
| 686 | major-mode))))) | 832 | major-mode))))) |
| 687 | 833 | ||
| 834 | ;;;###autoload (autoload 'ibuffer-do-sort-by-mode-name "ibuf-ext.el") | ||
| 688 | (define-ibuffer-sorter mode-name | 835 | (define-ibuffer-sorter mode-name |
| 689 | "Sort the buffers by their mode name. | 836 | "Sort the buffers by their mode name. |
| 690 | Ordering is lexicographic." | 837 | Ordering is lexicographic." |
| @@ -698,6 +845,7 @@ Ordering is lexicographic." | |||
| 698 | (car b) | 845 | (car b) |
| 699 | mode-name)))) | 846 | mode-name)))) |
| 700 | 847 | ||
| 848 | ;;;###autoload (autoload 'ibuffer-do-sort-by-alphabetic "ibuf-ext.el") | ||
| 701 | (define-ibuffer-sorter alphabetic | 849 | (define-ibuffer-sorter alphabetic |
| 702 | "Sort the buffers by their names. | 850 | "Sort the buffers by their names. |
| 703 | Ordering is lexicographic." | 851 | Ordering is lexicographic." |
| @@ -706,6 +854,7 @@ Ordering is lexicographic." | |||
| 706 | (buffer-name (car a)) | 854 | (buffer-name (car a)) |
| 707 | (buffer-name (car b)))) | 855 | (buffer-name (car b)))) |
| 708 | 856 | ||
| 857 | ;;;###autoload (autoload 'ibuffer-do-sort-by-size "ibuf-ext.el") | ||
| 709 | (define-ibuffer-sorter size | 858 | (define-ibuffer-sorter size |
| 710 | "Sort the buffers by their size." | 859 | "Sort the buffers by their size." |
| 711 | (:description "size") | 860 | (:description "size") |
| @@ -1051,22 +1200,7 @@ You can then feed the file name(s) to other commands with C-y. | |||
| 1051 | "View lines which match REGEXP in all marked buffers. | 1200 | "View lines which match REGEXP in all marked buffers. |
| 1052 | Optional argument NLINES says how many lines of context to display: it | 1201 | Optional argument NLINES says how many lines of context to display: it |
| 1053 | defaults to one." | 1202 | defaults to one." |
| 1054 | (interactive | 1203 | (interactive (occur-read-primary-args)) |
| 1055 | (list (let* ((default (car regexp-history)) | ||
| 1056 | (input | ||
| 1057 | (read-from-minibuffer | ||
| 1058 | (if default | ||
| 1059 | (format "List lines matching regexp (default `%s'): " | ||
| 1060 | default) | ||
| 1061 | "List lines matching regexp: ") | ||
| 1062 | nil | ||
| 1063 | nil | ||
| 1064 | nil | ||
| 1065 | 'regexp-history))) | ||
| 1066 | (if (equal input "") | ||
| 1067 | default | ||
| 1068 | input)) | ||
| 1069 | current-prefix-arg)) | ||
| 1070 | (if (or (not (integerp nlines)) | 1204 | (if (or (not (integerp nlines)) |
| 1071 | (< nlines 0)) | 1205 | (< nlines 0)) |
| 1072 | (setq nlines 1)) | 1206 | (setq nlines 1)) |