emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [Patch] New implementation of the Org remember process ready for comments and testing
Date: Tue, 22 Jun 2010 16:29:29 +0200	[thread overview]
Message-ID: <87tyov87jq.fsf@gmx.de> (raw)
In-Reply-To: <961CE74C-CE86-4E68-82F3-65EFC991A9BB@gmail.com> (Carsten Dominik's message of "Tue, 22 Jun 2010 16:25:05 +0200")

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Wooooooooooow, that was incredibly fast!
>
> :-)
>
> template keys used to be characters, now in org-capture.el they are strings.
> Does the patch handle this correctly?



I wondering about that, too. But some nice person changed
org-remember.el to take care for that (See
`org-select-remember-template').


  Sebastian

>
> - Carsten
>
>
>
> On Jun 22, 2010, at 4:20 PM, Sebastian Rose wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> 3 Why a new name?
>>> ~~~~~~~~~~~~~~~~~~
>>>
>>>  I have - at least for now - chosen a new name for the new setup:
>>> ` org-capture'.  There are two reasons for this:
>>
>> In the manual it is "Capture - Refile - Archive".  I remember searching
>> for "Remember" and never found it :)
>>
>>
>>> 5 Setup
>>> ~~~~~~~~
>>>
>>>  To use the new setup, do the following:
>>>
>>>  1. Run
>>>
>>>     M-x org-capture-import-remember-templates RET
>>
>> Worked perfectly here :)
>>
>> I tested all my important templates and they work.
>> Abandoning org-remember seems painless.
>>
>>
>>>   '(("t" "templates adding table lines")
>>>     ("ta" "add to table a" table-line (file+headline "~/notes.org" "Table A))
>>>     ("tb" "add to table b" table-line (file+headline "~/notes.org" "Table B))
>>>     ("tc" "add to table c" table-line (file+headline "~/notes.org" "Table
>>> C)))
>>>
>>>   When starting capture, you can then first press "t" and then see
>>>   the individual options.
>>
>> This is great.  Number of templates is constantly growing and the new
>> features will increase the speed of this process.
>>
>>
>>> 7 Request for comments
>>> ~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> None of what I describe is set in stone yet - let me know if you have
>>> comments, change requests or other ideas.
>>>
>>> My feeling right now is that this should become the default capture
>>> system, and that we will keep the current org-remember in the
>>> distribution for quite some time, for compatibility.
>>
>>
>> Good track I guess.
>>
>>
>>
>>
>> Here's the tested and working patch for org-protocol.el.
>>
>> To use `org-remember' and/or `org-capture' alike, copy your org-
>> remember
>> link and change
>>
>>   javascript:location.href='org-protocol://remember://'+...
>>
>> to
>>
>>   javascript:location.href='org-protocol://capture://'+...
>>
>>
>> The template char used is the same for both --- which is OK for me, but
>> could be changed.
>>
>>
>>
>>
>> diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
>> index 0642227..88676f4 100644
>> --- a/lisp/org-protocol.el
>> +++ b/lisp/org-protocol.el
>> @@ -87,12 +87,17 @@
>> ;;     pushes the browsers URL to the `kill-ring' for yanking. This handler is
>> ;;     triggered through the sub-protocol \"store-link\".
>> ;;
>> -;;   * Call `org-protocol-remember' by using the sub-protocol \"remember\".
>> If
>> -;;     Org-mode is loaded, emacs will pop-up a remember buffer and fill the
>> +;;   * Call `org-protocol-capture' by using the sub-protocol \"capture\".  If
>> +;;     Org-mode is loaded, emacs will pop-up a capture buffer and fill the
>> ;;     template with the data provided. I.e. the browser's URL is inserted as
>> an
>> ;;     Org-link of which the page title will be the description part. If text
>> ;;     was select in the browser, that text will be the body of the entry.
>> ;;
>> +;;   * Call `org-protocol-remember' by using the sub-protocol \"remember\".
>> +;;     This is provided for backward compatibility.
>> +;;     You may read `org-capture' as `org-remember' throughout this file if
>> +;;     you still use `org-remember'.
>> +;;
>> ;; You may use the same bookmark URL for all those standard handlers and just
>> ;; adjust the sub-protocol used:
>> ;;
>> @@ -101,7 +106,7 @@
>> ;;           encodeURIComponent(document.title)+'/'+
>> ;;           encodeURIComponent(window.getSelection())
>> ;;
>> -;; The handler for the sub-protocol \"remember\" detects an optional template
>> +;; The handler for the sub-protocol \"capture\" detects an optional template
>> ;; char that, if present, triggers the use of a special template.
>> ;; Example:
>> ;;
>> @@ -143,6 +148,7 @@ for `org-protocol-the-protocol' and sub-procols defined in
>>
>> (defconst org-protocol-protocol-alist-default
>>   '(("org-remember"    :protocol "remember"    :function org-
>> protocol-remember :kill-client t)
>> +    ("org-capture"     :protocol "capture"     :function org-
>> protocol-capture  :kill-client t)
>>     ("org-store-link"  :protocol "store-link"  :function org-
>> protocol-store-link)
>>     ("org-open-source" :protocol "open-source" :function org-
>> protocol-open-source))
>>   "Default protocols to use.
>> @@ -260,7 +266,6 @@ Here is an example:
>>   :group 'org-protocol
>>   :type 'string)
>>
>> -
>> ;;; Helper functions:
>>
>> (defun org-protocol-sanitize-uri (uri)
>> @@ -443,51 +448,73 @@ The sub-protocol used to reach this function is set in
>> (defun org-protocol-remember  (info)
>>   "Process an org-protocol://remember:// style url.
>>
>> +The location for a browser's bookmark has to look like this:
>> +
>> +  javascript:location.href='org-protocol://remember://'+ \\
>> +        encodeURIComponent(location.href)+'/' \\
>> +        encodeURIComponent(document.title)+'/'+ \\
>> +        encodeURIComponent(window.getSelection())
>> +
>> +See the docs for `org-protocol-capture' for more information."
>> +
>> +  (if (and (boundp 'org-stored-links)
>> +           (or (fboundp 'org-capture))
>> +	   (org-protocol-do-capture info 'org-remember))
>> +      (message "Org-mode not loaded."))
>> +  nil)
>> +
>> +(defun org-protocol-capture  (info)
>> +  "Process an org-protocol://capture:// style url.
>> +
>> The sub-protocol used to reach this function is set in
>> `org-protocol-protocol-alist'.
>>
>> This function detects an URL, title and optional text, separated by '/'
>> The location for a browser's bookmark has to look like this:
>>
>> -  javascript:location.href='org-protocol://remember://'+ \\
>> +  javascript:location.href='org-protocol://capture://'+ \\
>>         encodeURIComponent(location.href)+'/' \\
>>         encodeURIComponent(document.title)+'/'+ \\
>>         encodeURIComponent(window.getSelection())
>>
>> By default, it uses the character `org-protocol-default-template-key',
>> -which should be associated with a template in `org-remember-
>> templates'.
>> +which should be associated with a template in `org-capture-
>> 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://capture://b/'+ ...
>>
>> Now template ?b will be used."
>> -
>>   (if (and (boundp 'org-stored-links)
>> -           (fboundp 'org-remember))
>> -      (let* ((parts (org-protocol-split-data info t))
>> -             (template (or (and (= 1 (length (car parts))) (pop parts))
>> -			   org-protocol-default-template-key))
>> -             (url (org-protocol-sanitize-uri (car parts)))
>> -             (type (if (string-match "^\\([a-z]+\\):" url)
>> -                       (match-string 1 url)))
>> -             (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))
>> -        (kill-new orglink)
>> -        (org-store-link-props :type type
>> -                              :link url
>> -                              :description title
>> -                              :initial region)
>> -        (raise-frame)
>> -        (org-remember nil (string-to-char template)))
>> -
>> -    (message "Org-mode not loaded."))
>> +           (or (fboundp 'org-capture))
>> +	   (org-protocol-do-capture info 'org-capture))
>> +      (message "Org-mode not loaded."))
>>   nil)
>>
>> +(defun org-protocol-do-capture (info capture-func)
>> +  "Support `org-capture' and `org-remember' alike.
>> +CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'."
>> +  (let* ((parts (org-protocol-split-data info t))
>> +	 (template (or (and (= 1 (length (car parts))) (pop parts))
>> +		       org-protocol-default-template-key))
>> +	 (url (org-protocol-sanitize-uri (car parts)))
>> +	 (type (if (string-match "^\\([a-z]+\\):" url)
>> +		   (match-string 1 url)))
>> +	 (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))
>> +    (kill-new orglink)
>> +    (org-store-link-props :type type
>> +			  :link url
>> +			  :description title
>> +			  :initial region)
>> +    (raise-frame)
>> +    (funcall capture-func nil template)))
>> +
>> +
>> (defun org-protocol-open-source (fname)
>>   "Process an org-protocol://open-source:// style url.
>>
>>
>>
>>
>> Best wishes
>>
>>  Sebastian
>
> - Carsten
>
>

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sebastian  Rose      Fachinformatiker / Anwendungsentwicklung
Viktoriastr. 22      Entwicklung von Anwendungen mit freien Werkzeugen
30451  Hannover      und Bibliotheken.

0173  83 93 417      sebastian_rose@gmx.de         s.rose@emma-stil.de
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  reply	other threads:[~2010-06-22 14:29 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22 12:36 New implementation of the Org remember process ready for comments and testing Carsten Dominik
2010-06-22 14:08 ` Sébastien Vauban
2010-06-22 14:20 ` [Patch] " Sebastian Rose
2010-06-22 14:25   ` Carsten Dominik
2010-06-22 14:29     ` Sebastian Rose [this message]
2010-06-22 14:42       ` Carsten Dominik
2010-06-22 14:26   ` Carsten Dominik
2010-06-22 14:27   ` Carsten Dominik
2010-06-23  9:38   ` Ulf Stegemann
2010-06-23 10:29     ` Sebastian Rose
2010-06-23 11:28       ` Carsten Dominik
2010-06-23 12:21       ` Ulf Stegemann
2010-06-23 12:49         ` Sebastian Rose
2010-06-23 14:22           ` Carsten Dominik
2010-06-23 14:42             ` Sebastian Rose
2010-06-24 12:41               ` Ulf Stegemann
2010-06-23 14:06   ` Carsten Dominik
2010-06-22 18:58 ` Tassilo Horn
2010-06-23  3:59   ` Carsten Dominik
2010-06-23  6:31     ` Tassilo Horn
2010-06-23  6:44       ` Carsten Dominik
2010-06-22 19:26 ` Eric S Fraga
2010-06-23  7:53   ` Ian Barton
2010-06-22 20:50 ` Bernt Hansen
2010-06-22 23:15   ` Sebastian Rose
2010-06-23  4:35   ` Carsten Dominik
2010-06-22 23:07 ` Sebastian Rose
2010-06-22 23:32   ` [Patch] " Sebastian Rose
2010-06-23  4:18   ` Carsten Dominik
2010-06-23 12:24   ` reuse input (was: New implementation of the Org remember process ready for comments and testing) Memnon Anon
2010-06-22 23:56 ` New implementation of the Org remember process ready for comments and testing Sebastian Rose
2010-06-23  4:23   ` Carsten Dominik
2010-06-23  8:05     ` Sebastian Rose
2010-06-23  8:18       ` Carsten Dominik
2010-06-23  4:01 ` Puneeth
2010-06-23  4:31   ` Carsten Dominik
2010-06-23  9:04     ` Puneeth
2010-06-23  8:39   ` Carsten Dominik
2010-06-23  4:52 ` Manish
2010-06-23  5:40   ` Carsten Dominik
2010-06-23  8:02 ` Ian Barton
2010-06-23 11:30   ` Carsten Dominik
2010-06-23 10:40 ` [Typo] " Sebastian Rose
2010-06-23 11:27   ` Carsten Dominik
2010-06-23 13:53 ` Jason McBrayer
2010-06-23 14:05 ` Darlan Cavalcante Moreira
2010-06-23 15:19   ` Carsten Dominik
2010-06-23 17:00     ` Darlan Cavalcante Moreira
2010-06-24  5:20       ` Carsten Dominik
2010-06-24  1:32 ` Bernt Hansen
2010-06-24  2:25   ` BUG: org-capture saves an incorrect clock marker in org-clock-history Bernt Hansen
2010-06-24  5:39     ` Carsten Dominik
2010-06-24 13:37       ` Bernt Hansen
2010-06-24  2:36   ` Re: New implementation of the Org remember process ready for comments and testing Nick Dokos
2010-06-24  2:37     ` Bernt Hansen
2010-06-24  2:41       ` Bernt Hansen
2010-06-24  2:57         ` Capture mode seems to be easily confused in Emacs 22 Bernt Hansen
2010-06-24  5:44           ` Carsten Dominik
2010-06-24 12:26             ` Bernt Hansen
2010-06-24 12:46               ` Carsten Dominik
2010-06-24 13:14                 ` Bernt Hansen
2010-06-24 13:21                   ` Carsten Dominik
2010-06-24 13:32                 ` Bernt Hansen
2010-07-05 11:22 ` capture template: %& and %! Memnon Anon
2010-07-05 12:50   ` Carsten Dominik
2010-07-05 13:18     ` Memnon Anon
2010-07-05 13:26       ` Carsten Dominik

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=87tyov87jq.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=carsten.dominik@gmail.com \
    --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).