"Andrew J. Korty" <address@hidden> writes:
I've learned some more details. The behavior I describe only
occurs when remember is called via org-protocol. When that
happens, `initial' is nil, so the following code in org-remember.el
doesn't run:
(save-match-data
(let* ((lead (buffer-substring
(point-at-bol) (match-beginning 0))))
(setq v-i (mapconcat 'identity
(org-split-string initial "\n")
(concat "\n" lead)))))
I'm not sure of the best way to fix it.
As `initial' was not set, so might `title' in some cases. Hence this
patch is better.
Carsten: Not sure about the link - but looking at
`org-make-link-string', a string that consists of spaces only, might
create a link like this:
[[url][ ]]
Test:
(let ((orglink (org-make-link-string
"http://www.google.de" " ")))
(insert orglink))
Which is invisible in Org-files!!!
My patch works around that, too.
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 5c65fb0..0d40c2c 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -470,9 +470,10 @@ Now template ?b will be used."
(url (org-protocol-sanitize-uri (car parts)))
(type (if (string-match "^\\([a-z]+\\):" url)
(match-string 1 url)))
- (title (cadr parts))
- (region (caddr parts))
- (orglink (org-make-link-string url title))
+ (title (or (cadr parts) ""))
+ (region (or (caddr parts) ""))
+ (orglink (org-make-link-string
+ url (if (string-match "[^[:space:]]" title) title url)))
remember-annotation-functions)
(setq org-stored-links
(cons (list url title) org-stored-links))
Best wishes
Sebastian