[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnorb 1024a81 037/449: New gnorb-org-capture-collect-li

From: Stefan Monnier
Subject: [elpa] externals/gnorb 1024a81 037/449: New gnorb-org-capture-collect-link-p option
Date: Fri, 27 Nov 2020 23:15:03 -0500 (EST)

branch: externals/gnorb
commit 1024a81fc49010cda68cb3f9b0c0fc24f8896ef7
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    New gnorb-org-capture-collect-link-p option
    gnorb-org.el: Set to t to make the capture process always store a link
    to the Gnus message or BBDB record under point.
 README.org        |  6 ++++++
 lisp/gnorb-org.el | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/README.org b/README.org
index f248abf..ca4e7ee 100644
--- a/README.org
+++ b/README.org
@@ -96,6 +96,12 @@ happen to want to email that content to someone.
 I need to think about merging these functions, or else making them
 more distinct.
+*** User Options
+**** gnorb-org-capture-collect-link-p
+When this is set to t, the capture process will always store a link to
+the Gnus message or BBDB record under point, even when the link isn't
+part of the capture template. It can then be added to the captured
+heading with org-insert-link, as usual.
 *** Suggested Keybindings
 #+BEGIN_SRC emacs-lisp
   (eval-after-load "gnorb-org"
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index df9825c..1ea2e04 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -243,5 +243,23 @@ default set of parameters."
      '("file" "files" "attach"))))
+(defcustom gnorb-org-capture-collect-link-p t
+  "Should the capture process store a link to the gnus message or
+  BBDB record under point, even if it's not part of the
+  template?"
+  :group 'gnorb-org)
+(defun gnorb-org-capture-collect-link ()
+  (when gnorb-org-capture-collect-link-p
+    (let ((buf (org-capture-get :original-buffer)))
+      (when buf
+       (with-current-buffer buf
+         (when (memq major-mode '(gnus-summary-mode
+                                  gnus-article-mode
+                                  bbdb-mode))
+           (call-interactively 'org-store-link)))))))
+(add-hook 'org-capture-mode-hook 'gnorb-org-capture-collect-link)
 (provide 'gnorb-org)
 ;;; gnorb-org.el ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]