From b1abd94d0d369d83b38a86a8148e55c954d00e65 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sat, 26 Nov 2016 01:47:23 -0800 Subject: [PATCH] [Emacs] Add copy last message to copy hydra --- dotfiles/emacs.d/README.org | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 40ef3137..890e1b28 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -804,6 +804,23 @@ A macro for composing functions together to build an interactive command to copy (imalison:compose-copy-builder imalison:copy-current-buffer-name buffer-name) #+END_SRC +*** Copy the last message +#+BEGIN_SRC emacs-lisp +(defun imalison:last-message (&optional num) + (or num (setq num 1)) + (if (= num 0) + (current-message) + (save-excursion + (set-buffer "*Messages*") + (save-excursion + (forward-line (- 1 num)) + (backward-char) + (let ((end (point))) + (forward-line 0) + (buffer-substring-no-properties (point) end)))))) + +(imalison:compose-copy-builder imalison:copy-last-message imalison:last-message) +#+END_SRC ** Named Compile #+BEGIN_SRC emacs-lisp (defun imalison:named-compile (command) @@ -1638,7 +1655,8 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details ("l" imalison:copy-current-buffer-name "Buffer Name") ("f" imalison:copy-buffer-file-path-full "Full path") ("n" imalison:copy-buffer-file-name "File name") - ("b" imalison:copy-current-git-branch "Git Branch")) + ("b" imalison:copy-current-git-branch "Git Branch") + ("m" imalison:copy-last-message "Last Message")) #+END_SRC *** Compile #+BEGIN_SRC emacs-lisp