mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Fix #139: no-region error in doom/scratch-buffer
This commit is contained in:
@ -225,15 +225,17 @@ for function signatures or notes. Run again to clear the header line."
|
|||||||
content)))))
|
content)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/scratch-buffer (&optional beg end arg)
|
(defun doom/scratch-buffer (&optional arg)
|
||||||
"Opens the scratch buffer in a popup window.
|
"Opens the scratch buffer in a popup window.
|
||||||
|
|
||||||
If ARG (universal argument) is non-nil, open it in the current window instead of
|
If ARG (universal argument) is non-nil, open it in the current window instead of
|
||||||
a popup.
|
a popup.
|
||||||
|
|
||||||
If a region is active, copy it into the scratch buffer."
|
If a region is active, copy it into the scratch buffer."
|
||||||
(interactive "rP")
|
(interactive "P")
|
||||||
(let ((text (and beg end (buffer-substring beg end)))
|
(let ((text (and (region-active-p)
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(region-beginning) (region-end))))
|
||||||
(mode major-mode)
|
(mode major-mode)
|
||||||
(derived-p (derived-mode-p 'prog-mode 'text-mode))
|
(derived-p (derived-mode-p 'prog-mode 'text-mode))
|
||||||
(old-project (doom-project-root))
|
(old-project (doom-project-root))
|
||||||
|
Reference in New Issue
Block a user