-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy-buffer.el
97 lines (90 loc) · 3.7 KB
/
my-buffer.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
;;; my-buffer.el --- buffer navigation tweaks
;;
;;; Commentary:
;;
;; I now only use lusty-explorer for file loading. C-x b buffer
;; switching will be helm-mini.
;;
;;; Code:
(require 'use-package)
;; midnight mode, clean-up unused buffers overnight
(use-package midnight
:commands midnight-mode
:config (midnight-mode t))
;;
;; Lusty Explorer
;;
;; moved C-x b to helm-mini (see my-helm)
;; (global-set-key (kbd "C-x b") 'lusty-buffer-explorer)
(defun my-lusty-file-explorer()
"Wrapper to launch, temporarily defaulting completing read."
(interactive)
(let ((completing-read-function 'completing-read-default))
(lusty-file-explorer)))
(use-package lusty-explorer
:disabled t
:commands lusty-file-explorer
:bind (("C-x C-f" . my-lusty-file-explorer)))
;; ibuffer has been around for some time
(defun my-ibuffer-bs-show ()
"Emulate `bs-show' from the bs.el package."
(interactive)
(ibuffer nil "*Ibuffer-my-bs*" '((filename . ".*")) nil t)
(define-key (current-local-map) "a" 'ibuffer-bs-toggle-all))
(if (version<= "26.3" emacs-version)
(use-package bufler
:ensure t
:bind (("C-x C-b" . bufler))
:config (bufler-defgroups
(group
;; Subgroup collecting all `help-mode' and `info-mode' buffers.
(group-or "*Help/Info*"
(mode-match "*Help*" (rx bos "help-"))
(mode-match "*Info*" (rx bos "info-"))))
(group
;; Subgroup collecting all special buffers (i.e. ones that are not
;; file-backed), except `magit-status-mode' buffers (which are allowed to fall
;; through to other groups, so they end up grouped with their project buffers).
(group-and "*Special*"
(lambda (buffer)
(unless (or (funcall
(mode-match "Magit" (rx bos "magit-" (or "status" "log")))
buffer)
(funcall (mode-match "Dired" (rx bos "dired"))
buffer)
(funcall (auto-file) buffer))
"*Special*")))
(group
;; Subgroup collecting these "special special" buffers
;; separately for convenience.
(name-match "**Special**"
(rx bos "*" (or "Messages" "Warnings"
"scratch" "Backtrace")
"*"))))
(group
(group-or "IRC"
(mode-match "Channels" (rx "circe-channel-mode"))
(mode-match "DMs" (rx "circe-query-mode")))
(group
(auto-project))
(auto-directory)
(auto-mode))))
(use-package ibuffer
:commands ibuffer
:bind ("C-x C-b" . my-ibuffer-bs-show)
:config
(progn
(require 'ibuf-ext)
(setq ibuffer-saved-filters
(quote (("mysrc" ((filename . "~/mysrc/*")))
("tramp" ((filename . "\\/ssh:")))
("irc" ((mode . circe-mode)))
("magit" ((mode . magit-status-mode)))
("programming" ((or (mode . emacs-lisp-mode)
(mode . cperl-mode)
(mode . c-mode)
(mode . java-mode)
(mode . idl-mode)
(mode . lisp-mode))))))))))
(provide 'my-buffer)
;;; my-buffer.el ends here