refactor(lib): use doom-region-{beginning,end}
This commit is contained in:
parent
4be265ead7
commit
61327bf777
1 changed files with 6 additions and 12 deletions
|
@ -198,12 +198,9 @@ narrowing doesn't affect other windows displaying the same buffer. Call
|
|||
`doom/widen-indirectly-narrowed-buffer' to undo it (incrementally).
|
||||
|
||||
Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
||||
(interactive
|
||||
(list (or (bound-and-true-p evil-visual-beginning) (region-beginning))
|
||||
(or (bound-and-true-p evil-visual-end) (region-end))))
|
||||
(unless (region-active-p)
|
||||
(setq beg (line-beginning-position)
|
||||
end (line-end-position)))
|
||||
(interactive (if (region-active-p)
|
||||
(list (doom-region-beginning) (doom-region-end))
|
||||
(list (bol) (eol))))
|
||||
(deactivate-mark)
|
||||
(let ((orig-buffer (current-buffer)))
|
||||
(with-current-buffer (switch-to-buffer (clone-indirect-buffer nil nil))
|
||||
|
@ -242,12 +239,9 @@ If the current buffer is not an indirect buffer, it is `widen'ed."
|
|||
;;;###autoload
|
||||
(defun doom/toggle-narrow-buffer (beg end)
|
||||
"Narrow the buffer to BEG END. If narrowed, widen it."
|
||||
(interactive
|
||||
(list (or (bound-and-true-p evil-visual-beginning) (region-beginning))
|
||||
(or (bound-and-true-p evil-visual-end) (region-end))))
|
||||
(interactive (if (region-active-p)
|
||||
(list (doom-region-beginning) (doom-region-end))
|
||||
(list (bol) (eol))))
|
||||
(if (buffer-narrowed-p)
|
||||
(widen)
|
||||
(unless (region-active-p)
|
||||
(setq beg (line-beginning-position)
|
||||
end (line-end-position)))
|
||||
(narrow-to-region beg end)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue