]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-rmail.el
Sync Org 7.9.2 from the commit tagged "release_7.9.2" in Org's Git repo.
[gnu-emacs] / lisp / org / org-rmail.el
index 3146ff32758d36f00632d11719a3a0277e983766..4be7bcbb5f6a728948a21daaec139df79ea3a757 100644 (file)
 (require 'org)
 
 ;; Declare external functions and variables
-(declare-function rmail-show-message "rmail" (&optional n no-summary))
-(declare-function rmail-what-message "rmail" ())
-(defvar rmail-current-message)
+(declare-function rmail-show-message  "rmail" (&optional n no-summary))
+(declare-function rmail-what-message  "rmail" (&optional pos))
+(declare-function rmail-toggle-header "rmail" (&optional arg))
+(declare-function rmail-widen         "rmail" ())
+(defvar rmail-current-message)  ; From rmail.el
+(defvar rmail-header-style)     ; From rmail.el
 
 ;; Install the link type
 (org-add-link-type "rmail" 'org-rmail-open)
@@ -52,6 +55,8 @@
          (rmail-show-message rmail-current-message))
        (when (fboundp 'rmail-narrow-to-non-pruned-header)
          (rmail-narrow-to-non-pruned-header))
+       (when (eq rmail-header-style 'normal)
+         (rmail-toggle-header -1))
        (let* ((folder buffer-file-name)
               (message-id (mail-fetch-field "message-id"))
               (from (mail-fetch-field "from"))
@@ -73,7 +78,7 @@
                                :date-timestamp-inactive date-ts-ia))
          (setq message-id (org-remove-angle-brackets message-id))
          (setq desc (org-email-link-description))
-         (setq link (org-make-link "rmail:" folder "#" message-id))
+         (setq link (concat "rmail:" folder "#" message-id))
          (org-add-link-props :link link :description desc)
          (rmail-show-message rmail-current-message)
          link)))))
        (rmail (if (string= folder "RMAIL") rmail-file-name folder))
        (setq message-number
              (save-restriction
-               (widen)
+               (rmail-widen)
                (goto-char (point-max))
                (if (re-search-backward
                     (concat "^Message-ID:\\s-+" (regexp-quote