General refactor of Doom core
- Code reduction and refactor across the board (cull unneeded minor advise, hooks and hacks or update them) - Revise outdated comments and docstrings - Reorganize core autoload libraries - Remove large file check (Emacs already has a built-in one, which we augment to be even more performant when it does kick in) - helpful.el can now be disabled completely through package!
This commit is contained in:
parent
687496167a
commit
d46bb287ae
11 changed files with 296 additions and 298 deletions
|
@ -163,6 +163,30 @@ OPACITY is an integer between 0 to 100, inclusive."
|
|||
100))))
|
||||
(set-frame-parameter nil 'alpha opacity))
|
||||
|
||||
(defvar-local doom--buffer-narrowed-origin nil)
|
||||
;;;###autoload
|
||||
(defun doom/clone-and-narrow-buffer (beg end &optional clone-p)
|
||||
"Restrict editing in this buffer to the current region, indirectly. With CLONE-P,
|
||||
clone the buffer and hard-narrow the selection. If mark isn't active, then widen
|
||||
the buffer (if narrowed).
|
||||
|
||||
Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
||||
(interactive "rP")
|
||||
(cond ((or (region-active-p)
|
||||
(and beg end))
|
||||
(deactivate-mark)
|
||||
(when clone-p
|
||||
(let ((old-buf (current-buffer)))
|
||||
(switch-to-buffer (clone-indirect-buffer nil nil))
|
||||
(setq doom--buffer-narrowed-origin old-buf)))
|
||||
(narrow-to-region beg end))
|
||||
(doom--buffer-narrowed-origin
|
||||
(kill-this-buffer)
|
||||
(switch-to-buffer doom--buffer-narrowed-origin)
|
||||
(setq doom--buffer-narrowed-origin nil))
|
||||
(t
|
||||
(widen))))
|
||||
|
||||
|
||||
;;
|
||||
;; Modes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue