summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-12-29 19:15:32 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-12-29 19:18:35 +0100
commitec6a536af0237b818dc43b01d5e38193e8078fb1 (patch)
tree110cc8c9a807e29502594ce164738780bc78cd2e
parent438f3c40c05f64d105879af5480af5801ab51a2e (diff)
downloaddotfiles-ec6a536af0237b818dc43b01d5e38193e8078fb1.tar.xz
Make killing commands more verbose
Also add helper to copy Message-Id from Gnus summary.
-rw-r--r--.emacs33
1 files changed, 18 insertions, 15 deletions
diff --git a/.emacs b/.emacs
index b21a3f7..7fb5d68 100644
--- 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.