diff options
| author | Colin Walters | 2002-05-21 20:59:28 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-05-21 20:59:28 +0000 |
| commit | fd225d802e07751b6ec40ab4956ad04ef6f15c11 (patch) | |
| tree | 9eef66dd81c4ced4c099cd525fab255c84591a80 | |
| parent | 1bb57048b3c047820e429bffe409ee4a36900a72 (diff) | |
| download | emacs-fd225d802e07751b6ec40ab4956ad04ef6f15c11.tar.gz emacs-fd225d802e07751b6ec40ab4956ad04ef6f15c11.zip | |
(toplevel): Require font-lock, to get the face definitions.
(ibuffer-use-fontification): Deleted.
(column filename-and-process): New column.
(ibuffer-formats): Use it by default.
(ibuffer-name-map, ibuffer-mode-name-map)
(ibuffer-filter-group-map): Don't set parent to
`ibuffer-mode-map'.
(ibuffer-do-save, ibuffer-do-toggle-modified)
(ibuffer-do-toggle-read-only, ibuffer-do-delete)
(ibuffer-do-kill-on-deletion-marks): Include name in definition.
(ibuffer): New optional argument `formats'.
| -rw-r--r-- | lisp/ibuffer.el | 192 |
1 files changed, 100 insertions, 92 deletions
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 7bad0b02f98..b4f4aecf720 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el | |||
| @@ -36,6 +36,8 @@ | |||
| 36 | (require 'ibuf-macs) | 36 | (require 'ibuf-macs) |
| 37 | (require 'dired)) | 37 | (require 'dired)) |
| 38 | 38 | ||
| 39 | (require 'font-lock) | ||
| 40 | |||
| 39 | ;;; Compatibility | 41 | ;;; Compatibility |
| 40 | (eval-and-compile | 42 | (eval-and-compile |
| 41 | (if (fboundp 'window-list) | 43 | (if (fboundp 'window-list) |
| @@ -44,18 +46,7 @@ | |||
| 44 | (defun ibuffer-window-list () | 46 | (defun ibuffer-window-list () |
| 45 | (let ((ibuffer-window-list-result nil)) | 47 | (let ((ibuffer-window-list-result nil)) |
| 46 | (walk-windows #'(lambda (win) (push win ibuffer-window-list-result)) 'nomini) | 48 | (walk-windows #'(lambda (win) (push win ibuffer-window-list-result)) 'nomini) |
| 47 | (nreverse ibuffer-window-list-result)))) | 49 | (nreverse ibuffer-window-list-result))))) |
| 48 | |||
| 49 | (cond ((boundp 'global-font-lock-mode) | ||
| 50 | (defsubst ibuffer-use-fontification () | ||
| 51 | (when (boundp 'font-lock-mode) | ||
| 52 | font-lock-mode))) | ||
| 53 | ((boundp 'font-lock-auto-fontify) | ||
| 54 | (defsubst ibuffer-use-fontification () | ||
| 55 | font-lock-auto-fontify)) | ||
| 56 | (t | ||
| 57 | (defsubst ibuffer-use-fontification () | ||
| 58 | nil)))) | ||
| 59 | 50 | ||
| 60 | (defgroup ibuffer nil | 51 | (defgroup ibuffer nil |
| 61 | "An advanced replacement for `buffer-menu'. | 52 | "An advanced replacement for `buffer-menu'. |
| @@ -67,7 +58,7 @@ the ability to filter the displayed buffers by various criteria." | |||
| 67 | 58 | ||
| 68 | (defcustom ibuffer-formats '((mark modified read-only " " (name 16 16 :left :elide) | 59 | (defcustom ibuffer-formats '((mark modified read-only " " (name 16 16 :left :elide) |
| 69 | " " (size 6 -1 :right) | 60 | " " (size 6 -1 :right) |
| 70 | " " (mode 16 16 :right :elide) " " filename) | 61 | " " (mode 16 16 :right :elide) " " filename-and-process) |
| 71 | (mark " " (name 16 -1) " " filename)) | 62 | (mark " " (name 16 -1) " " filename)) |
| 72 | "A list of ways to display buffer lines. | 63 | "A list of ways to display buffer lines. |
| 73 | 64 | ||
| @@ -152,7 +143,10 @@ Each element should be of the form (PRIORITY FORM FACE), where | |||
| 152 | PRIORITY is an integer, FORM is an arbitrary form to evaluate in the | 143 | PRIORITY is an integer, FORM is an arbitrary form to evaluate in the |
| 153 | buffer, and FACE is the face to use for fontification. If the FORM | 144 | buffer, and FACE is the face to use for fontification. If the FORM |
| 154 | evaluates to non-nil, then FACE will be put on the buffer name. The | 145 | evaluates to non-nil, then FACE will be put on the buffer name. The |
| 155 | element with the highest PRIORITY takes precedence." | 146 | element with the highest PRIORITY takes precedence. |
| 147 | |||
| 148 | If you change this variable, you must kill the ibuffer buffer and | ||
| 149 | recreate it for the change to take effect." | ||
| 156 | :type '(repeat | 150 | :type '(repeat |
| 157 | (list (integer :tag "Priority") | 151 | (list (integer :tag "Priority") |
| 158 | (sexp :tag "Test Form") | 152 | (sexp :tag "Test Form") |
| @@ -756,7 +750,6 @@ directory, like `default-directory'." | |||
| 756 | (defvar ibuffer-name-map nil) | 750 | (defvar ibuffer-name-map nil) |
| 757 | (unless ibuffer-name-map | 751 | (unless ibuffer-name-map |
| 758 | (let ((map (make-sparse-keymap))) | 752 | (let ((map (make-sparse-keymap))) |
| 759 | (set-keymap-parent map ibuffer-mode-map) | ||
| 760 | (define-key map [(mouse-1)] 'ibuffer-mouse-toggle-mark) | 753 | (define-key map [(mouse-1)] 'ibuffer-mouse-toggle-mark) |
| 761 | (define-key map [(mouse-2)] 'ibuffer-mouse-visit-buffer) | 754 | (define-key map [(mouse-2)] 'ibuffer-mouse-visit-buffer) |
| 762 | (define-key map [down-mouse-3] 'ibuffer-mouse-popup-menu) | 755 | (define-key map [down-mouse-3] 'ibuffer-mouse-popup-menu) |
| @@ -765,7 +758,6 @@ directory, like `default-directory'." | |||
| 765 | (defvar ibuffer-mode-name-map nil) | 758 | (defvar ibuffer-mode-name-map nil) |
| 766 | (unless ibuffer-mode-name-map | 759 | (unless ibuffer-mode-name-map |
| 767 | (let ((map (make-sparse-keymap))) | 760 | (let ((map (make-sparse-keymap))) |
| 768 | (set-keymap-parent map ibuffer-mode-map) | ||
| 769 | (define-key map [(mouse-2)] 'ibuffer-mouse-filter-by-mode) | 761 | (define-key map [(mouse-2)] 'ibuffer-mouse-filter-by-mode) |
| 770 | (define-key map (kbd "RET") 'ibuffer-interactive-filter-by-mode) | 762 | (define-key map (kbd "RET") 'ibuffer-interactive-filter-by-mode) |
| 771 | (setq ibuffer-mode-name-map map))) | 763 | (setq ibuffer-mode-name-map map))) |
| @@ -773,7 +765,6 @@ directory, like `default-directory'." | |||
| 773 | (defvar ibuffer-mode-filter-group-map nil) | 765 | (defvar ibuffer-mode-filter-group-map nil) |
| 774 | (unless ibuffer-mode-filter-group-map | 766 | (unless ibuffer-mode-filter-group-map |
| 775 | (let ((map (make-sparse-keymap))) | 767 | (let ((map (make-sparse-keymap))) |
| 776 | (set-keymap-parent map ibuffer-mode-map) | ||
| 777 | (define-key map [(mouse-1)] 'ibuffer-mouse-toggle-mark) | 768 | (define-key map [(mouse-1)] 'ibuffer-mouse-toggle-mark) |
| 778 | (define-key map [(mouse-2)] 'ibuffer-mouse-toggle-filter-group) | 769 | (define-key map [(mouse-2)] 'ibuffer-mouse-toggle-filter-group) |
| 779 | (define-key map (kbd "RET") 'ibuffer-toggle-filter-group) | 770 | (define-key map (kbd "RET") 'ibuffer-toggle-filter-group) |
| @@ -786,6 +777,7 @@ directory, like `default-directory'." | |||
| 786 | "Whether or not to delete the window upon exiting `ibuffer'.") | 777 | "Whether or not to delete the window upon exiting `ibuffer'.") |
| 787 | 778 | ||
| 788 | (defvar ibuffer-did-modification nil) | 779 | (defvar ibuffer-did-modification nil) |
| 780 | (defvar ibuffer-category-alist nil) | ||
| 789 | 781 | ||
| 790 | (defvar ibuffer-sorting-functions-alist nil | 782 | (defvar ibuffer-sorting-functions-alist nil |
| 791 | "An alist of functions which describe how to sort buffers. | 783 | "An alist of functions which describe how to sort buffers. |
| @@ -1137,7 +1129,7 @@ a new window in the current frame, splitting vertically." | |||
| 1137 | (defsubst ibuffer-map-deletion-lines (func) | 1129 | (defsubst ibuffer-map-deletion-lines (func) |
| 1138 | (ibuffer-map-on-mark ibuffer-deletion-char func)) | 1130 | (ibuffer-map-on-mark ibuffer-deletion-char func)) |
| 1139 | 1131 | ||
| 1140 | (define-ibuffer-op save () | 1132 | (define-ibuffer-op ibuffer-do-save () |
| 1141 | "Save marked buffers as with `save-buffer'." | 1133 | "Save marked buffers as with `save-buffer'." |
| 1142 | (:complex t | 1134 | (:complex t |
| 1143 | :opstring "saved" | 1135 | :opstring "saved" |
| @@ -1154,19 +1146,19 @@ a new window in the current frame, splitting vertically." | |||
| 1154 | (save-buffer)))) | 1146 | (save-buffer)))) |
| 1155 | t) | 1147 | t) |
| 1156 | 1148 | ||
| 1157 | (define-ibuffer-op toggle-modified () | 1149 | (define-ibuffer-op ibuffer-do-toggle-modified () |
| 1158 | "Toggle modification flag of marked buffers." | 1150 | "Toggle modification flag of marked buffers." |
| 1159 | (:opstring "(un)marked as modified" | 1151 | (:opstring "(un)marked as modified" |
| 1160 | :modifier-p t) | 1152 | :modifier-p t) |
| 1161 | (set-buffer-modified-p (not (buffer-modified-p)))) | 1153 | (set-buffer-modified-p (not (buffer-modified-p)))) |
| 1162 | 1154 | ||
| 1163 | (define-ibuffer-op toggle-read-only () | 1155 | (define-ibuffer-op ibuffer-do-toggle-read-only () |
| 1164 | "Toggle read only status in marked buffers." | 1156 | "Toggle read only status in marked buffers." |
| 1165 | (:opstring "toggled read only status in" | 1157 | (:opstring "toggled read only status in" |
| 1166 | :modifier-p t) | 1158 | :modifier-p t) |
| 1167 | (toggle-read-only)) | 1159 | (toggle-read-only)) |
| 1168 | 1160 | ||
| 1169 | (define-ibuffer-op delete () | 1161 | (define-ibuffer-op ibuffer-do-delete () |
| 1170 | "Kill marked buffers as with `kill-this-buffer'." | 1162 | "Kill marked buffers as with `kill-this-buffer'." |
| 1171 | (:opstring "killed" | 1163 | (:opstring "killed" |
| 1172 | :active-opstring "kill" | 1164 | :active-opstring "kill" |
| @@ -1177,7 +1169,7 @@ a new window in the current frame, splitting vertically." | |||
| 1177 | 'kill | 1169 | 'kill |
| 1178 | nil)) | 1170 | nil)) |
| 1179 | 1171 | ||
| 1180 | (define-ibuffer-op kill-on-deletion-marks () | 1172 | (define-ibuffer-op ibuffer-do-kill-on-deletion-marks () |
| 1181 | "Kill buffers marked for deletion as with `kill-this-buffer'." | 1173 | "Kill buffers marked for deletion as with `kill-this-buffer'." |
| 1182 | (:opstring "killed" | 1174 | (:opstring "killed" |
| 1183 | :active-opstring "kill" | 1175 | :active-opstring "kill" |
| @@ -1359,11 +1351,14 @@ If point is on a group name, this function operates on that group." | |||
| 1359 | elide nil)) | 1351 | elide nil)) |
| 1360 | (list sym min max align elide))) | 1352 | (list sym min max align elide))) |
| 1361 | form)) | 1353 | form)) |
| 1354 | |||
| 1355 | (defsubst ibuffer-get-category (name) | ||
| 1356 | (cdr (assq name ibuffer-category-alist))) | ||
| 1362 | 1357 | ||
| 1363 | (defun ibuffer-compile-make-eliding-form (strvar elide from-end-p) | 1358 | (defun ibuffer-compile-make-eliding-form (strvar elide from-end-p) |
| 1364 | (let ((ellipsis (if (ibuffer-use-fontification) | 1359 | (let ((ellipsis (propertize ibuffer-eliding-string 'category |
| 1365 | (propertize ibuffer-eliding-string 'face 'bold) | 1360 | (ibuffer-get-category |
| 1366 | ibuffer-eliding-string))) | 1361 | 'ibuffer-category-eliding-string)))) |
| 1367 | (if (or elide ibuffer-elide-long-columns) | 1362 | (if (or elide ibuffer-elide-long-columns) |
| 1368 | `(if (> strlen 5) | 1363 | `(if (> strlen 5) |
| 1369 | ,(if from-end-p | 1364 | ,(if from-end-p |
| @@ -1462,7 +1457,7 @@ If point is on a group name, this function operates on that group." | |||
| 1462 | ;; generate a call to the column function. | 1457 | ;; generate a call to the column function. |
| 1463 | (ibuffer-aif (assq sym ibuffer-inline-columns) | 1458 | (ibuffer-aif (assq sym ibuffer-inline-columns) |
| 1464 | (nth 1 it) | 1459 | (nth 1 it) |
| 1465 | `(,sym buffer mark))) | 1460 | `(,sym buffer mark (current-buffer)))) |
| 1466 | ;; You're not expected to understand this. Hell, I | 1461 | ;; You're not expected to understand this. Hell, I |
| 1467 | ;; don't even understand it, and I wrote it five | 1462 | ;; don't even understand it, and I wrote it five |
| 1468 | ;; minutes ago. | 1463 | ;; minutes ago. |
| @@ -1474,8 +1469,16 @@ If point is on a group name, this function operates on that group." | |||
| 1474 | (put ',sym 'ibuffer-column-summary | 1469 | (put ',sym 'ibuffer-column-summary |
| 1475 | (cons ret (get ',sym 'ibuffer-column-summary))) | 1470 | (cons ret (get ',sym 'ibuffer-column-summary))) |
| 1476 | ret))) | 1471 | ret))) |
| 1477 | (lambda (arg sym) | 1472 | ;; We handle the `name' column specially. |
| 1478 | `(insert ,arg)))) | 1473 | (if (eq sym 'ibuffer-make-column-name) |
| 1474 | (lambda (arg sym) | ||
| 1475 | `(let ((pt (point))) | ||
| 1476 | (insert ,arg) | ||
| 1477 | (put-text-property pt (point) | ||
| 1478 | 'category | ||
| 1479 | (ibuffer-buffer-name-category buffer mark)))) | ||
| 1480 | (lambda (arg sym) | ||
| 1481 | `(insert ,arg))))) | ||
| 1479 | (mincompform `(< strlen ,(if (integerp min) | 1482 | (mincompform `(< strlen ,(if (integerp min) |
| 1480 | min | 1483 | min |
| 1481 | 'min))) | 1484 | 'min))) |
| @@ -1633,6 +1636,17 @@ If point is on a group name, this function operates on that group." | |||
| 1633 | dired-directory) | 1636 | dired-directory) |
| 1634 | "")))) | 1637 | "")))) |
| 1635 | 1638 | ||
| 1639 | (define-ibuffer-column filename-and-process (:name "Filename/Process") | ||
| 1640 | (let ((proc (get-buffer-process buffer)) | ||
| 1641 | (filename (ibuffer-make-column-filename buffer mark ibuffer-buf))) | ||
| 1642 | (if proc | ||
| 1643 | (concat (propertize (format "(%s %s) " proc (process-status proc)) | ||
| 1644 | 'category | ||
| 1645 | (with-current-buffer ibuffer-buf | ||
| 1646 | (ibuffer-get-category 'ibuffer-category-process))) | ||
| 1647 | filename) | ||
| 1648 | filename))) | ||
| 1649 | |||
| 1636 | (defun ibuffer-format-column (str width alignment) | 1650 | (defun ibuffer-format-column (str width alignment) |
| 1637 | (let ((left (make-string (/ width 2) ? )) | 1651 | (let ((left (make-string (/ width 2) ? )) |
| 1638 | (right (make-string (- width (/ width 2)) ? ))) | 1652 | (right (make-string (- width (/ width 2)) ? ))) |
| @@ -1641,52 +1655,22 @@ If point is on a group name, this function operates on that group." | |||
| 1641 | (:center (concat left str right)) | 1655 | (:center (concat left str right)) |
| 1642 | (t (concat str left right))))) | 1656 | (t (concat str left right))))) |
| 1643 | 1657 | ||
| 1644 | (defun ibuffer-fontify-region-function (beg end &optional verbose) | 1658 | (defun ibuffer-buffer-name-category (buf mark) |
| 1645 | (when verbose (message "Fontifying...")) | 1659 | (cond ((char-equal mark ibuffer-marked-char) |
| 1646 | (let ((inhibit-read-only t)) | 1660 | (ibuffer-get-category 'ibuffer-category-marked)) |
| 1647 | (save-excursion | 1661 | ((char-equal mark ibuffer-deletion-char) |
| 1648 | (goto-char beg) | 1662 | (ibuffer-get-category 'ibuffer-category-deleted)) |
| 1649 | (beginning-of-line) | 1663 | (t |
| 1650 | (while (< (point) end) | 1664 | (let ((level -1) |
| 1651 | (if (get-text-property (point) 'ibuffer-title-header) | 1665 | (i 0) |
| 1652 | (put-text-property (point) (line-end-position) 'face ibuffer-title-face) | 1666 | result) |
| 1653 | (if (get-text-property (point) 'ibuffer-filter-group-name) | 1667 | (dolist (e ibuffer-fontification-alist result) |
| 1654 | (put-text-property (point) (line-end-position) 'face | 1668 | (when (and (> (car e) level) |
| 1655 | ibuffer-filter-group-name-face) | 1669 | (with-current-buffer buf |
| 1656 | (unless (or (get-text-property (point) 'ibuffer-title) | 1670 | (eval (cadr e)))) |
| 1657 | (get-text-property (point) 'ibuffer-summary)) | 1671 | (setq level (car e) |
| 1658 | (multiple-value-bind (buf mark) | 1672 | result (car (nth i font-lock-category-alist)))) |
| 1659 | (get-text-property (point) 'ibuffer-properties) | 1673 | (incf i)))))) |
| 1660 | (let* ((namebeg (next-single-property-change (point) 'ibuffer-name-column | ||
| 1661 | nil (line-end-position))) | ||
| 1662 | (nameend (next-single-property-change namebeg 'ibuffer-name-column | ||
| 1663 | nil (line-end-position)))) | ||
| 1664 | (put-text-property namebeg | ||
| 1665 | nameend | ||
| 1666 | 'face | ||
| 1667 | (cond ((char-equal mark ibuffer-marked-char) | ||
| 1668 | ibuffer-marked-face) | ||
| 1669 | ((char-equal mark ibuffer-deletion-char) | ||
| 1670 | ibuffer-deletion-face) | ||
| 1671 | (t | ||
| 1672 | (let ((level -1) | ||
| 1673 | result) | ||
| 1674 | (dolist (e ibuffer-fontification-alist result) | ||
| 1675 | (when (and (> (car e) level) | ||
| 1676 | (with-current-buffer buf | ||
| 1677 | (eval (cadr e)))) | ||
| 1678 | (setq level (car e) | ||
| 1679 | result | ||
| 1680 | (if (symbolp (caddr e)) | ||
| 1681 | (if (facep (caddr e)) | ||
| 1682 | (caddr e) | ||
| 1683 | (symbol-value (caddr e)))))))))))))))) | ||
| 1684 | (forward-line 1)))) | ||
| 1685 | (when verbose (message "Fontifying...done"))) | ||
| 1686 | |||
| 1687 | (defun ibuffer-unfontify-region-function (beg end) | ||
| 1688 | (let ((inhibit-read-only t)) | ||
| 1689 | (remove-text-properties beg end '(face nil)))) | ||
| 1690 | 1674 | ||
| 1691 | (defun ibuffer-insert-buffer-line (buffer mark format) | 1675 | (defun ibuffer-insert-buffer-line (buffer mark format) |
| 1692 | "Insert a line describing BUFFER and MARK using FORMAT." | 1676 | "Insert a line describing BUFFER and MARK using FORMAT." |
| @@ -1898,7 +1882,7 @@ the value of point at the beginning of the line for that buffer." | |||
| 1898 | (next-single-property-change | 1882 | (next-single-property-change |
| 1899 | (point-min) 'ibuffer-title))) | 1883 | (point-min) 'ibuffer-title))) |
| 1900 | (goto-char (point-min)) | 1884 | (goto-char (point-min)) |
| 1901 | (put-text-property | 1885 | (add-text-properties |
| 1902 | (point) | 1886 | (point) |
| 1903 | (progn | 1887 | (progn |
| 1904 | (let ((opos (point))) | 1888 | (let ((opos (point))) |
| @@ -1922,7 +1906,7 @@ the value of point at the beginning of the line for that buffer." | |||
| 1922 | (- min len) | 1906 | (- min len) |
| 1923 | align) | 1907 | align) |
| 1924 | name)))))) | 1908 | name)))))) |
| 1925 | (put-text-property opos (point) 'ibuffer-title-header t) | 1909 | (add-text-properties opos (point) `(ibuffer-title-header t)) |
| 1926 | (insert "\n") | 1910 | (insert "\n") |
| 1927 | ;; Add the underlines | 1911 | ;; Add the underlines |
| 1928 | (let ((str (save-excursion | 1912 | (let ((str (save-excursion |
| @@ -1938,14 +1922,14 @@ the value of point at the beginning of the line for that buffer." | |||
| 1938 | str))) | 1922 | str))) |
| 1939 | (insert "\n")) | 1923 | (insert "\n")) |
| 1940 | (point)) | 1924 | (point)) |
| 1941 | 'ibuffer-title t) | 1925 | `(ibuffer-title t category ,(ibuffer-get-category 'ibuffer-category-title))) |
| 1942 | ;; Now, insert the summary columns. | 1926 | ;; Now, insert the summary columns. |
| 1943 | (goto-char (point-max)) | 1927 | (goto-char (point-max)) |
| 1944 | (if (get-text-property (1- (point-max)) 'ibuffer-summary) | 1928 | (if (get-text-property (1- (point-max)) 'ibuffer-summary) |
| 1945 | (delete-region (previous-single-property-change | 1929 | (delete-region (previous-single-property-change |
| 1946 | (point-max) 'ibuffer-summary) | 1930 | (point-max) 'ibuffer-summary) |
| 1947 | (point-max))) | 1931 | (point-max))) |
| 1948 | (put-text-property | 1932 | (add-text-properties |
| 1949 | (point) | 1933 | (point) |
| 1950 | (progn | 1934 | (progn |
| 1951 | (insert "\n") | 1935 | (insert "\n") |
| @@ -1972,7 +1956,7 @@ the value of point at the beginning of the line for that buffer." | |||
| 1972 | align) | 1956 | align) |
| 1973 | summary))))))) | 1957 | summary))))))) |
| 1974 | (point)) | 1958 | (point)) |
| 1975 | 'ibuffer-summary t))) | 1959 | `(ibuffer-summary t)))) |
| 1976 | 1960 | ||
| 1977 | (defun ibuffer-update-mode-name () | 1961 | (defun ibuffer-update-mode-name () |
| 1978 | (setq mode-name (format "Ibuffer by %s" (if ibuffer-sorting-mode | 1962 | (setq mode-name (format "Ibuffer by %s" (if ibuffer-sorting-mode |
| @@ -2080,9 +2064,12 @@ Do not display messages if SILENT is non-nil." | |||
| 2080 | (progn | 2064 | (progn |
| 2081 | (insert "[ " display-name " ]") | 2065 | (insert "[ " display-name " ]") |
| 2082 | (point)) | 2066 | (point)) |
| 2083 | `(ibuffer-filter-group-name ,name keymap ,ibuffer-mode-filter-group-map | 2067 | `(ibuffer-filter-group-name |
| 2084 | mouse-face highlight | 2068 | ,name |
| 2085 | help-echo ,(concat filter-string "mouse-1: toggle marks in this group\nmouse-2: hide/show this filtering group "))) | 2069 | category ,(ibuffer-get-category 'ibuffer-category-filter-group-name) |
| 2070 | keymap ,ibuffer-mode-filter-group-map | ||
| 2071 | mouse-face highlight | ||
| 2072 | help-echo ,(concat filter-string "mouse-1: toggle marks in this group\nmouse-2: hide/show this filtering group "))) | ||
| 2086 | (insert "\n") | 2073 | (insert "\n") |
| 2087 | (when bmarklist | 2074 | (when bmarklist |
| 2088 | (put-text-property | 2075 | (put-text-property |
| @@ -2169,7 +2156,7 @@ buffers which are visiting a file." | |||
| 2169 | 2156 | ||
| 2170 | ;;;###autoload | 2157 | ;;;###autoload |
| 2171 | (defun ibuffer (&optional other-window-p name qualifiers noselect | 2158 | (defun ibuffer (&optional other-window-p name qualifiers noselect |
| 2172 | shrink filter-groups) | 2159 | shrink filter-groups formats) |
| 2173 | "Begin using `ibuffer' to edit a list of buffers. | 2160 | "Begin using `ibuffer' to edit a list of buffers. |
| 2174 | Type 'h' after entering ibuffer for more information. | 2161 | Type 'h' after entering ibuffer for more information. |
| 2175 | 2162 | ||
| @@ -2182,7 +2169,10 @@ Optional argument NOSELECT means don't select the Ibuffer buffer. | |||
| 2182 | Optional argument SHRINK means shrink the buffer to minimal size. The | 2169 | Optional argument SHRINK means shrink the buffer to minimal size. The |
| 2183 | special value `onewindow' means always use another window. | 2170 | special value `onewindow' means always use another window. |
| 2184 | Optional argument FILTER-GROUPS is an initial set of filtering | 2171 | Optional argument FILTER-GROUPS is an initial set of filtering |
| 2185 | groups to use; see `ibuffer-filter-groups'." | 2172 | groups to use; see `ibuffer-filter-groups'. |
| 2173 | Optional argument FORMATS is the value to use for `ibuffer-formats'. | ||
| 2174 | If specified, then the variable `ibuffer-formats' will have that value | ||
| 2175 | locally in this buffer." | ||
| 2186 | (interactive "P") | 2176 | (interactive "P") |
| 2187 | (when ibuffer-use-other-window | 2177 | (when ibuffer-use-other-window |
| 2188 | (setq other-window-p t)) | 2178 | (setq other-window-p t)) |
| @@ -2200,8 +2190,6 @@ groups to use; see `ibuffer-filter-groups'." | |||
| 2200 | (unless (eq major-mode 'ibuffer-mode) | 2190 | (unless (eq major-mode 'ibuffer-mode) |
| 2201 | (ibuffer-mode) | 2191 | (ibuffer-mode) |
| 2202 | (setq need-update t)) | 2192 | (setq need-update t)) |
| 2203 | (when (ibuffer-use-fontification) | ||
| 2204 | (require 'font-lock)) | ||
| 2205 | (setq ibuffer-delete-window-on-quit other-window-p) | 2193 | (setq ibuffer-delete-window-on-quit other-window-p) |
| 2206 | (when shrink | 2194 | (when shrink |
| 2207 | (setq ibuffer-shrink-to-minimum-size shrink)) | 2195 | (setq ibuffer-shrink-to-minimum-size shrink)) |
| @@ -2211,6 +2199,8 @@ groups to use; see `ibuffer-filter-groups'." | |||
| 2211 | (when filter-groups | 2199 | (when filter-groups |
| 2212 | (require 'ibuf-ext) | 2200 | (require 'ibuf-ext) |
| 2213 | (setq ibuffer-filter-groups filter-groups)) | 2201 | (setq ibuffer-filter-groups filter-groups)) |
| 2202 | (when formats | ||
| 2203 | (set (make-local-variable 'ibuffer-formats) formats)) | ||
| 2214 | (ibuffer-update nil) | 2204 | (ibuffer-update nil) |
| 2215 | ;; Skip the group name by default. | 2205 | ;; Skip the group name by default. |
| 2216 | (ibuffer-forward-line 0 t) | 2206 | (ibuffer-forward-line 0 t) |
| @@ -2406,12 +2396,30 @@ will be inserted before the group at point." | |||
| 2406 | ;; This makes things less ugly for Emacs 21 users with a non-nil | 2396 | ;; This makes things less ugly for Emacs 21 users with a non-nil |
| 2407 | ;; `show-trailing-whitespace'. | 2397 | ;; `show-trailing-whitespace'. |
| 2408 | (setq show-trailing-whitespace nil) | 2398 | (setq show-trailing-whitespace nil) |
| 2409 | ;; Dummy font-lock-defaults to make font-lock turn on. We want this | 2399 | |
| 2410 | ;; so we know when to enable ibuffer's internal fontification. | 2400 | (set (make-local-variable 'font-lock-category-alist) nil) |
| 2411 | (set (make-local-variable 'font-lock-defaults) | 2401 | (set (make-local-variable 'ibuffer-category-alist) nil) |
| 2412 | '(nil t nil nil nil | 2402 | (dolist (elt (list |
| 2413 | (font-lock-fontify-region-function . ibuffer-fontify-region-function) | 2403 | (cons (make-symbol "ibuffer-category-title") |
| 2414 | (font-lock-unfontify-region-function . ibuffer-unfontify-region-function))) | 2404 | ibuffer-title-face) |
| 2405 | (cons (make-symbol "ibuffer-category-marked") | ||
| 2406 | ibuffer-marked-face) | ||
| 2407 | (cons (make-symbol "ibuffer-category-deleted") | ||
| 2408 | ibuffer-deletion-face) | ||
| 2409 | (cons (make-symbol "ibuffer-category-filter-group-name") | ||
| 2410 | ibuffer-filter-group-name-face) | ||
| 2411 | (cons (make-symbol "ibuffer-category-process") | ||
| 2412 | 'italic) | ||
| 2413 | (cons (make-symbol "ibuffer-category-eliding-string") | ||
| 2414 | 'bold))) | ||
| 2415 | (push (cons (intern (symbol-name (car elt))) (car elt)) ibuffer-category-alist) | ||
| 2416 | (push elt font-lock-category-alist)) | ||
| 2417 | (let ((i (1- (length ibuffer-fontification-alist)))) | ||
| 2418 | (while (>= i 0) | ||
| 2419 | (push (cons (make-symbol (format "ibuffer-category-%d" i)) | ||
| 2420 | (nth 2 (nth i ibuffer-fontification-alist))) | ||
| 2421 | font-lock-category-alist) | ||
| 2422 | (decf i))) | ||
| 2415 | (set (make-local-variable 'revert-buffer-function) | 2423 | (set (make-local-variable 'revert-buffer-function) |
| 2416 | #'ibuffer-update) | 2424 | #'ibuffer-update) |
| 2417 | (set (make-local-variable 'ibuffer-sorting-mode) | 2425 | (set (make-local-variable 'ibuffer-sorting-mode) |