commit ec6a536af0237b818dc43b01d5e38193e8078fb1
parent 438f3c40c05f64d105879af5480af5801ab51a2e
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date: Tue, 29 Dec 2020 19:15:32 +0100
Make killing commands more verbose
Also add helper to copy Message-Id from Gnus summary.
Diffstat:
| M | .emacs | | | 33 | ++++++++++++++++++--------------- |
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/.emacs b/.emacs
@@ -96,9 +96,13 @@
(set-variable 'tab-width new-width)
(message "changed from %s to %s" old-width new-width)))
+(defun my/kill (stuff)
+ (kill-new stuff)
+ (message "Copied \"%s\"" stuff))
+
(defun my/kill-ring-filename ()
(interactive)
- (kill-new (or (buffer-file-name) default-directory)))
+ (my/kill (or (buffer-file-name) default-directory)))
(defun my/kill-ring-pipe-region (command)
(interactive (list (read-shell-command "Shell command on region: ")))
@@ -107,13 +111,13 @@
(insert input)
(call-process-region (point-min) (point-max) shell-file-name
t t nil shell-command-switch command)
- (kill-new (buffer-string)))))
+ (my/kill (buffer-string)))))
(defun my/kill-ring-shell (command)
(interactive (list (read-shell-command "Shell command: ")))
(with-temp-buffer
(call-process-shell-command command nil t)
- (kill-new (buffer-string))))
+ (my/kill (buffer-string))))
(defun my/make-project-wide (f)
"Make a function which will run F from the project's root directory."
@@ -271,18 +275,13 @@
(defun my/describe-revision (rev)
"Format a Git revision in a format suitable for changelogs."
(interactive
- (list
- (let* ((rev (my/revision-at-point))
- (prompt (format-prompt "Revision" rev)))
- (read-string prompt nil nil rev))))
- (let* ((rev-fmt "%cd \"%s\" (%h)")
- (desc
- (string-trim
- (shell-command-to-string
- (format "git show --no-patch --date=short --format='%s' %s"
- rev-fmt rev)))))
- (kill-new desc)
- (message desc)))
+ (list (let ((rev (my/revision-at-point)))
+ (read-string (format-prompt "Revision" rev)
+ nil nil rev))))
+ (my/kill (string-trim
+ (shell-command-to-string
+ (format "git show --no-patch --date=short --format='%s' %s"
+ "%cd \"%s\" (%h)" rev)))))
;; Major modes configuration
@@ -387,6 +386,10 @@
(my/unfroggify)
(my/froggify)))
+(defun my/message-id ()
+ (interactive)
+ (my/kill (mail-header-message-id (gnus-summary-article-header))))
+
;; Font stuff π€·π€¦. Emacs comes with sensible defaults (e.g. the
;; default fontset includes Symbola for various subgroups of the
;; "symbol" script), but no color font by default.