Mercurial > emacs
changeset 87960:4693d30bd9c1
* 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.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 25 Jan 2008 05:38:31 +0000 |
parents | e5108169bd0c |
children | 868797e785eb |
files | lisp/ChangeLog lisp/ibuf-ext.el lisp/ibuffer.el |
diffstat | 3 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Jan 25 05:03:52 2008 +0000 +++ b/lisp/ChangeLog Fri Jan 25 05:38:31 2008 +0000 @@ -1,3 +1,14 @@ +2008-01-25 Dan Nicolaescu <dann@ics.uci.edu> + + * 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. + 2008-01-25 Sven Joachim <svenjoac@gmx.de> * view.el (kill-buffer-if-not-modified): Don't pass t to
--- a/lisp/ibuf-ext.el Fri Jan 25 05:03:52 2008 +0000 +++ b/lisp/ibuf-ext.el Fri Jan 25 05:38:31 2008 +0000 @@ -1155,6 +1155,20 @@ (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
--- a/lisp/ibuffer.el Fri Jan 25 05:03:52 2008 +0000 +++ b/lisp/ibuffer.el Fri Jan 25 05:38:31 2008 +0000 @@ -209,6 +209,7 @@ :type '(choice (const :tag "Last view time" :value recency) (const :tag "Lexicographic" :value alphabetic) (const :tag "Buffer size" :value size) + (const :tag "File name" :value filename/process) (const :tag "Major mode" :value major-mode)) :group 'ibuffer) (defvar ibuffer-sorting-mode nil) @@ -447,6 +448,7 @@ (define-key map (kbd "s a") 'ibuffer-do-sort-by-alphabetic) (define-key map (kbd "s v") 'ibuffer-do-sort-by-recency) (define-key map (kbd "s s") 'ibuffer-do-sort-by-size) + (define-key map (kbd "s f") 'ibuffer-do-sort-by-filename/process) (define-key map (kbd "s m") 'ibuffer-do-sort-by-major-mode) (define-key map (kbd "/ m") 'ibuffer-filter-by-mode) @@ -828,6 +830,11 @@ (define-key map [down-mouse-3] 'ibuffer-mouse-popup-menu) map)) +(defvar ibuffer-filename/process-header-map + (let ((map (make-sparse-keymap))) + (define-key map [(mouse-1)] 'ibuffer-do-sort-by-filename/process) + map)) + (defvar ibuffer-mode-name-map (let ((map (make-sparse-keymap))) (define-key map [(mouse-2)] 'ibuffer-mouse-filter-by-mode) @@ -1753,6 +1760,7 @@ (define-ibuffer-column filename-and-process (:name "Filename/Process" + :header-mouse-map ibuffer-filename/process-header-map :summarizer (lambda (strings) (setq strings (delete "" strings)) @@ -2433,6 +2441,7 @@ '\\[ibuffer-toggle-sorting-mode]' - Rotate between the various sorting modes. '\\[ibuffer-invert-sorting]' - Reverse the current sorting order. '\\[ibuffer-do-sort-by-alphabetic]' - Sort the buffers lexicographically. + '\\[ibuffer-do-sort-by-filename/process]' - Sort the buffers by the file name. '\\[ibuffer-do-sort-by-recency]' - Sort the buffers by last viewing time. '\\[ibuffer-do-sort-by-size]' - Sort the buffers by size. '\\[ibuffer-do-sort-by-major-mode]' - Sort the buffers by major mode.