diff options
| author | Colin Walters | 2002-02-04 03:59:20 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-02-04 03:59:20 +0000 |
| commit | 523304ed517204ab393ff526dd7c15c8191abbaa (patch) | |
| tree | bdaa2e4e4be0ffe0dd491bcdc196be48644d9470 | |
| parent | 1255dfe678cb6b4d1aed62db4b97ccec6232db0a (diff) | |
| download | emacs-523304ed517204ab393ff526dd7c15c8191abbaa.tar.gz emacs-523304ed517204ab393ff526dd7c15c8191abbaa.zip | |
(ibuffer): Remove link; the "home page" for ibuffer is now the Emacs
CVS tree.
(ibuffer-formats): Doc fix.
(ibuffer-active-formats-name, ibuffer-current-formats): New functions.
(ibuffer-current-format): Use them.
(ibuffer-recompile-formats): Add support for
ibuffer-filter-format-alist.
(ibuffer-check-formats): Ditto.
(ibuffer-switch-format): Ditto.
(ibuffer-update-title): Ditto.
(define-ibuffer-column process): Remove unncessary consing.
| -rw-r--r-- | lisp/ChangeLog | 22 | ||||
| -rw-r--r-- | lisp/ibuffer.el | 69 |
2 files changed, 74 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2a4e66db325..abac7571917 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2002-02-03 Colin Walters <walters@verbum.org> | ||
| 2 | |||
| 3 | * ibuf-ext.el (ibuffer-filter-format-alist, | ||
| 4 | ibuffer-cached-filter-formats, | ||
| 5 | ibuffer-compiled-filter-formats): New variables. | ||
| 6 | |||
| 7 | * ibuffer.el (ibuffer): Remove link; the "home page" for ibuffer | ||
| 8 | is now the Emacs CVS tree. | ||
| 9 | (ibuffer-formats): Doc fix. | ||
| 10 | (ibuffer-active-formats-name, ibuffer-current-formats): New | ||
| 11 | functions. | ||
| 12 | (ibuffer-current-format): Use them. | ||
| 13 | (ibuffer-recompile-formats): Add support for | ||
| 14 | ibuffer-filter-format-alist. | ||
| 15 | (ibuffer-check-formats): Ditto. | ||
| 16 | (ibuffer-switch-format): Ditto. | ||
| 17 | (ibuffer-update-title): Ditto. | ||
| 18 | (define-ibuffer-column process): Remove unncessary consing. | ||
| 19 | |||
| 20 | * ibuf-macs.el (define-ibuffer-column): Add beginnings of support | ||
| 21 | for a summary column. | ||
| 22 | |||
| 1 | 2002-02-03 Andreas Schwab <schwab@suse.de> | 23 | 2002-02-03 Andreas Schwab <schwab@suse.de> |
| 2 | 24 | ||
| 3 | * window.el (save-selected-window): Move macro before first use. | 25 | * window.el (save-selected-window): Move macro before first use. |
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 4de63a51dba..8ca3d9d1933 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el | |||
| @@ -63,7 +63,6 @@ | |||
| 63 | Ibuffer allows you to operate on buffers in a manner much like Dired. | 63 | Ibuffer allows you to operate on buffers in a manner much like Dired. |
| 64 | Operations include sorting, marking by regular expression, and | 64 | Operations include sorting, marking by regular expression, and |
| 65 | the ability to filter the displayed buffers by various criteria." | 65 | the ability to filter the displayed buffers by various criteria." |
| 66 | :link '(url-link "http://cvs.verbum.org/ibuffer") | ||
| 67 | :group 'convenience) | 66 | :group 'convenience) |
| 68 | 67 | ||
| 69 | (defcustom ibuffer-formats '((mark modified read-only " " (name 16 16 :left :elide) | 68 | (defcustom ibuffer-formats '((mark modified read-only " " (name 16 16 :left :elide) |
| @@ -116,7 +115,7 @@ own!): | |||
| 116 | This format displays the current mark (if any), its modification and | 115 | This format displays the current mark (if any), its modification and |
| 117 | read-only status, as well as the name of the buffer and its size. In | 116 | read-only status, as well as the name of the buffer and its size. In |
| 118 | this format, the name is restricted to 16 characters (longer names | 117 | this format, the name is restricted to 16 characters (longer names |
| 119 | will be truncated, nad shorter names will be padded with spaces), and | 118 | will be truncated, and shorter names will be padded with spaces), and |
| 120 | the name is also aligned to the right. The size of the buffer will | 119 | the name is also aligned to the right. The size of the buffer will |
| 121 | be padded with spaces up to a minimum of six characters, but there is | 120 | be padded with spaces up to a minimum of six characters, but there is |
| 122 | no upper limit on its size. The size will also be aligned to the | 121 | no upper limit on its size. The size will also be aligned to the |
| @@ -1183,14 +1182,35 @@ become unmarked." | |||
| 1183 | (not (buffer-live-p buf))) | 1182 | (not (buffer-live-p buf))) |
| 1184 | (error "Buffer %s has been killed!" buf)) | 1183 | (error "Buffer %s has been killed!" buf)) |
| 1185 | buf)) | 1184 | buf)) |
| 1186 | 1185 | ||
| 1187 | (defun ibuffer-current-format () | 1186 | (defun ibuffer-active-formats-name () |
| 1188 | (when (null ibuffer-formats) | 1187 | (if (boundp 'ibuffer-filter-format-alist) |
| 1189 | (error "No format!")) | 1188 | (let ((ret nil)) |
| 1190 | (ibuffer-check-formats) | 1189 | (dolist (filter ibuffer-filtering-qualifiers ret) |
| 1190 | (let ((val (assq (car filter) ibuffer-filter-format-alist))) | ||
| 1191 | (when val | ||
| 1192 | (setq ret (car filter))))) | ||
| 1193 | (if ret | ||
| 1194 | ret | ||
| 1195 | :ibuffer-formats)) | ||
| 1196 | :ibuffer-formats)) | ||
| 1197 | |||
| 1198 | (defun ibuffer-current-formats (uncompiledp) | ||
| 1199 | (let* ((name (ibuffer-active-formats-name))) | ||
| 1200 | (ibuffer-check-formats) | ||
| 1201 | (if (eq name :ibuffer-formats) | ||
| 1202 | (if uncompiledp | ||
| 1203 | ibuffer-formats | ||
| 1204 | ibuffer-compiled-formats) | ||
| 1205 | (cadr (assq name | ||
| 1206 | (if uncompiledp | ||
| 1207 | ibuffer-filter-format-alist | ||
| 1208 | ibuffer-compiled-filter-formats)))))) | ||
| 1209 | |||
| 1210 | (defun ibuffer-current-format (&optional uncompiledp) | ||
| 1191 | (or ibuffer-current-format | 1211 | (or ibuffer-current-format |
| 1192 | (setq ibuffer-current-format 0)) | 1212 | (setq ibuffer-current-format 0)) |
| 1193 | (nth ibuffer-current-format ibuffer-compiled-formats)) | 1213 | (nth ibuffer-current-format (ibuffer-current-formats uncompiledp))) |
| 1194 | 1214 | ||
| 1195 | (defun ibuffer-expand-format-entry (form) | 1215 | (defun ibuffer-expand-format-entry (form) |
| 1196 | (if (or (consp form) | 1216 | (if (or (consp form) |
| @@ -1363,22 +1383,37 @@ become unmarked." | |||
| 1363 | "Recompile `ibuffer-formats'." | 1383 | "Recompile `ibuffer-formats'." |
| 1364 | (interactive) | 1384 | (interactive) |
| 1365 | (setq ibuffer-compiled-formats | 1385 | (setq ibuffer-compiled-formats |
| 1366 | (mapcar #'ibuffer-compile-format ibuffer-formats))) | 1386 | (mapcar #'ibuffer-compile-format ibuffer-formats)) |
| 1387 | (when (boundp 'ibuffer-filter-format-alist) | ||
| 1388 | (setq ibuffer-compiled-filter-formats | ||
| 1389 | (mapcar #'(lambda (entry) | ||
| 1390 | (cons (car entry) | ||
| 1391 | (mapcar #'(lambda (formats) | ||
| 1392 | (mapcar #'ibuffer-compile-format formats)) | ||
| 1393 | (cdr entry)))) | ||
| 1394 | ibuffer-filter-format-alist)))) | ||
| 1367 | 1395 | ||
| 1368 | (defun ibuffer-check-formats () | 1396 | (defun ibuffer-check-formats () |
| 1397 | (when (null ibuffer-formats) | ||
| 1398 | (error "No formats!")) | ||
| 1369 | (when (or (null ibuffer-compiled-formats) | 1399 | (when (or (null ibuffer-compiled-formats) |
| 1370 | (null ibuffer-cached-formats) | 1400 | (null ibuffer-cached-formats) |
| 1371 | (not (equal ibuffer-cached-formats ibuffer-formats)) | 1401 | (not (eq ibuffer-cached-formats ibuffer-formats)) |
| 1372 | (null ibuffer-cached-eliding-string) | 1402 | (null ibuffer-cached-eliding-string) |
| 1373 | (not (equal ibuffer-cached-eliding-string ibuffer-eliding-string)) | 1403 | (not (equal ibuffer-cached-eliding-string ibuffer-eliding-string)) |
| 1374 | (eql 0 ibuffer-cached-elide-long-columns) | 1404 | (eql 0 ibuffer-cached-elide-long-columns) |
| 1375 | (not (eql ibuffer-cached-elide-long-columns | 1405 | (not (eql ibuffer-cached-elide-long-columns |
| 1376 | ibuffer-elide-long-columns))) | 1406 | ibuffer-elide-long-columns)) |
| 1407 | (not (eq ibuffer-cached-filter-formats | ||
| 1408 | ibuffer-filter-format-alist)) | ||
| 1409 | (and ibuffer-filter-format-alist | ||
| 1410 | (null ibuffer-compiled-filter-formats))) | ||
| 1377 | (message "Formats have changed, recompiling...") | 1411 | (message "Formats have changed, recompiling...") |
| 1378 | (ibuffer-recompile-formats) | 1412 | (ibuffer-recompile-formats) |
| 1379 | (setq ibuffer-cached-formats ibuffer-formats | 1413 | (setq ibuffer-cached-formats ibuffer-formats |
| 1380 | ibuffer-cached-eliding-string ibuffer-eliding-string | 1414 | ibuffer-cached-eliding-string ibuffer-eliding-string |
| 1381 | ibuffer-cached-elide-long-columns ibuffer-elide-long-columns) | 1415 | ibuffer-cached-elide-long-columns ibuffer-elide-long-columns |
| 1416 | ibuffer-cached-filter-formats ibuffer-filter-format-alist) | ||
| 1382 | (message "Formats have changed, recompiling...done"))) | 1417 | (message "Formats have changed, recompiling...done"))) |
| 1383 | 1418 | ||
| 1384 | (defvar ibuffer-inline-columns nil) | 1419 | (defvar ibuffer-inline-columns nil) |
| @@ -1415,9 +1450,9 @@ become unmarked." | |||
| 1415 | 1450 | ||
| 1416 | (define-ibuffer-column process () | 1451 | (define-ibuffer-column process () |
| 1417 | (let ((proc (get-buffer-process buffer))) | 1452 | (let ((proc (get-buffer-process buffer))) |
| 1418 | (format "%s" (if proc | 1453 | (if proc |
| 1419 | (list proc (process-status proc)) | 1454 | (format "(%s %s)" proc (process-status proc)) |
| 1420 | "none")))) | 1455 | "none"))) |
| 1421 | 1456 | ||
| 1422 | (define-ibuffer-column filename () | 1457 | (define-ibuffer-column filename () |
| 1423 | (let ((directory-abbrev-alist ibuffer-directory-abbrev-alist)) | 1458 | (let ((directory-abbrev-alist ibuffer-directory-abbrev-alist)) |
| @@ -1659,7 +1694,7 @@ If optional argument INCLUDE-LINES is non-nil, return a list like | |||
| 1659 | (unless (consp ibuffer-formats) | 1694 | (unless (consp ibuffer-formats) |
| 1660 | (error "Ibuffer error: No formats!")) | 1695 | (error "Ibuffer error: No formats!")) |
| 1661 | (setq ibuffer-current-format | 1696 | (setq ibuffer-current-format |
| 1662 | (if (>= ibuffer-current-format (1- (length ibuffer-formats))) | 1697 | (if (>= ibuffer-current-format (1- (length (ibuffer-current-formats)))) |
| 1663 | 0 | 1698 | 0 |
| 1664 | (1+ ibuffer-current-format))) | 1699 | (1+ ibuffer-current-format))) |
| 1665 | (ibuffer-update-format) | 1700 | (ibuffer-update-format) |
| @@ -1832,7 +1867,7 @@ Do not display messages if SILENT is non-nil." | |||
| 1832 | (car entry) | 1867 | (car entry) |
| 1833 | (cdr entry) | 1868 | (cdr entry) |
| 1834 | --ibuffer-insert-buffers-and-marks-format))) | 1869 | --ibuffer-insert-buffers-and-marks-format))) |
| 1835 | (ibuffer-update-title (nth ibuffer-current-format ibuffer-formats))) | 1870 | (ibuffer-update-title (ibuffer-current-format t))) |
| 1836 | (setq buffer-read-only t) | 1871 | (setq buffer-read-only t) |
| 1837 | (set-buffer-modified-p ibuffer-did-modification) | 1872 | (set-buffer-modified-p ibuffer-did-modification) |
| 1838 | (setq ibuffer-did-modification nil) | 1873 | (setq ibuffer-did-modification nil) |