;;; Code:
+(require 'gnus)
(eval-and-compile
(require 'nnheader)
(require 'nnir))
(setq m (org-link-unescape m))
(when (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" m)
(setq server-group (match-string 1 m)
- msg-id (match-string 3 m)
+ msg-id (gnorb-bracket-message-id
+ (match-string 3 m))
result (ignore-errors (gnus-request-head msg-id server-group)))
(when result
(setq artno (cdr result))
connection between the message and whichever Org TODO resulted in
the message being included in this search."
(interactive)
+ (unless (get-buffer-window gnus-article-buffer t)
+ (gnus-summary-display-article
+ (gnus-summary-article-number)))
(let* ((msg-id (gnus-fetch-original-field "message-id"))
(org-ids (gnus-registry-get-id-key msg-id 'gnorb-ids))
chosen)
- (when org-ids
- (if (= (length org-ids) 1)
- ;; Only one associated Org TODO.
- (progn (gnus-registry-set-id-key msg-id 'gnorb-ids)
- (setq chosen (car org-ids)))
- ;; Multiple associated TODOs, prompt to choose one.
- (setq chosen
- (cdr
- (org-completing-read
- "Choose a TODO to disassociate from: "
- (mapcar
- (lambda (h)
- (cons (gnorb-pretty-outline h) h))
- org-ids))))
- (gnus-registry-set-id-key msg-id 'gnorb-ids
- (remove chosen org-ids)))
- (message "Message disassociated from %s"
- (gnorb-pretty-outline chosen)))))
+ (if org-ids
+ (progn
+ (if (= (length org-ids) 1)
+ ;; Only one associated Org TODO.
+ (progn (gnus-registry-set-id-key msg-id 'gnorb-ids nil)
+ (setq chosen (car org-ids)))
+ ;; Multiple associated TODOs, prompt to choose one.
+ (setq chosen
+ (cdr
+ (org-completing-read
+ "Choose a TODO to disassociate from: "
+ (mapcar
+ (lambda (h)
+ (cons (gnorb-pretty-outline h) h))
+ org-ids))))
+ (gnus-registry-set-id-key msg-id 'gnorb-ids
+ (remove chosen org-ids)))
+ (message "Message disassociated from %s"
+ (gnorb-pretty-outline chosen)))
+ (message "Message has no associations"))))
(defvar nngnorb-status-string "")