1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-11 16:08:13 +00:00

* 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.
This commit is contained in:
Dan Nicolaescu 2008-01-25 05:38:31 +00:00
parent f187f57d54
commit d579418003
3 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -209,6 +209,7 @@ view of the buffers."
: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 @@ directory, like `default-directory'."
(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 @@ directory, like `default-directory'."
(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 @@ If point is on a group name, this function operates on that group."
(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 @@ Sorting commands:
'\\[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.