Optimization: buffer-local-value instead of with-current-buffer
This commit is contained in:
parent
b46a75bfe0
commit
85f3c14b2f
3 changed files with 8 additions and 8 deletions
|
@ -38,7 +38,7 @@
|
|||
(:custom (lambda (b &rest _)
|
||||
(when (and (featurep 'repl-toggle)
|
||||
(string-prefix-p "*" (buffer-name (get-buffer b))))
|
||||
(with-current-buffer b repl-toggle-mode))))
|
||||
(buffer-local-value 'repl-toggle-mode b))))
|
||||
:popup t :align below :size 16 :select t)
|
||||
|
||||
(map! :map repl-toggle-mode-map
|
||||
|
|
|
@ -86,7 +86,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
|||
;;;###autoload
|
||||
(defun doom/get-buffers-in-modes (modes &optional buffer-list)
|
||||
"Get a list of buffers whose major-mode is one of MODES"
|
||||
(--filter (with-current-buffer it (memq major-mode modes))
|
||||
(--filter (memq (buffer-local-value 'major-mode it) modes)
|
||||
(or buffer-list (doom/get-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
|
||||
;;;###autoload
|
||||
(defun doom/popup-p (&optional window)
|
||||
"Whether WINDOW is a shackle popup window or not. If WINDOW is nil, use
|
||||
current window."
|
||||
(let ((window (or window (selected-window))))
|
||||
(and (window-live-p window)
|
||||
(with-selected-window window (bound-and-true-p doom-popup-mode))
|
||||
window)))
|
||||
"Whether WINDOW is a popup window or not. If WINDOW is nil, use current
|
||||
window. Returns nil or the popup window."
|
||||
(setq window (or window (selected-window)))
|
||||
(and (window-live-p window)
|
||||
(buffer-local-value 'doom-popup-mode (window-buffer window))
|
||||
window))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/popups-p ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue