Browse Source

Cater for empty region, link, title in org-protocol.el

Carsten Dominik 15 years ago
parent
commit
da2a88c3ae
2 changed files with 7 additions and 3 deletions
  1. 3 0
      lisp/ChangeLog
  2. 4 3
      lisp/org-protocol.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-11-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-protocol.el (org-protocol-remember): Cater for empty title,
+	region, link.
+
 	* org-agenda.el (org-agenda-diary-entry-in-org-file): Rebuild
 	agenda after adding new entry.
 	(org-agenda-get-represented-tags): New function.

+ 4 - 3
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))