[Conkeror] Getting informations about the current buffer in interactive commands

Tassilo Horn tassilo at member.fsf.org
Mon Apr 6 23:45:48 PDT 2009


Jeremy Maitin-Shepard <jeremy at jeremyms.com> writes:

Hi Jeremy,

>> I'd like to write an interactive conkeror command which remembers the
>> current page using emacs' org-mode [1], more concrete, the
>> org-protocol extension [2].  Therefore I need to gather the following
>> informations:
>
>>   - The URL the buffer is currently visiting.  That I already know:
>>     I.buffer.display_URI_string
>
>>   - The title of the buffer
>
> I.buffer.document.title
>
>>   - The text that is currently selected
>
> I.buffer.top_frame.getSelection()
>
> I don't know if that will handle sub-frames properly, but that is the
> equivalent of what is recommended on the org-protocol webpage.

Great, thanks!

>> Additionally, I need to url-encode these informations.  How do I do
>> that?
>
> There are the standard global JavaScript functions encodeURI and
> encodeURIComponent.

Nice.

> As a sidenote, looking at org-protocol, it is not clear what advantage
> it offers over emacsclient -e.  Some of the protocols it actually
> implements surely are useful, but the special filename interception it
> does just seems like extra infrastructure for no gain.

Well, more or less you're right.  I did remembering of websites before
and used something like 'emacsclient -e (my-custom-function "url")', but
then I have to hassle with shell quoting and write a new custom function
for each task.  Therefore I like this standard interface better.

And, of course, since you can add a handler for org-protocol:// in a
browser, I guess sites like orgmode.org, Worg and emacswiki will
eventually start using links like that.

BTW: How do I set "emacsclient -c" as handler for the org-protocol?

Bye,
Tassilo
-- 
Richard Stallman's computer  doesn't have a clock, it  defines what time
it is.



More information about the Conkeror mailing list