[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function |
Date: |
Fri, 27 Nov 2020 23:15:23 -0500 (EST) |
branch: externals/gnorb
commit a79cf72bfee01b8b7802f4f86acb42255cea3c9c
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Unwrap "if" from around function
lisp/gnorb-gnus.el: (gnorb-gnus-incoming-do-todo) If we're raising an
error, there's no need to wrap the whole function in
the if clause
---
lisp/gnorb-gnus.el | 96 +++++++++++++++++++++++++++---------------------------
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index b730862..8d76b5a 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -406,55 +406,55 @@ prefix argument), or to 'prompt to always be prompted.
In some cases, Gnorb can guess for you which Org heading you
probably want to trigger, which can save some time. It does this
-by looking in the References and In-Reply-To headers, and seeing
-if any of the IDs there match the value of the
-`gnorb-org-msg-id-key' property for any headings. In order for
-this to work, you will have to have loaded org-id, and have the
-variable `org-id-track-globally' set to t."
+by looking in the References header, and seeing if any of the IDs
+there match the value of the `gnorb-org-msg-id-key' property for
+any headings. In order for this to work, you will have to have
+loaded org-id, and have the variable `org-id-track-globally' set
+to t (it is, by default)."
(interactive "P")
- (if (not (memq major-mode '(gnus-summary-mode gnus-article-mode)))
- (error "Only works in gnus summary or article mode")
- ;; We should only store a link if it's not already at the head of
- ;; `org-stored-links'. There's some duplicate storage, at
- ;; present. Take a look at calling it non-interactively.
- (call-interactively 'org-store-link)
- (let* ((org-refile-targets gnorb-gnus-trigger-refile-targets)
- (ref-msg-ids
- (with-current-buffer gnus-original-article-buffer
- (message-narrow-to-headers-or-head)
- (let ((all-refs
- (message-fetch-field "references")))
- (when all-refs
- (split-string all-refs)))))
- (offer-heading
- (when (and (not id) ref-msg-ids)
- (if org-id-track-globally
- ;; for now we're basically ignoring the fact that
- ;; multiple candidates could exist; just do the first
- ;; one.
- (car (gnorb-org-find-visit-candidates
- ref-msg-ids))
- (message "Gnorb can't check for relevant headings unless
`org-id-track-globally' is t")
- (sit-for 1))))
- targ)
- (gnorb-gnus-collect-all-attachments)
- (if id
- (gnorb-trigger-todo-action arg id)
- (if (and offer-heading
- (y-or-n-p (format "Trigger action on %s"
- (org-format-outline-path (cadr
offer-heading)))))
- (gnorb-trigger-todo-action arg (car offer-heading))
- (setq targ (org-refile-get-location
- "Trigger heading" nil t))
- (find-file (nth 1 targ))
- (goto-char (nth 3 targ))
- (gnorb-trigger-todo-action arg)))
- ;; will this ever actually get called?
- (setq gnorb-gnus-capture-attachments nil)
- (message
- "Insert a link to the message with org-insert-link (%s)"
- (mapconcat 'key-description
- (where-is-internal 'org-insert-link) ", ")))))
+ (when (not (memq major-mode '(gnus-summary-mode gnus-article-mode)))
+ (user-error "Only works in gnus summary or article mode"))
+ ;; We should only store a link if it's not already at the head of
+ ;; `org-stored-links'. There's some duplicate storage, at
+ ;; present. Take a look at calling it non-interactively.
+ (call-interactively 'org-store-link)
+ (setq gnorb-org-window-conf (current-window-configuration))
+ (let* ((org-refile-targets gnorb-gnus-trigger-refile-targets)
+ (ref-msg-ids
+ (with-current-buffer gnus-original-article-buffer
+ (message-narrow-to-headers-or-head)
+ (let ((all-refs
+ (message-fetch-field "references")))
+ (when all-refs
+ (split-string all-refs)))))
+ (offer-heading
+ (when (and (not id) ref-msg-ids)
+ (if org-id-track-globally
+ ;; for now we're basically ignoring the fact that
+ ;; multiple candidates could exist; just do the first
+ ;; one.
+ (car (gnorb-org-find-visit-candidates
+ ref-msg-ids))
+ (message "Gnorb can't check for relevant headings unless
`org-id-track-globally' is t")
+ (sit-for 1))))
+ targ)
+ (gnorb-gnus-collect-all-attachments nil t)
+ (if id
+ (gnorb-trigger-todo-action arg id)
+ (if (and offer-heading
+ (y-or-n-p (format "Trigger action on %s"
+ (org-format-outline-path (cadr
offer-heading)))))
+ (gnorb-trigger-todo-action arg (car offer-heading))
+ (setq targ (org-refile-get-location
+ "Trigger heading" nil t))
+ (find-file (nth 1 targ))
+ (goto-char (nth 3 targ))
+ (gnorb-trigger-todo-action arg)))
+ (setq gnorb-gnus-capture-attachments nil)
+ (message
+ "Insert a link to the message with org-insert-link (%s)"
+ (mapconcat 'key-description
+ (where-is-internal 'org-insert-link nil t) ", "))))
(defun gnorb-gnus-search-messages (str &optional ret)
"Initiate a search for gnus message links in an org subtree.
- [elpa] externals/gnorb 6375f83 112/449: And append doesn't modify destructively..., (continued)
- [elpa] externals/gnorb 6375f83 112/449: And append doesn't modify destructively..., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f7b93f2 115/449: Whitespace/indentation cleanup, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e86d24a 119/449: Robustification of nngnorb nnir message viewing, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e089d66 129/449: Documenting recent additions in the README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3a512 244/449: Releasing version 1, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4b8a6da 255/449: New function for removing message/heading association, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb aaf8556 261/449: Be a good citizen about the cl package, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3182e 263/449: Shift location of org-reveal during trigger process, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6246244 106/449: Hinting for potentially-relevant incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function,
Stefan Monnier <=
- [elpa] externals/gnorb 0255247 133/449: Only notice records on message receipt, not sending, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b70d845 168/449: Handle nil group values in registry entries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 880afd6 158/449: Register sent messages so we can view them later, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 25aa0f1 173/449: Use a marker in conjunction with window conf, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e1129e9 170/449: Fix problems when BBDB is not present and gnorb-bbdb is not loaded., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5f96b98 167/449: Stupid typo, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9a2f747 175/449: Don't hint messages in nnir or virtual summaries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ec44a6d 182/449: Continue shifting candidate finding to the registry, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 927e401 184/449: New function for restoring window layout, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a352586 189/449: Improve lookups for entries with unknown groups, Stefan Monnier, 2020/11/27