Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 854 lines (759 sloc) 34.025 kb
530d89f @thierryvolpiatto Enable lexical-binding in all files.
thierryvolpiatto authored
1 ;;; helm-buffers.el --- helm support for buffers. -*- lexical-binding: t -*-
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
2
7c31479 @thierryvolpiatto Update copyrights.
thierryvolpiatto authored
3 ;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiatto@gmail.com>
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
4
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, either version 3 of the License, or
8 ;; (at your option) any later version.
9
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
14
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Code:
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
19
b740a4b @thierryvolpiatto Finish replacing cl symbols and requiring cl-lib, no compile error.
thierryvolpiatto authored
20 (require 'cl-lib)
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
21 (require 'helm)
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
22 (require 'helm-utils)
7974fc5 @thierryvolpiatto Create autoload system in helm-config.
thierryvolpiatto authored
23 (require 'helm-elscreen)
c4ea874 @thierryvolpiatto * helm-files.el (helm-ff-directory-files): Always reread an ftp direc…
thierryvolpiatto authored
24 (require 'helm-grep)
7a445b2 @itiut Fix autoloading helm-buffers-list
itiut authored
25 (require 'helm-plugin)
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
26 (require 'helm-regexp)
8ef7c43 @thierryvolpiatto * helm-buffers.el: Declare helm-comp-read and require *help.
thierryvolpiatto authored
27 (require 'helm-help)
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
28
7dac376 @thierryvolpiatto * helm-buffers.el: Use ido to fetch buffers-list as suggested by Dan …
thierryvolpiatto authored
29 (declare-function ido-make-buffer-list "ido" (default))
57ef03c @thierryvolpiatto * helm-buffers.el: Declare some ido var and fn to shutup byte compiler.
thierryvolpiatto authored
30 (declare-function ido-add-virtual-buffers-to-list "ido")
8ef7c43 @thierryvolpiatto * helm-buffers.el: Declare helm-comp-read and require *help.
thierryvolpiatto authored
31 (declare-function helm-comp-read "helm-mode")
57ef03c @thierryvolpiatto * helm-buffers.el: Declare some ido var and fn to shutup byte compiler.
thierryvolpiatto authored
32
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
33
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
34 (defgroup helm-buffers nil
35 "Buffers related Applications and libraries for Helm."
36 :group 'helm)
37
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
38 (defcustom helm-boring-buffer-regexp-list
80c34cb @thierryvolpiatto * helm-buffers.el (helm-c-boring-buffer-regexp-list): New, replacemen…
thierryvolpiatto authored
39 '("\\` " "\\*helm" "\\*helm-mode" "\\*Echo Area" "\\*Minibuf")
40 "The regexp list that match boring buffers.
41 Buffer candidates matching these regular expression will be
42 filtered from the list of candidates if the
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
43 `helm-skip-boring-buffers' candidate transformer is used."
3aeb618 @thierryvolpiatto Fix defcustoms.
thierryvolpiatto authored
44 :type '(repeat (choice regexp))
80c34cb @thierryvolpiatto * helm-buffers.el (helm-c-boring-buffer-regexp-list): New, replacemen…
thierryvolpiatto authored
45 :group 'helm-buffers)
46
504588a @thierryvolpiatto * helm-buffers.el: let user choose a mode for new buffers.
thierryvolpiatto authored
47 (defcustom helm-buffers-favorite-modes '(lisp-interaction-mode
48 emacs-lisp-mode
49 text-mode
50 org-mode)
8d082d5 correct type prefered => preferred
Le Wang authored
51 "List of preferred mode to open new buffers with."
3aeb618 @thierryvolpiatto Fix defcustoms.
thierryvolpiatto authored
52 :type '(repeat (choice function))
504588a @thierryvolpiatto * helm-buffers.el: let user choose a mode for new buffers.
thierryvolpiatto authored
53 :group 'helm-buffers)
54
7577432 @thierryvolpiatto * helm-buffers.el (helm-buffer-max-length): new user var.
thierryvolpiatto authored
55 (defcustom helm-buffer-max-length 20
9eb7a6a @thierryvolpiatto * helm-buffers.el (helm-buffer-max-length): Allow setting it to nil.
thierryvolpiatto authored
56 "Max length of buffer names before truncate.
461f1d7 @thierryvolpiatto * helm-buffers.el (helm-buffer-max-length): Issue #267.
thierryvolpiatto authored
57 When disabled (nil) use the longest buffer-name length found."
7577432 @thierryvolpiatto * helm-buffers.el (helm-buffer-max-length): new user var.
thierryvolpiatto authored
58 :group 'helm-buffers
461f1d7 @thierryvolpiatto * helm-buffers.el (helm-buffer-max-length): Issue #267.
thierryvolpiatto authored
59 :type '(choice (const :tag "Disabled" nil)
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
60 (integer :tag "Length before truncate")))
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
61
62 (defcustom helm-buffer-details-flag t
63 "Always show details in buffer list when non--nil."
64 :group 'helm-buffers
65 :type 'boolean)
66
aae877e @thierryvolpiatto * helm-buffers.el: Add fuzzy searching matching.
thierryvolpiatto authored
67 (defcustom helm-buffers-fuzzy-matching nil
775d8ff @thierryvolpiatto * helm-buffers.el (helm-buffers-fuzzy-matching): Fix docstring, no co…
thierryvolpiatto authored
68 "Fuzzy matching buffer names when non--nil.
69 Only buffer names are fuzzy matched when this is enabled,
70 `major-mode' matching is not affected by this."
aae877e @thierryvolpiatto * helm-buffers.el: Add fuzzy searching matching.
thierryvolpiatto authored
71 :group 'helm-buffers
72 :type 'boolean)
73
e7ba0ca @thierryvolpiatto Try to fix slowness with many tramp buffers (#749).
thierryvolpiatto authored
74 (defcustom helm-buffer-skip-remote-checking nil
75 "Ignore checking for `file-exists-p' on remote files."
76 :group 'helm-buffers
77 :type 'boolean)
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
78
79 ;;; Faces
80 ;;
81 ;;
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
82 (defgroup helm-buffers-faces nil
83 "Customize the appearance of helm-buffers."
84 :prefix "helm-"
85 :group 'helm-buffers
86 :group 'helm-faces)
87
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
88 (defface helm-buffer-saved-out
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
89 '((t (:foreground "red" :background "black")))
09bc1b0 @thierryvolpiatto * helm-buffers.el: Show size of buffers.
thierryvolpiatto authored
90 "Face used for buffer files modified outside of emacs."
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
91 :group 'helm-buffers-faces)
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
92
93 (defface helm-buffer-not-saved
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
94 '((t (:foreground "Indianred2")))
09bc1b0 @thierryvolpiatto * helm-buffers.el: Show size of buffers.
thierryvolpiatto authored
95 "Face used for buffer files not already saved on disk."
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
96 :group 'helm-buffers-faces)
09bc1b0 @thierryvolpiatto * helm-buffers.el: Show size of buffers.
thierryvolpiatto authored
97
98 (defface helm-buffer-size
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
99 '((((background dark)) :foreground "RosyBrown")
100 (((background light)) :foreground "SlateGray"))
09bc1b0 @thierryvolpiatto * helm-buffers.el: Show size of buffers.
thierryvolpiatto authored
101 "Face used for buffer size."
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
102 :group 'helm-buffers-faces)
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
103
bd7cf37 @thierryvolpiatto * helm-buffers.el (helm-highlight-buffers): Add process buffer notifi…
thierryvolpiatto authored
104 (defface helm-buffer-process
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
105 '((t (:foreground "Sienna3")))
bd7cf37 @thierryvolpiatto * helm-buffers.el (helm-highlight-buffers): Add process buffer notifi…
thierryvolpiatto authored
106 "Face used for process status in buffer."
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
107 :group 'helm-buffers-faces)
bd7cf37 @thierryvolpiatto * helm-buffers.el (helm-highlight-buffers): Add process buffer notifi…
thierryvolpiatto authored
108
e79dc16 @thierryvolpiatto * helm-buffers.el: Add a face for directory `helm-buffer-directory' (…
thierryvolpiatto authored
109 (defface helm-buffer-directory
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
110 '((t (:foreground "DarkRed" :background "LightGray")))
e79dc16 @thierryvolpiatto * helm-buffers.el: Add a face for directory `helm-buffer-directory' (…
thierryvolpiatto authored
111 "Face used for directories in `helm-buffers-list'."
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
112 :group 'helm-buffers-faces)
e79dc16 @thierryvolpiatto * helm-buffers.el: Add a face for directory `helm-buffer-directory' (…
thierryvolpiatto authored
113
ade4e54 @thierryvolpiatto * helm-buffers.el (helm-buffer-file): New face (#641).
thierryvolpiatto authored
114 (defface helm-buffer-file
0cf0464 @thierryvolpiatto Use same face for file and buffer-file (#817).
thierryvolpiatto authored
115 '((t :inherit font-lock-builtin-face))
ade4e54 @thierryvolpiatto * helm-buffers.el (helm-buffer-file): New face (#641).
thierryvolpiatto authored
116 "Face for buffer file names in `helm-buffers-list'."
97b2f30 @etanzapinsky Added helm faces to the Faces customize group.
etanzapinsky authored
117 :group 'helm-buffers-faces)
ade4e54 @thierryvolpiatto * helm-buffers.el (helm-buffer-file): New face (#641).
thierryvolpiatto authored
118
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
119
120 ;;; Buffers keymap
121 ;;
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
122 (defvar helm-buffer-map
b740a4b @thierryvolpiatto Finish replacing cl symbols and requiring cl-lib, no compile error.
thierryvolpiatto authored
123 (let ((map (make-sparse-keymap)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
124 (set-keymap-parent map helm-map)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
125 (define-key map (kbd "C-c ?") 'helm-buffer-help)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
126 ;; No need to have separate command for grep and zgrep
127 ;; as we don't use recursivity for buffers.
128 ;; So use zgrep for both as it is capable to handle non--compressed files.
129 (define-key map (kbd "M-g s") 'helm-buffer-run-zgrep)
750af58 @thierryvolpiatto * helm-buffers.el (helm-c-buffer-map): Bind C-s to multi occur.
thierryvolpiatto authored
130 (define-key map (kbd "C-s") 'helm-buffers-run-multi-occur)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
131 (define-key map (kbd "C-c o") 'helm-buffer-switch-other-window)
132 (define-key map (kbd "C-c C-o") 'helm-buffer-switch-other-frame)
133 (define-key map (kbd "C-c =") 'helm-buffer-run-ediff)
134 (define-key map (kbd "M-=") 'helm-buffer-run-ediff-merge)
135 (define-key map (kbd "C-=") 'helm-buffer-diff-persistent)
136 (define-key map (kbd "M-U") 'helm-buffer-revert-persistent)
b822fcf @thierryvolpiatto * helm-buffers.el (helm-buffer-run-kill-persistent): New command.
thierryvolpiatto authored
137 (define-key map (kbd "C-c d") 'helm-buffer-run-kill-persistent)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
138 (define-key map (kbd "M-D") 'helm-buffer-run-kill-buffers)
139 (define-key map (kbd "C-x C-s") 'helm-buffer-save-persistent)
140 (define-key map (kbd "C-M-%") 'helm-buffer-run-query-replace-regexp)
141 (define-key map (kbd "M-%") 'helm-buffer-run-query-replace)
142 (define-key map (kbd "M-m") 'helm-toggle-all-marks)
143 (define-key map (kbd "M-a") 'helm-mark-all)
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
144 (define-key map (kbd "C-]") 'helm-toggle-buffers-details)
467a44a @thierryvolpiatto * helm-buffers.el (helm-buffers-toggle-show-hidden-buffers): New, all…
thierryvolpiatto authored
145 (define-key map (kbd "C-c a") 'helm-buffers-toggle-show-hidden-buffers)
570bc0f @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers): New, bind it.
thierryvolpiatto authored
146 (define-key map (kbd "<C-M-SPC>") 'helm-buffers-mark-similar-buffers)
75dec2e @thierryvolpiatto * helm-buffers.el: Remove binding to elscreen.
thierryvolpiatto authored
147 map)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
148 "Keymap for buffer sources in helm.")
149
d31c524 @thierryvolpiatto * helm-buffers.el: Add keymap and actions for ido virtual source.
thierryvolpiatto authored
150 (defvar helm-buffers-ido-virtual-map
b740a4b @thierryvolpiatto Finish replacing cl symbols and requiring cl-lib, no compile error.
thierryvolpiatto authored
151 (let ((map (make-sparse-keymap)))
d31c524 @thierryvolpiatto * helm-buffers.el: Add keymap and actions for ido virtual source.
thierryvolpiatto authored
152 (set-keymap-parent map helm-map)
d3e5331 @thierryvolpiatto * helm-buffers.el: Add help command.
thierryvolpiatto authored
153 (define-key map (kbd "C-c ?") 'helm-buffers-ido-virtual-help)
d31c524 @thierryvolpiatto * helm-buffers.el: Add keymap and actions for ido virtual source.
thierryvolpiatto authored
154 (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window)
155 (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame)
156 (define-key map (kbd "M-g s") 'helm-ff-run-grep)
157 (define-key map (kbd "M-g z") 'helm-ff-run-zgrep)
158 (define-key map (kbd "M-D") 'helm-ff-run-delete-file)
159 (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally)
160 map))
26a9255 @thierryvolpiatto * helm-buffers.el: reorder and add new source for ido virtual buffers.
thierryvolpiatto authored
161
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
162
26a9255 @thierryvolpiatto * helm-buffers.el: reorder and add new source for ido virtual buffers.
thierryvolpiatto authored
163 (defvar helm-buffers-list-cache nil)
b4c69f1 @thierryvolpiatto * helm-buffers.el (helm-highlight-buffers): Set length of mode in init.
thierryvolpiatto authored
164 (defvar helm-buffer-max-len-mode nil)
b28ceca @thierryvolpiatto Fix `helm-set-local-variable' to work in an init function when force-…
thierryvolpiatto authored
165
166 (defun helm-buffers-list--init ()
167 ;; Issue #51 Create the list before `helm-buffer' creation.
168 (setq helm-buffers-list-cache (funcall (helm-attr 'buffer-list)))
169 (let ((result (cl-loop for b in helm-buffers-list-cache
170 maximize (length b) into len-buf
171 maximize (length (with-current-buffer b
172 (symbol-name major-mode)))
173 into len-mode
174 finally return (cons len-buf len-mode))))
175 (unless (default-value 'helm-buffer-max-length)
176 (helm-set-local-variable 'helm-buffer-max-length (car result)))
177 (unless (default-value 'helm-buffer-max-len-mode)
178 (helm-set-local-variable 'helm-buffer-max-len-mode (cdr result)))))
179
abd386a @thierryvolpiatto * helm-source.el: add a defgeneric def for *setup-source.
thierryvolpiatto authored
180 (defclass helm-source-buffers (helm-source-sync helm-type-buffer)
3124ec7 @thierryvolpiatto * helm-buffers.el (helm-source-buffers): Add new slot :buffer-list.
thierryvolpiatto authored
181 ((buffer-list
182 :initarg :buffer-list
183 :initform #'helm-buffer-list
184 :custom function
185 :documentation
186 " A function with no arguments to create buffer list.")
b28ceca @thierryvolpiatto Fix `helm-set-local-variable' to work in an init function when force-…
thierryvolpiatto authored
187 (init :initform 'helm-buffers-list--init)
abd386a @thierryvolpiatto * helm-source.el: add a defgeneric def for *setup-source.
thierryvolpiatto authored
188 (candidates :initform helm-buffers-list-cache)
189 (matchplugin :initform nil)
6613f82 @thierryvolpiatto Add new functions for matching buffers.
thierryvolpiatto authored
190 (match :initform 'helm-buffers-match-function)
abd386a @thierryvolpiatto * helm-source.el: add a defgeneric def for *setup-source.
thierryvolpiatto authored
191 (persistent-action :initform 'helm-buffers-list-persistent-action)
f146eb9 @thierryvolpiatto Fix some bugs happening after resuming.
thierryvolpiatto authored
192 (resume :initform (lambda ()
193 (run-with-idle-timer
194 0.1 nil (lambda ()
195 (with-helm-buffer
196 (helm-force-update))))))
abd386a @thierryvolpiatto * helm-source.el: add a defgeneric def for *setup-source.
thierryvolpiatto authored
197 (keymap :initform helm-buffer-map)
198 (volatile :initform t)
199 (mode-line :initform helm-buffer-mode-line-string)
200 (persistent-help
201 :initform
202 "Show this buffer / C-u \\[helm-execute-persistent-action]: Kill this buffer")))
203
1bb02a1 @thierryvolpiatto Define `helm-source-buffers-list' at run time.
thierryvolpiatto authored
204 (defvar helm-source-buffers-list nil)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
205
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
206 (defvar helm-source-buffer-not-found
abd386a @thierryvolpiatto * helm-source.el: add a defgeneric def for *setup-source.
thierryvolpiatto authored
207 (helm-build-dummy-source
208 "Create buffer"
a4c5758 @thierryvolpiatto * helm-buffers.el: Show action in buffer action properly (#674).
thierryvolpiatto authored
209 :action (helm-make-actions
210 "Create buffer (C-u choose mode)"
211 (lambda (candidate)
e19ec9c @thierryvolpiatto Create buffer maybe according to auto-mode-alist (#949).
thierryvolpiatto authored
212 (let ((mjm (or (and helm-current-prefix-arg
213 (intern-soft (helm-comp-read
214 "Major-mode: "
215 helm-buffers-favorite-modes)))
216 (cl-loop for (r . m) in auto-mode-alist
217 when (string-match r candidate)
218 return m)))
abd386a @thierryvolpiatto * helm-source.el: add a defgeneric def for *setup-source.
thierryvolpiatto authored
219 (buffer (get-buffer-create candidate)))
220 (if mjm
221 (with-current-buffer buffer (funcall mjm))
222 (set-buffer-major-mode buffer))
1b48c0c @thierryvolpiatto Allow switching to more than one buffer (#861).
thierryvolpiatto authored
223 (switch-to-buffer buffer))))))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
224
288c711 @thierryvolpiatto * helm-elisp.el: Fix lisp-completion for lex.
thierryvolpiatto authored
225 (defvar ido-temp-list)
226 (defvar ido-ignored-list)
227 (defvar ido-process-ignore-lists)
57ef03c @thierryvolpiatto * helm-buffers.el: Declare some ido var and fn to shutup byte compiler.
thierryvolpiatto authored
228 (defvar ido-use-virtual-buffers)
229 (defvar ido-virtual-buffers)
288c711 @thierryvolpiatto * helm-elisp.el: Fix lisp-completion for lex.
thierryvolpiatto authored
230
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
231 (defvar helm-source-ido-virtual-buffers
5433a91 @thierryvolpiatto Allow fuzzy matching in ido virtual buffers.
thierryvolpiatto authored
232 (helm-build-sync-source "Ido virtual buffers"
233 :candidates (lambda ()
234 (let (ido-temp-list
235 ido-ignored-list
236 (ido-process-ignore-lists t))
237 (when ido-use-virtual-buffers
238 (ido-add-virtual-buffers-to-list)
239 ido-virtual-buffers)))
240 :fuzzy-match helm-buffers-fuzzy-matching
241 :keymap helm-buffers-ido-virtual-map
242 :mode-line helm-buffers-ido-virtual-mode-line-string
243 :action '(("Find file" . helm-find-many-files)
244 ("Find file other window" . find-file-other-window)
245 ("Find file other frame" . find-file-other-frame)
246 ("Find file as root" . helm-find-file-as-root)
247 ("Grep File(s) `C-u recurse'" . helm-find-files-grep)
248 ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep)
249 ("View file" . view-file)
250 ("Delete file(s)" . helm-delete-marked-files)
251 ("Open file externally (C-u to choose)"
252 . helm-open-file-externally))))
26a9255 @thierryvolpiatto * helm-buffers.el: reorder and add new source for ido virtual buffers.
thierryvolpiatto authored
253
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
254
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
255 (defvar ido-use-virtual-buffers)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
256 (defun helm-buffer-list ()
26a9255 @thierryvolpiatto * helm-buffers.el: reorder and add new source for ido virtual buffers.
thierryvolpiatto authored
257 "Return the current list of buffers.
258 Currently visible buffers are put at the end of the list.
259 See `ido-make-buffer-list' for more infos."
260 (require 'ido)
261 (let ((ido-process-ignore-lists t)
262 ido-ignored-list
263 ido-use-virtual-buffers)
264 (ido-make-buffer-list nil)))
265
09bc1b0 @thierryvolpiatto * helm-buffers.el: Show size of buffers.
thierryvolpiatto authored
266 (defun helm-buffer-size (buffer)
267 "Return size of BUFFER."
268 (with-current-buffer buffer
269 (save-restriction
270 (widen)
271 (helm-file-human-size
272 (- (position-bytes (point-max))
273 (position-bytes (point-min)))))))
274
50497b5 @thierryvolpiatto * helm-buffers.el: Issue #429 Toggle details hide size and mode and s…
thierryvolpiatto authored
275 (defun helm-buffer--show-details (buf-name prefix help-echo
9bc2702 @thierryvolpiatto Reindent all again.
thierryvolpiatto authored
276 size mode dir face1 face2
570bc0f @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers): New, bind it.
thierryvolpiatto authored
277 proc details type)
50497b5 @thierryvolpiatto * helm-buffers.el: Issue #429 Toggle details hide size and mode and s…
thierryvolpiatto authored
278 (append
279 (list
280 (concat prefix
281 (propertize buf-name 'face face1
570bc0f @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers): New, bind it.
thierryvolpiatto authored
282 'help-echo help-echo
283 'type type)))
50497b5 @thierryvolpiatto * helm-buffers.el: Issue #429 Toggle details hide size and mode and s…
thierryvolpiatto authored
284 (and details
285 (list size mode
286 (propertize
287 (if proc
288 (format "(%s %s in `%s')"
289 (process-name proc)
290 (process-status proc) dir)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
291 (format "(in `%s')" dir))
1592c28 @thierryvolpiatto Reindent all files.
thierryvolpiatto authored
292 'face face2)))))
50497b5 @thierryvolpiatto * helm-buffers.el: Issue #429 Toggle details hide size and mode and s…
thierryvolpiatto authored
293
294 (defun helm-buffer--details (buffer &optional details)
763d471 @jcinnamond Handle non-string mode names in buffer list.
jcinnamond authored
295 (let* ((mode (with-current-buffer buffer (format-mode-line mode-name)))
ede2e71 @russell * helm-buffers.el: Refactored buffer-list display.
russell authored
296 (buf (get-buffer buffer))
297 (size (propertize (helm-buffer-size buf)
298 'face 'helm-buffer-size))
299 (proc (get-buffer-process buf))
01f7a3a @thierryvolpiatto * helm-buffers.el: Fix alignment in buffer list.
thierryvolpiatto authored
300 (dir (with-current-buffer buffer (abbreviate-file-name default-directory)))
301 (file-name (helm-aif (buffer-file-name buf) (abbreviate-file-name it)))
ede2e71 @russell * helm-buffers.el: Refactored buffer-list display.
russell authored
302 (name (buffer-name buf))
303 (name-prefix (when (file-remote-p dir)
798c81f @thierryvolpiatto reindent.
thierryvolpiatto authored
304 (propertize "@ " 'face 'helm-ff-prefix))))
bbf370c @thierryvolpiatto Fix details on remote candidates (#749).
thierryvolpiatto authored
305 ;; No fancy things on remote buffers.
306 (if (and name-prefix helm-buffer-skip-remote-checking)
307 (helm-buffer--show-details
308 name name-prefix file-name size mode dir
309 'helm-buffer-file 'helm-buffer-process nil details 'filebuf)
310 (cond
311 ( ;; A dired buffer.
312 (rassoc buf dired-buffers)
313 (helm-buffer--show-details
314 name name-prefix dir size mode dir
315 'helm-buffer-directory 'helm-buffer-process nil details 'dired))
316 ;; A buffer file modified somewhere outside of emacs.=>red
317 ((and file-name
318 (file-exists-p file-name)
319 (not (verify-visited-file-modtime buf)))
320 (helm-buffer--show-details
321 name name-prefix file-name size mode dir
322 'helm-buffer-saved-out 'helm-buffer-process nil details 'modout))
4a25642 @thierryvolpiatto Buffers file with their file deleted or not already saved not shown c…
thierryvolpiatto authored
323 ;; A new buffer file not already saved on disk (or a deleted file) .=>indianred2
324 ((and file-name (not (file-exists-p file-name)))
bbf370c @thierryvolpiatto Fix details on remote candidates (#749).
thierryvolpiatto authored
325 (helm-buffer--show-details
326 name name-prefix file-name size mode dir
327 'helm-buffer-not-saved 'helm-buffer-process nil details 'notsaved))
328 ;; A buffer file modified and not saved on disk.=>orange
329 ((and file-name (buffer-modified-p buf))
330 (helm-buffer--show-details
331 name name-prefix file-name size mode dir
332 'helm-ff-symlink 'helm-buffer-process nil details 'mod))
333 ;; A buffer file not modified and saved on disk.=>green
334 (file-name
335 (helm-buffer--show-details
336 name name-prefix file-name size mode dir
337 'helm-buffer-file 'helm-buffer-process nil details 'filebuf))
338 ;; Any non--file buffer.=>grey italic
339 (t
340 (helm-buffer--show-details
341 name (and proc name-prefix) dir size mode dir
342 'italic 'helm-buffer-process proc details 'nofile))))))
ede2e71 @russell * helm-buffers.el: Refactored buffer-list display.
russell authored
343
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
344 (defun helm-highlight-buffers (buffers _source)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
345 "Transformer function to highlight BUFFERS list.
346 Should be called after others transformers i.e (boring buffers)."
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
347 (cl-loop for i in buffers
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
348 for (name size mode meta) = (if helm-buffer-details-flag
349 (helm-buffer--details i 'details)
350 (helm-buffer--details i))
351 for truncbuf = (if (> (string-width name) helm-buffer-max-length)
352 (helm-substring-by-width
353 name helm-buffer-max-length)
354 (concat name (make-string
355 (- (+ helm-buffer-max-length 3)
356 (string-width name)) ? )))
357 for len = (length mode)
358 when (> len helm-buffer-max-len-mode)
359 do (setq helm-buffer-max-len-mode len)
360 for fmode = (concat (make-string
361 (- (max helm-buffer-max-len-mode len) len) ? )
362 mode)
363 ;; The max length of a number should be 1023.9X where X is the
364 ;; units, this is 7 characters.
365 for formatted-size = (and size (format "%7s" size))
366 collect (cons (if helm-buffer-details-flag
367 (concat truncbuf "\t" formatted-size
368 " " fmode " " meta)
369 name)
df81970 @thierryvolpiatto Use a buffer as real candidate buffer and not a buffer-name (#948).
thierryvolpiatto authored
370 (get-buffer i))))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
371
e3d52cb @thierryvolpiatto Fix error related to buffer-names introduced by (#934).
thierryvolpiatto authored
372 (defun helm-buffer--get-preselection (buffer)
373 (let ((bufname (buffer-name buffer)))
374 (concat "^"
375 (if (and (null helm-buffer-details-flag)
376 (numberp helm-buffer-max-length)
377 (> (string-width bufname)
378 helm-buffer-max-length))
379 (regexp-quote
380 (helm-substring-by-width
381 bufname helm-buffer-max-length))
382 (concat (regexp-quote bufname)
383 (if helm-buffer-details-flag
384 "$" "[[:blank:]]+"))))))
65452ab @thierryvolpiatto * helm-buffers.el: Fix preselection in save and revert buffers.
thierryvolpiatto authored
385
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
386 (defun helm-toggle-buffers-details ()
387 (interactive)
65452ab @thierryvolpiatto * helm-buffers.el: Fix preselection in save and revert buffers.
thierryvolpiatto authored
388 (let ((preselect (helm-buffer--get-preselection
389 (helm-get-selection))))
50497b5 @thierryvolpiatto * helm-buffers.el: Issue #429 Toggle details hide size and mode and s…
thierryvolpiatto authored
390 (when helm-alive-p
391 (setq helm-buffer-details-flag (not helm-buffer-details-flag))
392 (helm-force-update preselect))))
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
393
40ada5b @thierryvolpiatto Fix unused args source in some filtered candidates functions.
thierryvolpiatto authored
394 (defun helm-buffers-sort-transformer (candidates _source)
5ca9239 @thierryvolpiatto * helm-buffers.el (helm-buffer-match-major-mode): Avoid matching all …
thierryvolpiatto authored
395 (if (string= helm-pattern "")
396 candidates
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
397 (sort candidates
398 #'(lambda (s1 s2)
399 (< (string-width s1) (string-width s2))))))
5ca9239 @thierryvolpiatto * helm-buffers.el (helm-buffer-match-major-mode): Avoid matching all …
thierryvolpiatto authored
400
06dc365 @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers-1): Fix typo.
thierryvolpiatto authored
401 (defun helm-buffers-mark-similar-buffers-1 ()
570bc0f @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers): New, bind it.
thierryvolpiatto authored
402 (with-helm-window
403 (let ((type (get-text-property
404 0 'type (helm-get-selection nil 'withprop))))
405 (save-excursion
406 (goto-char (helm-get-previous-header-pos))
407 (helm-next-line)
408 (let* ((next-head (helm-get-next-header-pos))
409 (end (and next-head
410 (save-excursion
411 (goto-char next-head)
412 (forward-line -1)
413 (point))))
414 (maxpoint (or end (point-max))))
415 (while (< (point) maxpoint)
416 (helm-mark-current-line)
417 (let ((cand (helm-get-selection nil 'withprop)))
418 (when (and (not (helm-this-visible-mark))
419 (eq (get-text-property 0 'type cand) type))
420 (helm-make-visible-mark)))
e88409c @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers-1): Fix paren er…
thierryvolpiatto authored
421 (forward-line 1) (end-of-line))))
422 (helm-mark-current-line)
423 (message "%s candidates marked" (length helm-marked-candidates)))))
570bc0f @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers): New, bind it.
thierryvolpiatto authored
424
cb26360 @thierryvolpiatto * helm-buffers.el (helm-buffers-mark-similar-buffers): Make it now a …
thierryvolpiatto authored
425 (defun helm-buffers-mark-similar-buffers ()
426 "Mark All buffers that have same property `type' than current.
427 i.e same color."
428 (interactive)
429 (let ((marked (helm-marked-candidates)))
430 (if (and (>= (length marked) 1)
431 (with-helm-window helm-visible-mark-overlays))
432 (helm-unmark-all)
433 (helm-buffers-mark-similar-buffers-1))))
434
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
435
b10cd31 @thierryvolpiatto * helm-buffers.el (helm-buffer-match-major-mode): Finally fix negation.
thierryvolpiatto authored
436 ;;; match functions
437 ;;
438 (defun helm-buffer--match-mjm (pattern mjm)
439 (when (string-match "\\`\\*" pattern)
7bc1a5c @thierryvolpiatto * helm-buffers.el (helm-buffer--match-mjm): Use patterns.
thierryvolpiatto authored
440 (cl-loop with patterns = (split-string (substring pattern 1) ",")
441 for pat in patterns
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
442 if (string-match "\\`!" pat)
443 collect (string-match (substring pat 1) mjm) into neg
444 else collect (string-match pat mjm) into pos
445 finally return
5437bd1 @thierryvolpiatto * helm-buffers.el (helm-buffer--match-mjm): Fix negation.
thierryvolpiatto authored
446 (let ((neg-test (cl-loop for i in neg thereis (numberp i)))
447 (pos-test (cl-loop for i in pos thereis (numberp i))))
448 (or
449 (and neg (not pos) (not neg-test))
450 (and pos pos-test)
451 (and neg neg-test (not neg-test)))))))
b10cd31 @thierryvolpiatto * helm-buffers.el (helm-buffer-match-major-mode): Finally fix negation.
thierryvolpiatto authored
452
453 (defun helm-buffer--match-pattern (pattern candidate)
9400e81 @thierryvolpiatto * helm-buffers.el (helm-buffer--match-pattern): Disable fuzzy matchin…
thierryvolpiatto authored
454 (let ((fun (if (and helm-buffers-fuzzy-matching
455 (not (string-match "\\`\\^" pattern)))
54cf01a @thierryvolpiatto * helm.el (helm--mapconcat-candidate): Renamed to `helm--mapconcat-pa…
thierryvolpiatto authored
456 #'helm--mapconcat-pattern
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
457 #'identity)))
458 (if (string-match "\\`!" pattern)
459 (not (string-match (funcall fun (substring pattern 1))
460 candidate))
461 (string-match (funcall fun pattern) candidate))))
763d471 @jcinnamond Handle non-string mode names in buffer list.
jcinnamond authored
462
6613f82 @thierryvolpiatto Add new functions for matching buffers.
thierryvolpiatto authored
463 (defun helm-buffers--match-from-mjm (candidate)
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
464 (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate))
465 (buf (get-buffer cand))
c29fddc @thierryvolpiatto * helm-buffers.el (helm-buffers--match-from-mjm): Fix no need to loop.
thierryvolpiatto authored
466 (regexp (cl-loop with pattern = helm-pattern
467 for p in (split-string pattern)
468 when (string-match "\\`\\*" p)
469 return p)))
470 (if regexp
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
471 (when buf
472 (with-current-buffer buf
473 (let ((mjm (format-mode-line mode-name)))
c29fddc @thierryvolpiatto * helm-buffers.el (helm-buffers--match-from-mjm): Fix no need to loop.
thierryvolpiatto authored
474 (helm-buffer--match-mjm regexp mjm))))
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
475 t)))
6613f82 @thierryvolpiatto Add new functions for matching buffers.
thierryvolpiatto authored
476
477 (defun helm-buffers--match-from-pat (candidate)
478 (let ((regexp-list (cl-loop with pattern = helm-pattern
479 for p in (split-string pattern)
480 unless (string-match
481 "\\`\\(\\*\\)\\|\\(/\\)\\|\\(@\\)" p)
482 collect p)))
483 (if regexp-list
484 (cl-loop for re in regexp-list
485 always (helm-buffer--match-pattern re candidate))
486 t)))
487
488 (defun helm-buffers--match-from-inside (candidate)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
489 (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate))
84031c5 @thierryvolpiatto * helm-buffers.el (helm-buffers-list--match-fn): Add filename matchin…
thierryvolpiatto authored
490 (buf (get-buffer cand))
6613f82 @thierryvolpiatto Add new functions for matching buffers.
thierryvolpiatto authored
491 (regexp (cl-loop with pattern = helm-pattern
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
492 for p in (split-string pattern)
493 when (string-match "\\`@\\(.*\\)" p)
494 return (match-string 1 p))))
6613f82 @thierryvolpiatto Add new functions for matching buffers.
thierryvolpiatto authored
495 (if regexp
496 (with-current-buffer buf
497 (save-excursion
498 (goto-char (point-min))
499 (re-search-forward regexp nil t)))
500 t)))
501
502 (defun helm-buffers--match-from-directory (candidate)
503 (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate))
504 (buf (get-buffer cand))
505 (buf-fname (buffer-file-name buf))
f88f666 @thierryvolpiatto Allow matching buffers from more than one directory.
thierryvolpiatto authored
506 (regexps (cl-loop with pattern = helm-pattern
c3748c0 @thierryvolpiatto * helm-buffers.el: Clean, remove DRY.
thierryvolpiatto authored
507 for p in (split-string pattern)
508 when (string-match "\\`/" p)
f88f666 @thierryvolpiatto Allow matching buffers from more than one directory.
thierryvolpiatto authored
509 collect p)))
3880ae6 @thierryvolpiatto Return nil on non file buffers when matching on directories.
thierryvolpiatto authored
510 (if regexps
f88f666 @thierryvolpiatto Allow matching buffers from more than one directory.
thierryvolpiatto authored
511 (cl-loop for re in regexps
512 thereis
3880ae6 @thierryvolpiatto Return nil on non file buffers when matching on directories.
thierryvolpiatto authored
513 (and buf-fname
514 (string-match
515 (substring re 1) (helm-basedir buf-fname))))
97c3c22 @thierryvolpiatto Fix matching from directory names in buffers (#903).
thierryvolpiatto authored
516 t)))
6613f82 @thierryvolpiatto Add new functions for matching buffers.
thierryvolpiatto authored
517
518 (defun helm-buffers-match-function (candidate)
519 "Default function to match buffers."
520 (and (helm-buffers--match-from-pat candidate)
521 (helm-buffers--match-from-mjm candidate)
522 (helm-buffers--match-from-inside candidate)
523 (helm-buffers--match-from-directory candidate)))
ce88e38 @thierryvolpiatto * helm-buffers.el (helm-c-buffer-match-major-mode): Issue #103 Match …
thierryvolpiatto authored
524
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
525
f50ac1f @thierryvolpiatto Add query replace on contents actions in *find-files (#832).
thierryvolpiatto authored
526 (defun helm-buffer-query-replace-1 (&optional regexp-flag buffers)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
527 "Query replace in marked buffers.
528 If REGEXP-FLAG is given use `query-replace-regexp'."
529 (let ((fn (if regexp-flag 'query-replace-regexp 'query-replace))
530 (prompt (if regexp-flag "Query replace regexp" "Query replace"))
f50ac1f @thierryvolpiatto Add query replace on contents actions in *find-files (#832).
thierryvolpiatto authored
531 (bufs (or buffers (helm-marked-candidates)))
63fc7ec @thierryvolpiatto * helm-buffers.el (helm-buffer-query-replace-1): Bind `helm--reading-…
thierryvolpiatto authored
532 (helm--reading-passwd-or-string t))
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
533 (cl-loop with replace = (query-replace-read-from prompt regexp-flag)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
534 with tostring = (unless (consp replace)
535 (query-replace-read-to
536 replace prompt regexp-flag))
537 for buf in bufs
538 do
539 (save-window-excursion
1b48c0c @thierryvolpiatto Allow switching to more than one buffer (#861).
thierryvolpiatto authored
540 (switch-to-buffer buf)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
541 (save-excursion
542 (let ((case-fold-search t))
543 (goto-char (point-min))
544 (if (consp replace)
545 (apply fn (list (car replace) (cdr replace)))
546 (apply fn (list replace tostring)))))))))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
547
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
548 (defun helm-buffer-query-replace-regexp (_candidate)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
549 (helm-buffer-query-replace-1 'regexp))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
550
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
551 (defun helm-buffer-query-replace (_candidate)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
552 (helm-buffer-query-replace-1))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
553
554 (defun helm-buffer-toggle-diff (candidate)
555 "Toggle diff buffer CANDIDATE with it's file."
bfa270b @thierryvolpiatto * helm-buffers.el (helm-buffer-toggle-diff): Don't use special display.
thierryvolpiatto authored
556 (let (helm-persistent-action-use-special-display)
557 (helm-aif (get-buffer-window "*Diff*")
558 (progn (kill-buffer "*Diff*")
559 (set-window-buffer it helm-current-buffer))
560 (diff-buffer-with-file (get-buffer candidate)))))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
561
562 (defun helm-buffer-diff-persistent ()
563 "Toggle diff buffer without quitting helm."
564 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
565 (with-helm-alive-p
566 (helm-attrset 'diff-action 'helm-buffer-toggle-diff)
567 (helm-execute-persistent-action 'diff-action)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
568
d4d611e @thierryvolpiatto * helm-buffers.el: Check if buffer is a buffer-file-name before savin…
thierryvolpiatto authored
569 (defun helm-revert-buffer (candidate)
570 (with-current-buffer candidate
8410003 @thierryvolpiatto * helm-buffers.el (helm-revert-buffer): Check if buffer file exists.
thierryvolpiatto authored
571 (helm-aif (buffer-file-name)
572 (and (file-exists-p it) (revert-buffer t t)))))
d4d611e @thierryvolpiatto * helm-buffers.el: Check if buffer is a buffer-file-name before savin…
thierryvolpiatto authored
573
574 (defun helm-revert-marked-buffers (_ignore)
575 (mapc 'helm-revert-buffer (helm-marked-candidates)))
576
65452ab @thierryvolpiatto * helm-buffers.el: Fix preselection in save and revert buffers.
thierryvolpiatto authored
577 (defun helm-buffer-revert-and-update (_candidate)
578 (let ((marked (helm-marked-candidates))
82ecb4a @thierryvolpiatto * helm-buffers.el (helm-buffer-revert-and-update): Fix preselection.
thierryvolpiatto authored
579 (preselect (helm-buffers--quote-truncated-buffer
580 (helm-get-selection))))
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
581 (cl-loop for buf in marked do (helm-revert-buffer buf))
2087a99 @thierryvolpiatto * helm-buffers.el (helm-buffer-save-and-update): Fix precedent change…
thierryvolpiatto authored
582 (when (> (length marked) 1) (helm-unmark-all))
82ecb4a @thierryvolpiatto * helm-buffers.el (helm-buffer-revert-and-update): Fix preselection.
thierryvolpiatto authored
583 (helm-force-update preselect)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
584
585 (defun helm-buffer-revert-persistent ()
586 "Revert buffer without quitting helm."
587 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
588 (with-helm-alive-p
589 (helm-attrset 'revert-action '(helm-buffer-revert-and-update . never-split))
590 (helm-execute-persistent-action 'revert-action)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
591
65452ab @thierryvolpiatto * helm-buffers.el: Fix preselection in save and revert buffers.
thierryvolpiatto authored
592 (defun helm-buffer-save-and-update (_candidate)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
593 (let ((marked (helm-marked-candidates))
65452ab @thierryvolpiatto * helm-buffers.el: Fix preselection in save and revert buffers.
thierryvolpiatto authored
594 (preselect (helm-get-selection nil t))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
595 (enable-recursive-minibuffers t))
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
596 (cl-loop for buf in marked do
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
597 (with-current-buffer (get-buffer buf)
598 (when (buffer-file-name) (save-buffer))))
2087a99 @thierryvolpiatto * helm-buffers.el (helm-buffer-save-and-update): Fix precedent change…
thierryvolpiatto authored
599 (when (> (length marked) 1) (helm-unmark-all))
65452ab @thierryvolpiatto * helm-buffers.el: Fix preselection in save and revert buffers.
thierryvolpiatto authored
600 (helm-force-update (regexp-quote preselect))))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
601
602 (defun helm-buffer-save-persistent ()
603 "Save buffer without quitting helm."
604 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
605 (with-helm-alive-p
606 (helm-attrset 'save-action '(helm-buffer-save-and-update . never-split))
607 (helm-execute-persistent-action 'save-action)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
608
b822fcf @thierryvolpiatto * helm-buffers.el (helm-buffer-run-kill-persistent): New command.
thierryvolpiatto authored
609 (defun helm-buffer-run-kill-persistent ()
610 "Kill buffer without quitting helm."
611 (interactive)
612 (with-helm-alive-p
613 (helm-attrset 'kill-action '(helm-buffers-persistent-kill . never-split))
614 (helm-execute-persistent-action 'kill-action)))
615
d4d611e @thierryvolpiatto * helm-buffers.el: Check if buffer is a buffer-file-name before savin…
thierryvolpiatto authored
616 (defun helm-kill-marked-buffers (_ignore)
f146eb9 @thierryvolpiatto Fix some bugs happening after resuming.
thierryvolpiatto authored
617 (mapc 'kill-buffer (helm-marked-candidates))
618 (with-helm-buffer
619 (setq helm-marked-candidates nil
620 helm-visible-mark-overlays nil)))
d4d611e @thierryvolpiatto * helm-buffers.el: Check if buffer is a buffer-file-name before savin…
thierryvolpiatto authored
621
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
622 (defun helm-buffer-run-kill-buffers ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
623 "Run kill buffer action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
624 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
625 (with-helm-alive-p
626 (helm-quit-and-execute-action 'helm-kill-marked-buffers)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
627
628 (defun helm-buffer-run-grep ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
629 "Run Grep action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
630 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
631 (with-helm-alive-p
632 (helm-quit-and-execute-action 'helm-grep-buffers)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
633
634 (defun helm-buffer-run-zgrep ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
635 "Run Grep action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
636 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
637 (with-helm-alive-p
638 (helm-quit-and-execute-action 'helm-zgrep-buffers)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
639
640 (defun helm-buffer-run-query-replace-regexp ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
641 "Run Query replace regexp action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
642 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
643 (with-helm-alive-p
644 (helm-quit-and-execute-action 'helm-buffer-query-replace-regexp)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
645
646 (defun helm-buffer-run-query-replace ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
647 "Run Query replace action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
648 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
649 (with-helm-alive-p
650 (helm-quit-and-execute-action 'helm-buffer-query-replace)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
651
652 (defun helm-buffer-switch-other-window ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
653 "Run switch to other window action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
654 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
655 (with-helm-alive-p
1b48c0c @thierryvolpiatto Allow switching to more than one buffer (#861).
thierryvolpiatto authored
656 (helm-quit-and-execute-action 'helm-switch-to-buffers-other-window)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
657
658 (defun helm-buffer-switch-other-frame ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
659 "Run switch to other frame action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
660 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
661 (with-helm-alive-p
662 (helm-quit-and-execute-action 'switch-to-buffer-other-frame)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
663
664 (defun helm-buffer-switch-to-elscreen ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
665 "Run switch to elscreen action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
666 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
667 (with-helm-alive-p
668 (helm-quit-and-execute-action 'helm-find-buffer-on-elscreen)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
669
670 (defun helm-buffer-run-ediff ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
671 "Run ediff action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
672 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
673 (with-helm-alive-p
674 (helm-quit-and-execute-action 'helm-ediff-marked-buffers)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
675
676 (defun helm-buffer-run-ediff-merge ()
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
677 "Run ediff action from `helm-source-buffers-list'."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
678 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
679 (with-helm-alive-p
680 (helm-quit-and-execute-action 'helm-ediff-marked-buffers-merge)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
681
67513db @thierryvolpiatto Allow killing persistently more than one buffer.
thierryvolpiatto authored
682 (defun helm-buffers-persistent-kill-1 (buffer)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
683 "Persistent action to kill buffer."
684 (with-current-buffer (get-buffer buffer)
685 (if (and (buffer-modified-p)
686 (buffer-file-name (current-buffer)))
687 (progn
688 (save-buffer)
689 (kill-buffer buffer))
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
690 (kill-buffer buffer)))
e3a4109 @thierryvolpiatto Fix error when deleting last candidate of a source.
thierryvolpiatto authored
691 (helm-delete-current-selection)
c04c7db @thierryvolpiatto * helm-buffers.el (helm-buffers-persistent-kill): Delay updating in t…
thierryvolpiatto authored
692 (with-helm-temp-hook 'helm-after-persistent-action-hook
775cbe5 @thierryvolpiatto * helm-buffers.el (helm-buffers-persistent-kill): Fix preselection.
thierryvolpiatto authored
693 (helm-force-update (regexp-quote (helm-get-selection nil t)))))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
694
e3d52cb @thierryvolpiatto Fix error related to buffer-names introduced by (#934).
thierryvolpiatto authored
695 (defun helm-buffers--quote-truncated-buffer (buffer)
14ea21d @thierryvolpiatto Ensure buffer-name is called on a buffer when killing buffer.
thierryvolpiatto authored
696 (let ((bufname (and (bufferp buffer)
697 (buffer-name buffer))))
698 (when bufname
699 (regexp-quote
700 (if helm-buffer-max-length
701 (helm-substring-by-width
702 bufname helm-buffer-max-length
703 "")
704 bufname)))))
f9dc5ff @thierryvolpiatto Fix preselection of truncated buffers when killing.
thierryvolpiatto authored
705
67513db @thierryvolpiatto Allow killing persistently more than one buffer.
thierryvolpiatto authored
706 (defun helm-buffers-persistent-kill (_buffer)
707 (let ((marked (helm-marked-candidates)))
708 (unwind-protect
709 (cl-loop for b in marked
f9dc5ff @thierryvolpiatto Fix preselection of truncated buffers when killing.
thierryvolpiatto authored
710 do (progn (helm-preselect
711 (format "^%s"
712 (helm-buffers--quote-truncated-buffer b)))
67513db @thierryvolpiatto Allow killing persistently more than one buffer.
thierryvolpiatto authored
713 (when (y-or-n-p (format "kill buffer (%s)? " b))
8f46336 @thierryvolpiatto Fix preselection when killing buffers persistently.
thierryvolpiatto authored
714 (helm-buffers-persistent-kill-1 b))
715 (message nil)))
67513db @thierryvolpiatto Allow killing persistently more than one buffer.
thierryvolpiatto authored
716 (with-helm-buffer
717 (setq helm-marked-candidates nil
8f46336 @thierryvolpiatto Fix preselection when killing buffers persistently.
thierryvolpiatto authored
718 helm-visible-mark-overlays nil))
f9dc5ff @thierryvolpiatto Fix preselection of truncated buffers when killing.
thierryvolpiatto authored
719 (helm-force-update (helm-buffers--quote-truncated-buffer
720 (helm-get-selection))))))
67513db @thierryvolpiatto Allow killing persistently more than one buffer.
thierryvolpiatto authored
721
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
722 (defun helm-buffers-list-persistent-action (candidate)
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
723 (if current-prefix-arg
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
724 (helm-buffers-persistent-kill candidate)
1b48c0c @thierryvolpiatto Allow switching to more than one buffer (#861).
thierryvolpiatto authored
725 (switch-to-buffer candidate)))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
726
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
727 (defun helm-ediff-marked-buffers (_candidate &optional merge)
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
728 "Ediff 2 marked buffers or CANDIDATE and `helm-current-buffer'.
729 With optional arg MERGE call `ediff-merge-buffers'."
730 (let ((lg-lst (length (helm-marked-candidates)))
731 buf1 buf2)
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
732 (cl-case lg-lst
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
733 (0
734 (error "Error:You have to mark at least 1 buffer"))
735 (1
736 (setq buf1 helm-current-buffer
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
737 buf2 (cl-first (helm-marked-candidates))))
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
738 (2
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
739 (setq buf1 (cl-first (helm-marked-candidates))
740 buf2 (cl-second (helm-marked-candidates))))
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
741 (t
742 (error "Error:To much buffers marked!")))
743 (if merge
744 (ediff-merge-buffers buf1 buf2)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
745 (ediff-buffers buf1 buf2))))
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
746
747 (defun helm-ediff-marked-buffers-merge (candidate)
748 "Ediff merge `helm-current-buffer' with CANDIDATE.
749 See `helm-ediff-marked-buffers'."
750 (helm-ediff-marked-buffers candidate t))
751
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
752 (defun helm-multi-occur-as-action (_candidate)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
753 "Multi occur action for `helm-source-buffers-list'.
39c674b @thierryvolpiatto * helm-buffers.el (helm-multi-occur-as-action): Issue #103 Use @ inpu…
thierryvolpiatto authored
754 Can be used by any source that list buffers."
3211573 @thierryvolpiatto * helm-buffers.el (helm-multi-occur-as-action): Force searching in cu…
thierryvolpiatto authored
755 (let ((helm-moccur-always-search-in-current
4eb4b2b @thierryvolpiatto Fix toggling value of `helm-moccur-always-search-in-current'.
thierryvolpiatto authored
756 (if helm-current-prefix-arg
757 (not helm-moccur-always-search-in-current)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
758 helm-moccur-always-search-in-current))
3211573 @thierryvolpiatto * helm-buffers.el (helm-multi-occur-as-action): Force searching in cu…
thierryvolpiatto authored
759 (buffers (helm-marked-candidates))
b82caa8 @thierryvolpiatto replace all cl symbol by their cl-lib equivalent.
thierryvolpiatto authored
760 (input (cl-loop for i in (split-string helm-pattern " " t)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
761 thereis (and (string-match "\\`@\\(.*\\)" i)
762 (match-string 1 i)))))
39c674b @thierryvolpiatto * helm-buffers.el (helm-multi-occur-as-action): Issue #103 Use @ inpu…
thierryvolpiatto authored
763 (helm-multi-occur-1 buffers input)))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
764
765 (defun helm-buffers-run-multi-occur ()
39c674b @thierryvolpiatto * helm-buffers.el (helm-multi-occur-as-action): Issue #103 Use @ inpu…
thierryvolpiatto authored
766 "Run `helm-multi-occur-as-action' by key."
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
767 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
768 (with-helm-alive-p
769 (helm-quit-and-execute-action 'helm-multi-occur-as-action)))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
770
467a44a @thierryvolpiatto * helm-buffers.el (helm-buffers-toggle-show-hidden-buffers): New, all…
thierryvolpiatto authored
771 (defun helm-buffers-toggle-show-hidden-buffers ()
772 (interactive)
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
773 (with-helm-alive-p
774 (let ((filter-attrs (helm-attr 'filtered-candidate-transformer
775 helm-source-buffers-list)))
776 (if (memq 'helm-shadow-boring-buffers filter-attrs)
777 (helm-attrset 'filtered-candidate-transformer
778 (cons 'helm-skip-boring-buffers
779 (remove 'helm-shadow-boring-buffers
780 filter-attrs))
781 helm-source-buffers-list t)
bc4fb13 @thierryvolpiatto Finally reindent with the cl indentation behavior of 24.4.50.
thierryvolpiatto authored
782 (helm-attrset 'filtered-candidate-transformer
783 (cons 'helm-shadow-boring-buffers
784 (remove 'helm-skip-boring-buffers
785 filter-attrs))
786 helm-source-buffers-list t))
586425f @thierryvolpiatto Use with-helm-alive-p in many places and remove autoload cookies wher…
thierryvolpiatto authored
787 (helm-force-update))))
467a44a @thierryvolpiatto * helm-buffers.el (helm-buffers-toggle-show-hidden-buffers): New, all…
thierryvolpiatto authored
788
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
789
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
790 ;;; Candidate Transformers
791 ;;
792 ;;
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
793 (defun helm-skip-boring-buffers (buffers _source)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
794 (helm-skip-entries buffers helm-boring-buffer-regexp-list))
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
795
9b50655 @thierryvolpiatto Keep fixing unused args
thierryvolpiatto authored
796 (defun helm-shadow-boring-buffers (buffers _source)
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
797 "Buffers matching `helm-boring-buffer-regexp' will be
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
798 displayed with the `file-name-shadow' face if available."
4166d8a @thierryvolpiatto Replace "helm-c-" prefix by "helm-" in all files.
thierryvolpiatto authored
799 (helm-shadow-entries buffers helm-boring-buffer-regexp-list))
66550b2 @thierryvolpiatto * helm-buffers.el: require cl, helm, helm-vars, helm-utils.
thierryvolpiatto authored
800
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
801
7974fc5 @thierryvolpiatto Create autoload system in helm-config.
thierryvolpiatto authored
802 (define-helm-type-attribute 'buffer
d494070 Update labels for helm-buffers actions
Tu Do authored
803 `((action
804 . ,(helm-make-actions
1b48c0c @thierryvolpiatto Allow switching to more than one buffer (#861).
thierryvolpiatto authored
805 "Switch to buffer" 'switch-to-buffer
d494070 Update labels for helm-buffers actions
Tu Do authored
806 (lambda () (and (locate-library "popwin") "Switch to buffer in popup window"))
807 'popwin:popup-buffer
808 "Switch to buffer other window `C-c o'" 'switch-to-buffer-other-window
809 "Switch to buffer other frame `C-c C-o'" 'switch-to-buffer-other-frame
810 (lambda () (and (locate-library "elscreen") "Display buffer in Elscreen"))
811 'helm-find-buffer-on-elscreen
812 "Query replace regexp `C-M-%'" 'helm-buffer-query-replace-regexp
813 "Query replace `M-%'" 'helm-buffer-query-replace
814 "View buffer" 'view-buffer
815 "Display buffer" 'display-buffer
816 "Grep buffers `M-g s' (C-u grep all buffers)" 'helm-zgrep-buffers
817 "Multi occur buffer(s) `C-s'" 'helm-multi-occur-as-action
818 "Revert buffer(s) `M-U'" 'helm-revert-marked-buffers
819 "Insert buffer" 'insert-buffer
820 "Kill buffer(s) `M-D'" 'helm-kill-marked-buffers
821 "Diff with file" 'diff-buffer-with-file
822 "Ediff Marked buffers `C-c ='" 'helm-ediff-marked-buffers
823 "Ediff Merge marked buffers `M-='" (lambda (candidate)
824 (helm-ediff-marked-buffers candidate t))))
825 (persistent-help . "Show this buffer")
826 (filtered-candidate-transformer helm-skip-boring-buffers
827 helm-buffers-sort-transformer
828 helm-highlight-buffers))
7974fc5 @thierryvolpiatto Create autoload system in helm-config.
thierryvolpiatto authored
829 "Buffer or buffer name.")
2bd2c6f @thierryvolpiatto * helm-buffers.el: Allow toggling details in buffer list with C-].
thierryvolpiatto authored
830
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
831 ;;;###autoload
832 (defun helm-buffers-list ()
d8fb115 @thierryvolpiatto * helm-buffers.el (helm-buffers-list): Fix docstring.
thierryvolpiatto authored
833 "Preconfigured `helm' to list buffers."
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
834 (interactive)
1bb02a1 @thierryvolpiatto Define `helm-source-buffers-list' at run time.
thierryvolpiatto authored
835 (unless helm-source-buffers-list
836 (setq helm-source-buffers-list
837 (helm-make-source "Buffers" 'helm-source-buffers)))
625fde9 @thierryvolpiatto * helm-buffers.el (helm-buffers-list): Remove now unuseful code.
thierryvolpiatto authored
838 (helm :sources '(helm-source-buffers-list
839 helm-source-ido-virtual-buffers
840 helm-source-buffer-not-found)
841 :buffer "*helm buffers*"
842 :keymap helm-buffer-map
843 :truncate-lines t))
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
844
845 (provide 'helm-buffers)
846
37b4201 @thierryvolpiatto Fix dependencies and autoloads. Reorder.
thierryvolpiatto authored
847 ;; Local Variables:
a7ee65b @thierryvolpiatto Disable compile warnings and add new keyword to helm.
thierryvolpiatto authored
848 ;; byte-compile-warnings: (not cl-functions obsolete)
37b4201 @thierryvolpiatto Fix dependencies and autoloads. Reorder.
thierryvolpiatto authored
849 ;; coding: utf-8
850 ;; indent-tabs-mode: nil
851 ;; End:
852
9385bbf @thierryvolpiatto * helm-config.el Move buffers code to helm-buffers.el
thierryvolpiatto authored
853 ;;; helm-buffers.el ends here
Something went wrong with that request. Please try again.