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

Jeremy Maitin-Shepard jeremy at jeremyms.com
Mon Apr 6 13:58:12 PDT 2009


Tassilo Horn <tassilo at member.fsf.org> writes:

> Hi all,
> 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.

> How do I get the last two informations?

> Additionally, I need to url-encode these informations.  How do I do
> that?

There are the standard global JavaScript functions encodeURI and
encodeURIComponent.

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.

-- 
Jeremy Maitin-Shepard


More information about the Conkeror mailing list