From: Marten van Kerkwijk <mhvk@astro.utoronto.ca>
To: emacs-orgmode@gnu.org
Subject: Bug: org-rmail-follow-link gives message not found [7.8.11]
Date: Mon, 18 Jun 2012 14:05:12 -0400 [thread overview]
Message-ID: <y2jipeomr6v.fsf@swan.astro.utoronto.ca> (raw)
Dear org-mode maintainers,
I have been trying to include links to rmail folders in my .org file,
and found that following those would lead to "Message not found" unless
(1) the link was to the last message in the folder; and (2) I ensured
that Message-ID was not hidden (the latter also was necessary to be able
to copy links with C-cl).
Trying to understand org-rmail-follow-link in org-rmail.el, the
behaviour is consistent with the buffer not being widen'd, but I am not
sure why that didn't happen. I did find that the rewrite below
corrected the bug -- difference with original follows; it is partially a
reversion to an older version I found at
http://braeburn.aquamacs.org/code/master/lisp/org/org-rmail.el
Unfortunately, I understand what I'm doing far too poorly to be sure
this is the correct solution...
Thanks, all best regards,
Marten van Kerkwijk
(defun org-rmail-follow-link (folder article)
"Follow an Rmail link to FOLDER and ARTICLE."
(require 'rmail)
(setq article (org-add-angle-brackets article))
(let (message-number buff)
(save-excursion
(save-window-excursion
(rmail (if (string= folder "RMAIL") rmail-file-name folder))
(setq buff (current-buffer)
message-number
(with-current-buffer rmail-view-buffer
(save-restriction
(widen)
(goto-char (point-max))
(if (re-search-backward
(concat "^Message-ID:\\s-+" (regexp-quote
(or article "")))
nil t)
;; This is an rmail "debugging" function. :(
(with-current-buffer buff
(rmail-what-message))))))))
(if message-number
(progn
(rmail (if (string= folder "RMAIL") rmail-file-name folder))
(rmail-show-message message-number)
message-number)
(error "Message not found"))))
The difference with the original:
mhvk@swan:~/emacs$ diff -w org-rmail.el~ org-rmail.el
94c94
< (let (message-number)
---
> (let (message-number buff)
98c98,100
< (setq message-number
---
> (setq buff (current-buffer)
> message-number
> (with-current-buffer rmail-view-buffer
106c108,110
< (rmail-what-message))))))
---
> ;; This is an rmail "debugging" function. :(
> (with-current-buffer buff
> (rmail-what-message))))))))
Emacs : GNU Emacs 24.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
of 2012-06-15 on zelenka, modified by Debian
Package: Org-mode version 7.8.11
current state:
==============
(setq
org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code)
org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
org-babel-hide-result-toggle-maybe)
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-occur-hook '(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers)
org-confirm-shell-link-function 'yes-or-no-p
org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
org-beamer-auto-fragile-frames
org-beamer-place-default-actions-for-lists)
org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
org-default-notes-file "~/things_to_think_about/gtd.org"
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-mode-hook '(#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook org-show-block-all
append local]
5]
#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
5]
org-babel-result-hide-spec org-babel-hide-all-hashes
(lambda nil (define-key org-mode-map [home] nil)
(define-key org-mode-map [end] nil))
)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
org-directory "~/things_to_think_about/"
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-export-latex-format-toc-function 'org-export-latex-format-toc-default
org-export-blocks '((src org-babel-exp-src-block nil)
(export-comment org-export-blocks-format-comment t)
(ditaa org-export-blocks-format-ditaa nil)
(dot org-export-blocks-format-dot nil))
org-export-first-hook '(org-beamer-initialize-open-trackers)
org-export-interblocks '((src org-babel-exp-non-block-elements))
org-enable-priority-commands nil
org-confirm-elisp-link-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-agenda-files '("~/things_to_think_about/gtd.org")
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
)
reply other threads:[~2012-06-18 18:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=y2jipeomr6v.fsf@swan.astro.utoronto.ca \
--to=mhvk@astro.utoronto.ca \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).