Add doom/copy-buffer-contents command
To make it easier for beginners to copy content from logs or backtrace windows.
This commit is contained in:
parent
0446c2a853
commit
611fdade09
1 changed files with 15 additions and 0 deletions
|
@ -450,6 +450,21 @@ will be automatically appended to the result."
|
||||||
(interactive)
|
(interactive)
|
||||||
(browse-url "https://github.com/hlissner/doom-emacs/issues/new/choose"))
|
(browse-url "https://github.com/hlissner/doom-emacs/issues/new/choose"))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom/copy-buffer-contents (buffer-name)
|
||||||
|
"Copy the contents of BUFFER-NAME to your clipboard."
|
||||||
|
(interactive
|
||||||
|
(list (if current-prefix-arg
|
||||||
|
(completing-read "Select buffer: " (mapcar #'buffer-name (buffer-list)))
|
||||||
|
(buffer-name (current-buffer)))))
|
||||||
|
(let ((buffer (get-buffer buffer-name)))
|
||||||
|
(unless (buffer-live-p buffer)
|
||||||
|
(user-error "Buffer isn't live"))
|
||||||
|
(kill-new
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(substring-no-properties (buffer-string))))
|
||||||
|
(message "Contents of %S were copied to the clipboard" buffer-name)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Profiling
|
;;; Profiling
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue