From: Lars Ingebrigtsen Date: Fri, 26 Jul 2019 12:38:35 +0000 (+0200) Subject: Separate out the "/" prefix into a named keymap in ibuffer X-Git-Tag: emacs-27.0.90~1817^2~98 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e986ba1968ad221be3150e4b4cd51a345e980e3b;p=emacs.git Separate out the "/" prefix into a named keymap in ibuffer * lisp/ibuffer.el (ibuffer--filter-map): Separate out into its own keymap (bug#25797). (ibuffer-mode-map): Bind the "/" key to it. --- diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 54992f279b9..23f7a2a8e4a 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -421,6 +421,49 @@ directory, like `default-directory'." groups-map)) +(defvar ibuffer--filter-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") 'ibuffer-filter-by-mode) + (define-key map (kbd "m") 'ibuffer-filter-by-used-mode) + (define-key map (kbd "M") 'ibuffer-filter-by-derived-mode) + (define-key map (kbd "n") 'ibuffer-filter-by-name) + (define-key map (kbd "E") 'ibuffer-filter-by-process) + (define-key map (kbd "*") 'ibuffer-filter-by-starred-name) + (define-key map (kbd "f") 'ibuffer-filter-by-filename) + (define-key map (kbd "b") 'ibuffer-filter-by-basename) + (define-key map (kbd ".") 'ibuffer-filter-by-file-extension) + (define-key map (kbd "<") 'ibuffer-filter-by-size-lt) + (define-key map (kbd ">") 'ibuffer-filter-by-size-gt) + (define-key map (kbd "i") 'ibuffer-filter-by-modified) + (define-key map (kbd "v") 'ibuffer-filter-by-visiting-file) + (define-key map (kbd "c") 'ibuffer-filter-by-content) + (define-key map (kbd "e") 'ibuffer-filter-by-predicate) + + (define-key map (kbd "r") 'ibuffer-switch-to-saved-filters) + (define-key map (kbd "a") 'ibuffer-add-saved-filters) + (define-key map (kbd "x") 'ibuffer-delete-saved-filters) + (define-key map (kbd "d") 'ibuffer-decompose-filter) + (define-key map (kbd "s") 'ibuffer-save-filters) + (define-key map (kbd "p") 'ibuffer-pop-filter) + (define-key map (kbd "") 'ibuffer-pop-filter) + (define-key map (kbd "!") 'ibuffer-negate-filter) + (define-key map (kbd "t") 'ibuffer-exchange-filters) + (define-key map (kbd "TAB") 'ibuffer-exchange-filters) + (define-key map (kbd "o") 'ibuffer-or-filter) + (define-key map (kbd "|") 'ibuffer-or-filter) + (define-key map (kbd "&") 'ibuffer-and-filter) + (define-key map (kbd "g") 'ibuffer-filters-to-filter-group) + (define-key map (kbd "P") 'ibuffer-pop-filter-group) + (define-key map (kbd "S-") 'ibuffer-pop-filter-group) + (define-key map (kbd "D") 'ibuffer-decompose-filter-group) + (define-key map (kbd "/") 'ibuffer-filter-disable) + + (define-key map (kbd "S") 'ibuffer-save-filter-groups) + (define-key map (kbd "R") 'ibuffer-switch-to-saved-filter-groups) + (define-key map (kbd "X") 'ibuffer-delete-saved-filter-groups) + (define-key map (kbd "\\") 'ibuffer-clear-filter-groups) + map)) + (defvar ibuffer-mode-map (let ((map (make-keymap))) (define-key map (kbd "0") 'digit-argument) @@ -484,41 +527,6 @@ directory, like `default-directory'." (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 "/ RET") 'ibuffer-filter-by-mode) - (define-key map (kbd "/ m") 'ibuffer-filter-by-used-mode) - (define-key map (kbd "/ M") 'ibuffer-filter-by-derived-mode) - (define-key map (kbd "/ n") 'ibuffer-filter-by-name) - (define-key map (kbd "/ E") 'ibuffer-filter-by-process) - (define-key map (kbd "/ *") 'ibuffer-filter-by-starred-name) - (define-key map (kbd "/ f") 'ibuffer-filter-by-filename) - (define-key map (kbd "/ b") 'ibuffer-filter-by-basename) - (define-key map (kbd "/ .") 'ibuffer-filter-by-file-extension) - (define-key map (kbd "/ <") 'ibuffer-filter-by-size-lt) - (define-key map (kbd "/ >") 'ibuffer-filter-by-size-gt) - (define-key map (kbd "/ i") 'ibuffer-filter-by-modified) - (define-key map (kbd "/ v") 'ibuffer-filter-by-visiting-file) - (define-key map (kbd "/ c") 'ibuffer-filter-by-content) - (define-key map (kbd "/ e") 'ibuffer-filter-by-predicate) - - (define-key map (kbd "/ r") 'ibuffer-switch-to-saved-filters) - (define-key map (kbd "/ a") 'ibuffer-add-saved-filters) - (define-key map (kbd "/ x") 'ibuffer-delete-saved-filters) - (define-key map (kbd "/ d") 'ibuffer-decompose-filter) - (define-key map (kbd "/ s") 'ibuffer-save-filters) - (define-key map (kbd "/ p") 'ibuffer-pop-filter) - (define-key map (kbd "/ ") 'ibuffer-pop-filter) - (define-key map (kbd "/ !") 'ibuffer-negate-filter) - (define-key map (kbd "/ t") 'ibuffer-exchange-filters) - (define-key map (kbd "/ TAB") 'ibuffer-exchange-filters) - (define-key map (kbd "/ o") 'ibuffer-or-filter) - (define-key map (kbd "/ |") 'ibuffer-or-filter) - (define-key map (kbd "/ &") 'ibuffer-and-filter) - (define-key map (kbd "/ g") 'ibuffer-filters-to-filter-group) - (define-key map (kbd "/ P") 'ibuffer-pop-filter-group) - (define-key map (kbd "/ S-") 'ibuffer-pop-filter-group) - (define-key map (kbd "/ D") 'ibuffer-decompose-filter-group) - (define-key map (kbd "/ /") 'ibuffer-filter-disable) - (define-key map (kbd "M-n") 'ibuffer-forward-filter-group) (define-key map "\t" 'ibuffer-forward-filter-group) (define-key map (kbd "M-p") 'ibuffer-backward-filter-group) @@ -526,10 +534,6 @@ directory, like `default-directory'." (define-key map (kbd "M-j") 'ibuffer-jump-to-filter-group) (define-key map (kbd "C-k") 'ibuffer-kill-line) (define-key map (kbd "C-y") 'ibuffer-yank) - (define-key map (kbd "/ S") 'ibuffer-save-filter-groups) - (define-key map (kbd "/ R") 'ibuffer-switch-to-saved-filter-groups) - (define-key map (kbd "/ X") 'ibuffer-delete-saved-filter-groups) - (define-key map (kbd "/ \\") 'ibuffer-clear-filter-groups) (define-key map (kbd "% n") 'ibuffer-mark-by-name-regexp) (define-key map (kbd "% m") 'ibuffer-mark-by-mode-regexp) @@ -580,6 +584,8 @@ directory, like `default-directory'." (define-key map (kbd "C-x 4 RET") 'ibuffer-visit-buffer-other-window) (define-key map (kbd "C-x 5 RET") 'ibuffer-visit-buffer-other-frame) + (define-key map (kbd "/") ibuffer--filter-map) + (define-key map [menu-bar view] (cons "View" (make-sparse-keymap "View")))