emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Andrew J. Korty" <ajk@iu.edu>
To: emacs-orgmode@gnu.org
Subject: Bug: org-mhe creates corrupt link when Message-ID field contains newline [7.01trans]
Date: Wed, 15 Sep 2010 10:21:18 -0400	[thread overview]
Message-ID: <30477.1284560478@iu.edu> (raw)

Some MUAs insert a newline when rendering the Message-ID field:

    Message-ID:
     <98A78083733DE040834C2B9E91B87FDE0AADEB@example.com>

The newline causes org-mhe-store-link to create a link that looks like

    [[mhe:%2Barchive#
    %20<98A78083733DE040834C2B9E91B87FDE0AADEB@example.com][subject]]

org later treats the above as separate lines; any tags or properties 
added end up in the middle of the link.

The following patch removes whitespace at the beginning of all header  
fields returned by org-mhe-get-header, correcting this problem and 
possibly others.

Andrew Korty

---
 lisp/org-mhe.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-mhe.el b/lisp/org-mhe.el
index 46340be..6810359 100644
--- a/lisp/org-mhe.el
+++ b/lisp/org-mhe.el
@@ -181,7 +181,7 @@ you have a better idea of how to do this then please let us know."
     (if (equal major-mode 'mh-folder-mode)
 	(mh-show)
       (mh-show-show))
-    header-field)))
+    (replace-regexp-in-string "^\\s-+" "" header-field))))
 
 (defun org-mhe-follow-link (folder article)
   "Follow an MH-E link to FOLDER and ARTICLE.
-- 
1.7.2.3

Emacs  : GNU Emacs 23.1.50.1 (x86_64-apple-darwin10.0.0, NS apple-appkit-1038.11)
 of 2009-11-10 on phrygian
Package: Org-mode version 7.01trans

             reply	other threads:[~2010-09-15 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 14:21 Andrew J. Korty [this message]
2010-09-15 17:02 ` Bug: org-mhe creates corrupt link when Message-ID field contains newline [7.01trans] David Maus

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=30477.1284560478@iu.edu \
    --to=ajk@iu.edu \
    --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).