From 1622ac38772868d101e48107591db8f4700627c4 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 5 Sep 2023 00:14:03 +1000 Subject: A few changes - add dedicate-windows-by-modes as window-configuration-change-hook, but it did not work well when used on gnus-summary-mode - copying gnus article regions also copies links, which are appended at the end of the copy as footnote - overload org-id-store-link so that capturing today's work could include the item priority - org should open a gnus link in other-window - fixing my-org-clean-up-entry so that it deletes trailing empty lines - added a silly utility function to clean a red energy bill pay link --- emacs/.emacs.d/lisp/my/my-gnus.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'emacs/.emacs.d/lisp/my/my-gnus.el') diff --git a/emacs/.emacs.d/lisp/my/my-gnus.el b/emacs/.emacs.d/lisp/my/my-gnus.el index aee03b5..1f7ff18 100644 --- a/emacs/.emacs.d/lisp/my/my-gnus.el +++ b/emacs/.emacs.d/lisp/my/my-gnus.el @@ -323,5 +323,37 @@ The archiving target comes from `my-gnus-group-alist'." (message "Displaying %s..." command)) 'external))))))) +(defun my-gnus-article-copy-region (beg end) + "Copy an gnus article region from beginning to end, links included." + (interactive "r") + (let ((pairs) + (copied (buffer-substring-no-properties beg end)) + (inhibit-message t)) + (save-excursion + (goto-char beg) + (when-let* ((button (button-at (point))) + (url (button-get button 'shr-url))) + (push (cons (buffer-substring-no-properties + (button-start button) + (button-end button)) + url) + pairs)) + (while (and (shr-next-link) + (<= (point) end)) + (let ((button (button-at (point)))) + (push (cons (buffer-substring-no-properties + (button-start button) + (button-end button)) + (button-get button 'shr-url)) + pairs))) + (pcase-dolist (`(,label . ,url) (reverse pairs)) + (setq copied + (concat copied + (format "[%s] %s\n" label url))))) + (kill-new copied) + (setq deactivate-mark t) + (let ((inhibit-message nil)) + (message "Copied region with %d links." (length pairs))))) + (provide 'my-gnus) ;;; my-gnus.el ends here -- cgit v1.2.3