summaryrefslogtreecommitdiff
path: root/lisp/ibuf-ext.el
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2008-01-25 05:38:31 +0000
committerDan Nicolaescu <dann@ics.uci.edu>2008-01-25 05:38:31 +0000
commitd57941800355c2a967705089d9bc790a58d18a3a (patch)
tree23f2bea20d789d65aa67fa1cf256d40876e94d2b /lisp/ibuf-ext.el
parentf187f57d5474a33de6bd566ef7bdcb4de931c47c (diff)
downloademacs-d57941800355c2a967705089d9bc790a58d18a3a.tar.gz
* ibuffer.el (ibuffer-default-sorting-mode): Add option to sort by
file name. (ibuffer-mode-map): Add binding to sort by file name. (ibuffer-filename/process-header-map): New variable. (filename-and-process): Add a header that sorts by file name. (ibuffer-mode): Mention sorting by file name. * ibuf-ext.el (filename/process): New sorter.
Diffstat (limited to 'lisp/ibuf-ext.el')
-rw-r--r--lisp/ibuf-ext.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 0499fab51aa..82face5eccb 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1155,6 +1155,20 @@ Ordering is lexicographic."
(with-current-buffer (car b)
(buffer-size))))
+;;;###autoload (autoload 'ibuffer-do-sort-by-filename/process "ibuf-ext")
+(define-ibuffer-sorter filename/process
+ "Sort the buffers by their file name/process name."
+ (:description "file name")
+ (string-lessp
+ ;; FIXME: For now just compare the file name and the process name
+ ;; (if it exists). Is there a better way to do this?
+ (or (buffer-file-name (car a))
+ (let ((pr-a (get-buffer-process (car a))))
+ (and (processp pr-a) (process-name pr-a))))
+ (or (buffer-file-name (car b))
+ (let ((pr-b (get-buffer-process (car b))))
+ (and (processp pr-b) (process-name pr-b))))))
+
;;; Functions to emulate bs.el
;;;###autoload