emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* PATCH: Fix malformed "message" links produced by org-mac-link.el
@ 2014-09-24 10:39 Steve Purcell
  2014-09-24 15:35 ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Steve Purcell @ 2014-09-24 10:39 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

Links which should look like:

[[message://2.11f23692084eb783e40c@NY-WEB01][Private beta invitation for Emacs Q&A site - Area 51 - Stack Exchange]]

are currently mangled into:

[[essage://2.11f23692084eb783e40c@NY-WEB01][Private beta invitation for Emacs Q&A site - Area 51 - Stack Exchang]]

This tiny patch fixes this issue.

Tested on OS X 10.9.

-Steve


[-- Attachment #2: 0001-org-mac-link.el-Fix-malformed-message-links.patch --]
[-- Type: application/octet-stream, Size: 2311 bytes --]

From 6689b708ddc2e9f9bedfe6c0c2ef5f3084bf1ac6 Mon Sep 17 00:00:00 2001
From: Steve Purcell <steve@sanityinc.com>
Date: Wed, 24 Sep 2014 11:27:00 +0100
Subject: [PATCH] org-mac-link.el: Fix malformed message links

* contrib/lisp/org-mac-link.el (org-mac-message-get-links): Use the `org-mac-paste-applescript-links' helper.

The existing code inserted links which should have been "[[message:ABC][the subject]]"
as "[[essage:ABC][the subjec]]".

TINYCHANGE
---
 contrib/lisp/org-mac-link.el | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index 3b58d04..3389334 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -856,27 +856,11 @@ The Org-syntax text will be pushed to the kill ring, and also returned."
   (interactive "sLink to (s)elected or (f)lagged messages: ")
   (setq select-or-flag (or select-or-flag "s"))
   (message "AppleScript: searching mailboxes...")
-  (let* ((as-link-list
-          (if (string= select-or-flag "s")
-              (org-as-get-selected-mail)
-	    (if (string= select-or-flag "f")
-		(org-as-get-flagged-mail)
-	      (error "Please select \"s\" or \"f\""))))
-         (link-list
-          (mapcar
-           (lambda (x) (if (string-match "\\`\"\\(.*\\)\"\\'" x) (setq x (match-string 1 x))) x)
-           (split-string (substring as-link-list 1 -1) "[\r\n]+")))
-         split-link URL description orglink orglink-insert rtn orglink-list)
-    (while link-list
-      (setq split-link (split-string (pop link-list) "::split::"))
-      (setq URL (car split-link))
-      (setq description (cadr split-link))
-      (when (not (string= URL ""))
-        (setq orglink (org-make-link-string URL description))
-        (push orglink orglink-list)))
-    (setq rtn (mapconcat 'identity orglink-list "\n"))
-    (kill-new rtn)
-    rtn))
+  (org-mac-paste-applescript-links
+   (cond
+    ((string= select-or-flag "s") (org-as-get-selected-mail))
+    ((string= select-or-flag "f") (org-as-get-flagged-mail))
+    (t (error "Please select \"s\" or \"f\"")))))
 
 (defun org-mac-message-insert-selected ()
   "Insert a link to the messages currently selected in Mail.app.
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-09 13:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 10:39 PATCH: Fix malformed "message" links produced by org-mac-link.el Steve Purcell
2014-09-24 15:35 ` Alan Schmitt
2014-09-24 15:42   ` Steve Purcell
2014-09-24 19:01     ` Alan Schmitt
2014-09-24 19:56       ` Steve Purcell
2014-09-25  6:14         ` Alan Schmitt
2014-10-09 12:15           ` Alan Schmitt
2014-10-09 12:25             ` Steve Purcell
2014-10-09 13:18               ` Alan Schmitt

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).