فهرست منبع

New option: org-protocol-default-template-key defaults to "w".

The default template "w" used to be hardwired, we have an option now.
Bastien Guerry 17 سال پیش
والد
کامیت
52302394e7
2فایلهای تغییر یافته به همراه14 افزوده شده و 6 حذف شده
  1. 3 0
      lisp/ChangeLog
  2. 11 6
      lisp/org-protocol.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-07-27  Bastien Guerry  <bzg@altern.org>
 2009-07-27  Bastien Guerry  <bzg@altern.org>
 
 
+	* org-protocol.el (org-protocol-default-template-key): New
+	option.
+
 	* org.el (org-refile): Bugfix: save-excursion before reading the
 	* org.el (org-refile): Bugfix: save-excursion before reading the
 	refile target, otherwise cursor moves might confuse `org-refile'.
 	refile target, otherwise cursor moves might confuse `org-refile'.
 
 

+ 11 - 6
lisp/org-protocol.el

@@ -254,6 +254,11 @@ Here is an example:
   :group 'org-protocol
   :group 'org-protocol
   :type '(alist))
   :type '(alist))
 
 
+(defcustom org-protocol-default-template-key "w"
+  "The default org-remember-templates key to use."
+  :group 'org-protocol
+  :type 'string)
+
 
 
 ;;; Helper functions:
 ;;; Helper functions:
 
 
@@ -438,8 +443,9 @@ The location for a browser's bookmark has to look like this:
         encodeURIComponent(document.title)+'/'+ \\
         encodeURIComponent(document.title)+'/'+ \\
         encodeURIComponent(window.getSelection())
         encodeURIComponent(window.getSelection())
 
 
-By default the template character ?w is used. But you may prepend the encoded
-URL with a character and a slash like so:
+By default, it uses the character `org-protocol-default-template-key',
+which should be associated with a template in `org-remember-templates'.
+But you may prepend the encoded URL with a character and a slash like so:
 
 
   javascript:location.href='org-protocol://org-store-link://b/'+ ...
   javascript:location.href='org-protocol://org-store-link://b/'+ ...
 
 
@@ -448,7 +454,8 @@ Now template ?b will be used."
   (if (and (boundp 'org-stored-links)
   (if (and (boundp 'org-stored-links)
            (fboundp 'org-remember))
            (fboundp 'org-remember))
       (let* ((parts (org-protocol-split-data info t))
       (let* ((parts (org-protocol-split-data info t))
-             (template (or (and (= 1 (length (car parts))) (pop parts)) "w"))
+             (template (or (and (= 1 (length (car parts))) (pop parts)) 
+			   org-protocol-default-template-key))
              (url (org-protocol-sanitize-uri (car parts)))
              (url (org-protocol-sanitize-uri (car parts)))
              (type (if (string-match "^\\([a-z]+\\):" url)
              (type (if (string-match "^\\([a-z]+\\):" url)
                        (match-string 1 url)))
                        (match-string 1 url)))
@@ -582,7 +589,6 @@ most of the work."
                (substitute-command-keys"\\[org-protocol-create]")))))
                (substitute-command-keys"\\[org-protocol-create]")))))
 
 
 
 
-
 (defun org-protocol-create(&optional project-plist)
 (defun org-protocol-create(&optional project-plist)
   "Create a new org-protocol project interactively.
   "Create a new org-protocol project interactively.
 An org-protocol project is an entry in `org-protocol-project-alist'
 An org-protocol project is an entry in `org-protocol-project-alist'
@@ -630,8 +636,7 @@ project-plist is the CDR of an element in `org-publish-project-alist', reuse
                                  :online-suffix ,strip-suffix
                                  :online-suffix ,strip-suffix
                                  :working-suffix ,working-suffix))
                                  :working-suffix ,working-suffix))
                   org-protocol-project-alist))
                   org-protocol-project-alist))
-      (customize-save-variable 'org-protocol-project-alist org-protocol-project-alist))
-))
+      (customize-save-variable 'org-protocol-project-alist org-protocol-project-alist))))
 
 
 (provide 'org-protocol)
 (provide 'org-protocol)
 ;;; org-protocol.el ends here
 ;;; org-protocol.el ends here