Fix #139: no-region error in doom/scratch-buffer

This commit is contained in:
Henrik Lissner 2017-07-05 15:19:56 +02:00
parent bc10afb284
commit 1d961563c0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -225,15 +225,17 @@ for function signatures or notes. Run again to clear the header line."
content)))))
;;;###autoload
(defun doom/scratch-buffer (&optional beg end arg)
(defun doom/scratch-buffer (&optional arg)
"Opens the scratch buffer in a popup window.
If ARG (universal argument) is non-nil, open it in the current window instead of
a popup.
If a region is active, copy it into the scratch buffer."
(interactive "rP")
(let ((text (and beg end (buffer-substring beg end)))
(interactive "P")
(let ((text (and (region-active-p)
(buffer-substring-no-properties
(region-beginning) (region-end))))
(mode major-mode)
(derived-p (derived-mode-p 'prog-mode 'text-mode))
(old-project (doom-project-root))