From d57941800355c2a967705089d9bc790a58d18a3a Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 25 Jan 2008 05:38:31 +0000 Subject: * 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. --- lisp/ibuf-ext.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lisp/ibuf-ext.el') 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 -- cgit v1.2.1