X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/7be1c708c5abc7dea388d45454bd19bff07b7943..6ccc848cd85e75d77d6b11a46f5f23f860db9ff5:/lisp/org/org-rmail.el?ds=sidebyside diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index cbb6336598..4be7bcbb5f 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -1,12 +1,10 @@ ;;; org-rmail.el --- Support for links to Rmail messages from within Org-mode -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2012 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -35,9 +33,12 @@ (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) @@ -54,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")) @@ -75,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))))) @@ -99,7 +102,7 @@ (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 @@ -115,6 +118,4 @@ (provide 'org-rmail) -;; arch-tag: c6cf4a8b-6639-4b7f-821f-bdf10746b173 - ;;; org-rmail.el ends here