emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* capture with iceweasel/firefox -- nothing works
@ 2016-06-04  1:23 Samuel Wales
  2016-06-04  1:30 ` Samuel Wales
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Samuel Wales @ 2016-06-04  1:23 UTC (permalink / raw)
  To: emacs-orgmode

over many years, i have been trying to get org-protocol (or
anything similar) to work, and it is not working reliably.

intermittently, it says there is a greedy protocol.  the
success rate of capturing is around 50% maybe.  when it is not
working, it never works.  i have
noticed no correlation with anything that could cause this.

sometimes it captures bogus text when i just want the link,
but i don't care about that.  at least it copied the link.

i've tried:

  1) org-capture firefox extension
  2) a bookmark like this
     - javascript:location.href%20=%20'org-protocol://capture-html://w/'%20+%20encodeURIComponent(location.href)%20+%20'/'%20+%20encodeURIComponent(document.title)%20+%20'/'%20+%20encodeURIComponent(function%20()%20{var%20html%20=%20"";%20if%20(typeof%20document.getSelection%20!=%20"undefined")%20{var%20sel%20=%20document.getSelection();%20if%20(sel.rangeCount)%20{var%20container%20=%20document.createElement("div");%20for%20(var%20i%20=%200,%20len%20=%20sel.rangeCount;%20i%20<%20len;%20++i)%20{container.appendChild(sel.getRangeAt(i).cloneContents());}%20html%20=%20container.innerHTML;}}%20else%20if%20(typeof%20document.selection%20!=%20"undefined")%20{if%20(document.selection.type%20==%20"Text")%20{html%20=%20document.selection.createRange().htmlText;}}%20var%20relToAbs%20=%20function%20(href)%20{var%20a%20=%20document.createElement("a");%20a.href%20=%20href;%20var%20abs%20=%20a.protocol%20+%20"//"%20+%20a.host%20+%20a.pathname%20+%20a.search%20+%20a.hash;%20a.remove();%20return%20abs;};%20var%20elementTypes%20=%20[['a',%20'href'],%20['img',%20'src']];%20var%20div%20=%20document.createElement('div');%20div.innerHTML%20=%20html;%20elementTypes.map(function(elementType)%20{var%20elements%20=%20div.getElementsByTagName(elementType[0]);%20for%20(var%20i%20=%200;%20i%20<%20elements.length;%20i++)%20{elements[i].setAttribute(elementType[1],%20relToAbs(elements[i].getAttribute(elementType[1])));}});%20return%20div.innerHTML;}());
  3) a bookmark like this
     - javascript:location.href='org-protocol://capture://L/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
  4) i know there's a new one that is supposed to capture
     format better (so you don't end up with a single
     paragraph when there were several paragraphs).  that
     sounds wonderful!  however, i am limited in computer
     use (4 minutes at a time), so i don't know if it is
     worth my trying or not.  i have to use those 4 minutes responsibly.
  5) i followed various instructions

i currently using iceweasel 38.8.0 (debian jessie) and
emacs-version "24.4.1".

i understand elisp and org.

however, i don't understand javascript or org-protocol's
internal concepts.  i am limited in concentration ability,
so this could be a problem.  i am also hazy on how to set up
a bookmark, but i somehow managed to do it twice.

===

i am very often physically unable to use a keyboard.  during
these times i am often able to use a pointing device (2
mouses, one for clicking and one for moving).

i am often using firefox (iceweasel) and want to capture
things to org using only the mouse.

that's why i want this feature to work so much.

===

i want to use org-capture extension or similar so that i can
copy snippets of text like this:

  * [[link][descr]]
  text that i selected
  ---

(the --- indicates that it came from iceweasel, and is not something i wrote.)

or just the plain link like this if nothing is selected:

  * [[link][descr]]

i have this working.  it is just unreliable, failing randomly at random times.

(note: i don't want emacs to pop up and there should be no keyboard
interaction.  useful if emacs switches to the buffer it is saved to,
however.  i have all that stuff taken care of in my elisp.  that part
i understand and can fix by myself.)

===

i am stuck on this.

after all that long-windedness, my question is this:

  *what is the most reliable set of instructions or code to
  get iceweasel to work with org?*

i'd be grateful for any useful hints.

thanks.


samuel

===

here are just 2 of the many elisp-side things i tried over
the years to get this to work.  elisp i can handle.

  (setq org-capture-templates
        (append
         org-capture-templates
         `(
           ("p" "Protocol" entry (file+headline ,(concat org-directory
"notes.org") "Inbox")
            "* %^{Title}\nSource: %u, %c\n
#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
           ("L" "Protocol Link" entry (file+headline ,(concat
org-directory "notes.org") "Inbox")
            "* %? [[%:link][%:description]] \nCaptured On: %U")
           )))
  ;; --- https://github.com/sprig/org-capture-extension#set-up-handlers-in-emacs

  (cl-loop for key in '("L" "p")
           do
           (add-to-list
            'org-capture-templates
            `(,key
              ,(format "Protocol %s" key)
              entry
              (file+headline
               ,org-default-notes-file
               ;; (concat org-directory "/executive--a.org")
               "xyzzy-remember")
              ;; \nkill %c\nselect %x
              ;; %:initial is like %i in org-protocol
              ;;   if text, do --
              ;; fixme i can perhaps remove my cleverness for whether
              ;; there is or is not selected text as in the
              ;; example above with begin quote.
              ;;
https://github.com/sprig/org-capture-extension#set-up-handlers-in-emacs
              ;;
              ;; a future security fix might break this cleverness
              "%(alpha-org-protocol-string \"%:link\" \"%:description\" \"%i\")"
              ;; "*
[[%:link][%:description]]\n%(alpha-org-protocol-region \"%i\")"
              :prepend t
              ;; fixme set this to nil if you want to debug ka
              :immediate-finish t
              ;; ensure it worked
              ;; just remember to go to prev buffer for where you were
              :jump-to-captured t)))
  nil)
(defun alpha-org-protocol-string (link description region)
  (format "* %s\n%s\n"
          (org-make-link-string link description)
          (alpha-org-protocol-region region)))
(defun alpha-org-protocol-region (string)
  "If there is text, append dash to indicate quote."
  (if (= 0 (length string))
      ""
    (concat string "\n---")))


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  1:23 capture with iceweasel/firefox -- nothing works Samuel Wales
@ 2016-06-04  1:30 ` Samuel Wales
  2016-06-04  1:33   ` Samuel Wales
  2016-06-04  3:56 ` Matt Lundin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Samuel Wales @ 2016-06-04  1:30 UTC (permalink / raw)
  To: emacs-orgmode

On 6/3/16, Samuel Wales <samologist@gmail.com> wrote:
>   4) i know there's a new one that is supposed to capture
>      format better (so you don't end up with a single
>      paragraph when there were several paragraphs).  that
>      sounds wonderful!

https://github.com/alphapapa/org-protocol-capture-html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  1:30 ` Samuel Wales
@ 2016-06-04  1:33   ` Samuel Wales
  2016-06-04  3:04     ` Xebar Saram
  0 siblings, 1 reply; 17+ messages in thread
From: Samuel Wales @ 2016-06-04  1:33 UTC (permalink / raw)
  To: emacs-orgmode

please note that i do not use a desktop environment, just a window
manager.  if this is relevant, please tell me.  i do not understand
mime or things like that.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  1:33   ` Samuel Wales
@ 2016-06-04  3:04     ` Xebar Saram
  2016-06-04  4:05       ` Matt Lundin
  0 siblings, 1 reply; 17+ messages in thread
From: Xebar Saram @ 2016-06-04  3:04 UTC (permalink / raw)
  To: Samuel Wales; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

Hi

i will add that im exactly in the same situatuon
i use a window manager (i3) on arch linux and have tried almost every
solution out there (with FF, chrome etc) with no working method.
i really wish org-protocol had a much simpler way of capturing links,text
tec. im not a programmer but to me it seems so complicated. it the past
before i was using org i had a simple bash script that yanked links/text
from dwb (a simple web browser) and added that to a text file. something
like this

#!/bin/bash
# dwb: xtm
task add pro:dl +music $DWB_TITLE $DWB_URI

where the current title+URI of the webpage was added to a text file (task
add) command.

would love something simple like that for orgmode

best

Z




On Sat, Jun 4, 2016 at 4:33 AM, Samuel Wales <samologist@gmail.com> wrote:

> please note that i do not use a desktop environment, just a window
> manager.  if this is relevant, please tell me.  i do not understand
> mime or things like that.
>
>

[-- Attachment #2: Type: text/html, Size: 1506 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  1:23 capture with iceweasel/firefox -- nothing works Samuel Wales
  2016-06-04  1:30 ` Samuel Wales
@ 2016-06-04  3:56 ` Matt Lundin
  2016-06-04  4:00   ` Matt Lundin
  2016-06-04  5:13   ` Samuel Wales
  2016-06-04  8:26 ` tumashu
  2016-06-04 12:03 ` Philip Hudson
  3 siblings, 2 replies; 17+ messages in thread
From: Matt Lundin @ 2016-06-04  3:56 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> over many years, i have been trying to get org-protocol (or
> anything similar) to work, and it is not working reliably.
>
> intermittently, it says there is a greedy protocol. the success rate
> of capturing is around 50% maybe. when it is not working, it never
> works. i have noticed no correlation with anything that could cause
> this.
>
> sometimes it captures bogus text when i just want the link, but i
> don't care about that. at least it copied the link.
>
> i've tried:
>
>   1) org-capture firefox extension
>   2) a bookmark like this
>      - javascript:location.href%20=%20'org-protocol://capture-html://w/'%20+%20encodeURIComponent(location.href)%20+%20'/'%20+%20encodeURIComponent(document.title)%20+%20'/'%20+%20encodeURIComponent(function%20()%20{var%20html%20=%20"";%20if%20(typeof%20document.getSelection%20!=%20"undefined")%20{var%20sel%20=%20document.getSelection();%20if%20(sel.rangeCount)%20{var%20container%20=%20document.createElement("div");%20for%20(var%20i%20=%200,%20len%20=%20sel.rangeCount;%20i%20<%20len;%20++i)%20{container.appendChild(sel.getRangeAt(i).cloneContents());}%20html%20=%20container.innerHTML;}}%20else%20if%20(typeof%20document.selection%20!=%20"undefined")%20{if%20(document.selection.type%20==%20"Text")%20{html%20=%20document.selection.createRange().htmlText;}}%20var%20relToAbs%20=%20function%20(href)%20{var%20a%20=%20document.createElement("a");%20a.href%20=%20href;%20var%20abs%20=%20a.protocol%20+%20"//"%20+%20a.host%20+%20a.pathname%20+%20a.search%20+%20a.hash;%20a.remove();%20return%20abs;};%20var%20elementTypes%20=%20[['a',%20'href'],%20['img',%20'src']];%20var%20div%20=%20document.createElement('div');%20div.innerHTML%20=%20html;%20elementTypes.map(function(elementType)%20{var%20elements%20=%20div.getElementsByTagName(elementType[0]);%20for%20(var%20i%20=%200;%20i%20<%20elements.length;%20i++)%20{elements[i].setAttribute(elementType[1],%20relToAbs(elements[i].getAttribute(elementType[1])));}});%20return%20div.innerHTML;}());
>   3) a bookmark like this
>      - javascript:location.href='org-protocol://capture://L/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
>   4) i know there's a new one that is supposed to capture
>      format better (so you don't end up with a single
>      paragraph when there were several paragraphs).  that
>      sounds wonderful!  however, i am limited in computer
>      use (4 minutes at a time), so i don't know if it is
>      worth my trying or not.  i have to use those 4 minutes responsibly.

Here is the new style bookmark that works for me:

javascript:location.href='org-protocol://capture?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())

I also placed the following in ~/.local/share/applications/emacsclient.desktop:

--8<---------------cut here---------------start------------->8---
[Desktop Entry]
Name=Emacs Client
Exec=emacsclient %u
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol;
--8<---------------cut here---------------end--------------->8---

Since you are not using a desktop environment, you might also need to
make sure that the appropriate xdg tools are installed. On arch linux
the package is xdg-utils.

I'd recommend copying and pasting the javascript line above into the
location bar to confirm whether it works. If it does, you can then
easily add it to your bookmarks.

Note: There is a bug in the implementation of the new org-protocol url
processing that can lead to multiple "greedy protocol" warnings. (I
posted a bug report about this a week or so ago.)

Hope this helps.
Matt

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  3:56 ` Matt Lundin
@ 2016-06-04  4:00   ` Matt Lundin
  2016-06-04  5:13   ` Samuel Wales
  1 sibling, 0 replies; 17+ messages in thread
From: Matt Lundin @ 2016-06-04  4:00 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Matt Lundin <mdl@imapmail.org> writes:

> Samuel Wales <samologist@gmail.com> writes:
>
>> over many years, i have been trying to get org-protocol (or
>> anything similar) to work, and it is not working reliably.
>>
>> intermittently, it says there is a greedy protocol. the success rate
>> of capturing is around 50% maybe. when it is not working, it never
>> works. i have noticed no correlation with anything that could cause
>> this.

Another thought. Is the emacs server always running (either by starting
emacs as a daemon or by invoking server-start)?

Matt

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  3:04     ` Xebar Saram
@ 2016-06-04  4:05       ` Matt Lundin
  0 siblings, 0 replies; 17+ messages in thread
From: Matt Lundin @ 2016-06-04  4:05 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

Xebar Saram <zeltakc@gmail.com> writes:

> Hi 
>
> i will add that im exactly in the same situatuon
> i use a window manager (i3) on arch linux and have tried almost every
> solution out there (with FF, chrome etc) with no working method.
> i really wish org-protocol had a much simpler way of capturing
> links,text tec. im not a programmer but to me it seems so complicated.
> it the past before i was using org i had a simple bash script that
> yanked links/text from dwb (a simple web browser) and added that to a
> text file. something like this
>
> #!/bin/bash
> # dwb: xtm
> task add pro:dl +music $DWB_TITLE $DWB_URI 

> where the current title+URI of the webpage was added to a text file
> (task add) command.
>
> would love something simple like that for orgmode

I think you could put something like this in the script:

emacsclient "org-protocol://capture?url=$DWB_URI&title=$DWB_TITLE"

If you wanted to add the extra project and tag information (e.g.,
"music"), you could create a custom capture template and then designate
the template shortcut (e.g., "m") in the script:

emacsclient "org-protocol://capture?template=m&url=$DWB_URI&title=$DWB_TITLE"

Matt

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  3:56 ` Matt Lundin
  2016-06-04  4:00   ` Matt Lundin
@ 2016-06-04  5:13   ` Samuel Wales
  2016-06-04 15:11     ` Matt Lundin
  2016-07-21 10:01     ` Adam Porter
  1 sibling, 2 replies; 17+ messages in thread
From: Samuel Wales @ 2016-06-04  5:13 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode

hi matt,

thanks for your reply.

On 6/3/16, Matt Lundin <mdl@imapmail.org> wrote:
> Here is the new style bookmark that works for me:
>
> javascript:location.href='org-protocol://capture?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())
>
> I also placed the following in
> ~/.local/share/applications/emacsclient.desktop:
>
> --8<---------------cut here---------------start------------->8---
> [Desktop Entry]
> Name=Emacs Client
> Exec=emacsclient %u
> Icon=emacs-icon
> Type=Application
> Terminal=false
> MimeType=x-scheme-handler/org-protocol;
> --8<---------------cut here---------------end--------------->8---
>

will try.

> Since you are not using a desktop environment, you might also need to
> make sure that the appropriate xdg tools are installed. On arch linux
> the package is xdg-utils.

debian
xdg-utils:
  Installed: 1.1.0~rc1+git20111210-7.4

>
> I'd recommend copying and pasting the javascript line above into the
> location bar to confirm whether it works. If it does, you can then
> easily add it to your bookmarks.

will try.  this is supposed to imitate clicking on the unicorn or
calling the bookmark?

do i try with selecting and without selecting?

which capture key does it call?

i always run the emacs server in my regular emacs.  i don't
use the daemon.

however, i never found any good instructions on what to do to add js
to bookmarks.
i have a menu bar and a location bar + icons.  i'd like a button or
icon on the latter if possible.  my previous thrashing around caused a
>> symbol which is a drop down menu which contains the bookmarks.
i'll settle for that if nec.  but that is extra clicking i'd rather
avoid, and one of them brings up a page with js on it.

is this knowledge something that everybody except me possesses?  :)

===

the full error is:
Greedy org-protocol handler.  Killing client.
No server buffers remain to edit

>
> Note: There is a bug in the implementation of the new org-protocol url
> processing that can lead to multiple "greedy protocol" warnings. (I
> posted a bug report about this a week or so ago.)
>
> Hope this helps.
> Matt
>

thanks.


samuel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  1:23 capture with iceweasel/firefox -- nothing works Samuel Wales
  2016-06-04  1:30 ` Samuel Wales
  2016-06-04  3:56 ` Matt Lundin
@ 2016-06-04  8:26 ` tumashu
  2016-06-04 12:03 ` Philip Hudson
  3 siblings, 0 replies; 17+ messages in thread
From: tumashu @ 2016-06-04  8:26 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

https://github.com/tumashu/org-capture-pop-frame

you can try above package


--
发自我的网易邮箱手机智能版


在 2016-06-04 09:23:09,"Samuel Wales" <samologist@gmail.com> 写道:
>over many years, i have been trying to get org-protocol (or
>anything similar) to work, and it is not working reliably.
>
>intermittently, it says there is a greedy protocol.  the
>success rate of capturing is around 50% maybe.  when it is not
>working, it never works.  i have
>noticed no correlation with anything that could cause this.
>
>sometimes it captures bogus text when i just want the link,
>but i don't care about that.  at least it copied the link.
>
>i've tried:
>
>  1) org-capture firefox extension
>  2) a bookmark like this
>     - javascript:location.href%20=%20'org-protocol://capture-html://w/'%20+%20encodeURIComponent(location.href)%20+%20'/'%20+%20encodeURIComponent(document.title)%20+%20'/'%20+%20encodeURIComponent(function%20()%20{var%20html%20=%20"";%20if%20(typeof%20document.getSelection%20!=%20"undefined")%20{var%20sel%20=%20document.getSelection();%20if%20(sel.rangeCount)%20{var%20container%20=%20document.createElement("div");%20for%20(var%20i%20=%200,%20len%20=%20sel.rangeCount;%20i%20<%20len;%20++i)%20{container.appendChild(sel.getRangeAt(i).cloneContents());}%20html%20=%20container.innerHTML;}}%20else%20if%20(typeof%20document.selection%20!=%20"undefined")%20{if%20(document.selection.type%20==%20"Text")%20{html%20=%20document.selection.createRange().htmlText;}}%20var%20relToAbs%20=%20function%20(href)%20{var%20a%20=%20document.createElement("a");%20a.href%20=%20href;%20var%20abs%20=%20a.protocol%20+%20"//"%20+%20a.host%20+%20a.pathname%20+%20a.search%20+%20a.hash;%20a.remove();%20return%20abs;};%20var%20elementTypes%20=%20[['a',%20'href'],%20['img',%20'src']];%20var%20div%20=%20document.createElement('div');%20div.innerHTML%20=%20html;%20elementTypes.map(function(elementType)%20{var%20elements%20=%20div.getElementsByTagName(elementType[0]);%20for%20(var%20i%20=%200;%20i%20<%20elements.length;%20i++)%20{elements[i].setAttribute(elementType[1],%20relToAbs(elements[i].getAttribute(elementType[1])));}});%20return%20div.innerHTML;}());
>  3) a bookmark like this
>     - javascript:location.href='org-protocol://capture://L/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
>  4) i know there's a new one that is supposed to capture
>     format better (so you don't end up with a single
>     paragraph when there were several paragraphs).  that
>     sounds wonderful!  however, i am limited in computer
>     use (4 minutes at a time), so i don't know if it is
>     worth my trying or not.  i have to use those 4 minutes responsibly.
>  5) i followed various instructions
>
>i currently using iceweasel 38.8.0 (debian jessie) and
>emacs-version "24.4.1".
>
>i understand elisp and org.
>
>however, i don't understand javascript or org-protocol's
>internal concepts.  i am limited in concentration ability,
>so this could be a problem.  i am also hazy on how to set up
>a bookmark, but i somehow managed to do it twice.
>
>===
>
>i am very often physically unable to use a keyboard.  during
>these times i am often able to use a pointing device (2
>mouses, one for clicking and one for moving).
>
>i am often using firefox (iceweasel) and want to capture
>things to org using only the mouse.
>
>that's why i want this feature to work so much.
>
>===
>
>i want to use org-capture extension or similar so that i can
>copy snippets of text like this:
>
>  * [[link][descr]]
>  text that i selected
>  ---
>
>(the --- indicates that it came from iceweasel, and is not something i wrote.)
>
>or just the plain link like this if nothing is selected:
>
>  * [[link][descr]]
>
>i have this working.  it is just unreliable, failing randomly at random times.
>
>(note: i don't want emacs to pop up and there should be no keyboard
>interaction.  useful if emacs switches to the buffer it is saved to,
>however.  i have all that stuff taken care of in my elisp.  that part
>i understand and can fix by myself.)
>
>===
>
>i am stuck on this.
>
>after all that long-windedness, my question is this:
>
>  *what is the most reliable set of instructions or code to
>  get iceweasel to work with org?*
>
>i'd be grateful for any useful hints.
>
>thanks.
>
>
>samuel
>
>===
>
>here are just 2 of the many elisp-side things i tried over
>the years to get this to work.  elisp i can handle.
>
>  (setq org-capture-templates
>        (append
>         org-capture-templates
>         `(
>           ("p" "Protocol" entry (file+headline ,(concat org-directory
>"notes.org") "Inbox")
>            "* %^{Title}\nSource: %u, %c\n
>#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
>           ("L" "Protocol Link" entry (file+headline ,(concat
>org-directory "notes.org") "Inbox")
>            "* %? [[%:link][%:description]] \nCaptured On: %U")
>           )))
>  ;; --- https://github.com/sprig/org-capture-extension#set-up-handlers-in-emacs
>
>  (cl-loop for key in '("L" "p")
>           do
>           (add-to-list
>            'org-capture-templates
>            `(,key
>              ,(format "Protocol %s" key)
>              entry
>              (file+headline
>               ,org-default-notes-file
>               ;; (concat org-directory "/executive--a.org")
>               "xyzzy-remember")
>              ;; \nkill %c\nselect %x
>              ;; %:initial is like %i in org-protocol
>              ;;   if text, do --
>              ;; fixme i can perhaps remove my cleverness for whether
>              ;; there is or is not selected text as in the
>              ;; example above with begin quote.
>              ;;
>https://github.com/sprig/org-capture-extension#set-up-handlers-in-emacs
>              ;;
>              ;; a future security fix might break this cleverness
>              "%(alpha-org-protocol-string \"%:link\" \"%:description\" \"%i\")"
>              ;; "*
>[[%:link][%:description]]\n%(alpha-org-protocol-region \"%i\")"
>              :prepend t
>              ;; fixme set this to nil if you want to debug ka
>              :immediate-finish t
>              ;; ensure it worked
>              ;; just remember to go to prev buffer for where you were
>              :jump-to-captured t)))
>  nil)
>(defun alpha-org-protocol-string (link description region)
>  (format "* %s\n%s\n"
>          (org-make-link-string link description)
>          (alpha-org-protocol-region region)))
>(defun alpha-org-protocol-region (string)
>  "If there is text, append dash to indicate quote."
>  (if (= 0 (length string))
>      ""
>    (concat string "\n---")))
>
>
>-- 
>The Kafka Pandemic: http://thekafkapandemic.blogspot.com
>
>The disease DOES progress.  MANY people have died from it.  And
>ANYBODY can get it.
>
>Denmark: free Karina Hansen NOW.
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  1:23 capture with iceweasel/firefox -- nothing works Samuel Wales
                   ` (2 preceding siblings ...)
  2016-06-04  8:26 ` tumashu
@ 2016-06-04 12:03 ` Philip Hudson
  2016-06-04 20:53   ` [OT] " Matt Lundin
  3 siblings, 1 reply; 17+ messages in thread
From: Philip Hudson @ 2016-06-04 12:03 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs orgmode-mailinglist

On 4 June 2016 at 02:23, Samuel Wales <samologist@gmail.com> wrote:
> over many years, i have been trying to get org-protocol (or
> anything similar) to work, and it is not working reliably.
> that's why i want this feature to work so much.
...
>   *what is the most reliable set of instructions or code to
>   get iceweasel to work with org?*

Ordinarily my advice would be: Don't. Use Conkeror instead.

However, I see that keyboard-orientation and JavaScript are exactly
what you don't want, which is a pity. Org-capture from Conkeror is
bulletproof for me, even with Emacs server running on a different host
on the same LAN segment.

Conkeror uses the same browser engine as Firefox, so some FF
extensions work with it, but with an "Emacsified" keyboard-oriented
front end (M-x, M-:, C-u, C-g, etc) -- all dynamically configurable
and extensible, though in JavaScript not Elisp. The JavaScripting
framework uses familiar Elisp idioms wherever possible, like hooks,
`provide' and `require', for example.

> i'd be grateful for any useful hints.

Maybe not for you given your no-JS/no-keyboard requirement, but for
others who find this thread:

* Use Conkeror:
    http://conkeror.org
    git clone git://repo.or.cz/conkeror.git
* Don't forget to compile the external-interface module:
    http://conkeror.org/ConkerorSpawnHelper
    (tl;dr: Just cd into the cloned repo and execute 'make')
* On an XDG-compliant system (most Unix-like OSes except OS X):
    xdg-mime default conkeror.desktop x-scheme-handler/http
    xdg-mime default conkeror.desktop x-scheme-handler/https
* On a debian-esque system:
    sudo update-alternatives --config x-www-browser
* Expose Conkeror's JS innards using the 'MozREPL' FF extension:
    http://conkeror.org/MozRepl
** Use Emacs to inspect, configure, drive and automate Conkeror:
     git clone 'https://github.com/bard/mozrepl.git'
     Elisp package 'moz.el' is in subdirectory 'chrome/content/'
** Use the 'bash' shell to inspect, configure, drive and automate Conkeror:
     git clone 'https://github.com/PhilHudson/bash-mozrepl.git'


WRT Org capture protocol for those who do use a desktop env:
    # Support org-protocol on Gnome (and XFCE, MATE, etc):
    dbus-launch gconftool-2 -s
/desktop/gnome/url-handlers/org-protocol/command \
        '/usr/local/bin/emacsclient %s' --type String
    dbus-launch gconftool-2 -s
/desktop/gnome/url-handlers/org-protocol/enabled \
        --type Boolean true


-- 
Phil Hudson                   http://hudson-it.ddns.net
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  5:13   ` Samuel Wales
@ 2016-06-04 15:11     ` Matt Lundin
  2016-09-04  3:23       ` Samuel Wales
  2016-07-21 10:01     ` Adam Porter
  1 sibling, 1 reply; 17+ messages in thread
From: Matt Lundin @ 2016-06-04 15:11 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> hi matt,
>
> thanks for your reply.
>
> On 6/3/16, Matt Lundin <mdl@imapmail.org> wrote:
>> Here is the new style bookmark that works for me:
>>
>> javascript:location.href='org-protocol://capture?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())
>>
>>
>> I'd recommend copying and pasting the javascript line above into the
>> location bar to confirm whether it works. If it does, you can then
>> easily add it to your bookmarks.
>
> will try.  this is supposed to imitate clicking on the unicorn or
> calling the bookmark?

This is the content of the bookmark. Pasting it into the location bar is
just a quick way to test if everything is working prior to saving it
permanently as a bookmark. But it might be easier to go straight to the
bookmark step (see below).

Do you mean clicking on the unicorn icon installed with this extension?

https://addons.mozilla.org/en-US/firefox/addon/org-mode-capture/

If you have installed that extension, I think everything should just
work with minimal configuration. The extension is distinct from the
bookmark method. The difference is that a bookmark is a bit more
universal. Once you get it set up the protocol system-wide, the bookmark
should work in any browser.

> however, i never found any good instructions on what to do to add js
> to bookmarks.

> i have a menu bar and a location bar + icons.  i'd like a button or
> icon on the latter if possible.  my previous thrashing around caused a
>>> symbol which is a drop down menu which contains the bookmarks.
> i'll settle for that if nec.  but that is extra clicking i'd rather
> avoid, and one of them brings up a page with js on it.

To save it as a bookmark in firefox, right click on the bookmark bar,
select "New Bookmark," and paste it into the Location field.

> do i try with selecting and without selecting?

The bookmark should work with and without selections.

> which capture key does it call?

This can be controlled with the emacs variable
`org-protocol-default-template-key'. You can also specify a template
shortcut by changing the bookmark. For instance, to call a template
designated by "x", you could use the following:

javascript:location.href='org-protocol://capture?template=x&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())

Matt

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [OT] Re: capture with iceweasel/firefox -- nothing works
  2016-06-04 12:03 ` Philip Hudson
@ 2016-06-04 20:53   ` Matt Lundin
  2016-06-04 23:01     ` Philip Hudson
  0 siblings, 1 reply; 17+ messages in thread
From: Matt Lundin @ 2016-06-04 20:53 UTC (permalink / raw)
  To: Philip Hudson; +Cc: emacs orgmode-mailinglist

Philip Hudson <phil.hudson@iname.com> writes:

> On 4 June 2016 at 02:23, Samuel Wales <samologist@gmail.com> wrote:
>> over many years, i have been trying to get org-protocol (or
>> anything similar) to work, and it is not working reliably.
>> that's why i want this feature to work so much.
> ...
>>   *what is the most reliable set of instructions or code to
>>   get iceweasel to work with org?*
>
> Ordinarily my advice would be: Don't. Use Conkeror instead.
>
> However, I see that keyboard-orientation and JavaScript are exactly
> what you don't want, which is a pity. Org-capture from Conkeror is
> bulletproof for me, even with Emacs server running on a different host
> on the same LAN segment.
>
> Conkeror uses the same browser engine as Firefox, so some FF
> extensions work with it, but with an "Emacsified" keyboard-oriented
> front end (M-x, M-:, C-u, C-g, etc) -- all dynamically configurable
> and extensible, though in JavaScript not Elisp. The JavaScripting
> framework uses familiar Elisp idioms wherever possible, like hooks,
> `provide' and `require', for example.

Conkeror is great. I used it for over seven years. However, I think it's
important to note (for anyone thinking of investing time in setting it
up) that conkeror's future is uncertain given Mozilla's planned
deprecation of XUL, its abandonment of xulrunner, and its lack of
official support for using Firefox's browser engine to run third party
apps. This is what a Mozilla developer said in response to a broken -app
flag (which conkeror requires to run) in FF 48 nightly: "This bug isn't
high on the official Mozilla priority list. We don't use -app or have
any testing for it, so it's likely to break."[fn:1] Conkeror is still a
good browser, but if you switch to it, expect to find several broken
features (viewing page source and text files internally, managing
permissions, etc.) and more turbulence in the future.

Matt

[fn:1] https://bugzilla.mozilla.org/show_bug.cgi?id=1271574

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [OT] Re: capture with iceweasel/firefox -- nothing works
  2016-06-04 20:53   ` [OT] " Matt Lundin
@ 2016-06-04 23:01     ` Philip Hudson
  0 siblings, 0 replies; 17+ messages in thread
From: Philip Hudson @ 2016-06-04 23:01 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs orgmode-mailinglist

This is moving OT, but bear with me briefly please if you all would, I
do (kind of) get back to the OP's concerns at the end.

On 4 June 2016 at 21:53, Matt Lundin <mdl@imapmail.org> wrote:
>
> I think it's
> important to note (for anyone thinking of investing time in setting it
> up) that conkeror's future is uncertain given Mozilla's planned
> deprecation of XUL, its abandonment of xulrunner, and its lack of
> official support for using Firefox's browser engine to run third party
> apps.

Sad but true. However, we can at least be sure that nobody can take
away the existing Firefox/Xulrunner code base. That's the glory of
freedom-respecting software. Forking it is easy. Maintaining it and
keeping feature-parity is another matter, of course.

> This is what a Mozilla developer said in response to a broken -app
> flag (which conkeror requires to run) in FF 48 nightly: "This bug isn't
> high on the official Mozilla priority list. We don't use -app or have
> any testing for it, so it's likely to break."[fn:1]

That made my heart stop. Thankfully, it seems they have found the bug,
and more importantly, they seem to have willingly put in the required
effort. Happily, they had the original author of the problematic code
on hand. The (very simple) fix is in review. Apparently the defect was
always there (for at least 5 years), but by luck never bit anyone
before.

> [fn:1] https://bugzilla.mozilla.org/show_bug.cgi?id=1271574

Could lispkit be the next best thing? This might meet the OP's
no-JavaScript requirement at least -- and even better, it's Lisp too
-- but it's WebKit-based (Safari's innards, rather than Firefox's) and
also keyboard-oriented. The Lisp is Common Lisp, not Emacs Lisp, which
is a Good Thing to my way of thinking but does mean there are a few
gotchas to watch out for coming from an Elisp background.

https://github.com/AeroNotix/lispkit

-- 
Phil Hudson                   http://hudson-it.ddns.net
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04  5:13   ` Samuel Wales
  2016-06-04 15:11     ` Matt Lundin
@ 2016-07-21 10:01     ` Adam Porter
  1 sibling, 0 replies; 17+ messages in thread
From: Adam Porter @ 2016-07-21 10:01 UTC (permalink / raw)
  To: emacs-orgmode

Samuel Wales <samologist <at> gmail.com> writes:
 
> however, i never found any good instructions on what to do to add js
> to bookmarks.
> i have a menu bar and a location bar + icons.  i'd like a button or
> icon on the latter if possible.  my previous thrashing around caused a
> >> symbol which is a drop down menu which contains the bookmarks.
> i'll settle for that if nec.  but that is extra clicking i'd rather
> avoid, and one of them brings up a page with js on it.
> 
> is this knowledge something that everybody except me possesses?  :)

Sorry for the late reply; I haven't been watching the list lately and I
missed this thread.  But in case this helps Samuel or anyone else:

When I was putting together org-protocol-capture-html, I spent some time
testing and refining the instructions to set up org-protocol correctly. 
They can be found here:

https://github.com/alphapapa/org-protocol-capture-html#org-protocol-instructions

Also, Samuel, you said elsewhere in the thread that you wanted to be able to
capture to Org like this:

* [[link][title]]
Selected text

And that's exactly what org-protocol-capture-html does.  You said you only
have a limited amount of time and weren't sure if it was worth trying. 
Well, I think it is, but of course I am biased.  ;)  But if you have any
problems, just post an issue on the tracker and I'll be glad to help you if
I can.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-06-04 15:11     ` Matt Lundin
@ 2016-09-04  3:23       ` Samuel Wales
  2016-09-12 23:14         ` Adam Porter
  0 siblings, 1 reply; 17+ messages in thread
From: Samuel Wales @ 2016-09-04  3:23 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode

i tried your instructions.  thank you very much for spelling
it out so explicitly for me.

unfortunately, they don't work.

i am using debian jessie firefox.  i put the desktop file as
you stated, and added the bookmark as you stated.

then i tested it on the gmail tab with nothing selected.  it
went to a new location in firefox (i expected it to do
nothing in firefox).  this new location is like this in the
url bar:

  javascript:"org-protocol://capture?url=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2Fh%2Fhtsxxrphy06a%2F%3F%26&title=Gmail
- Inbox&body="

and the tab contents has a grey background and like this text:

  "org-protocol://capture?url=https://mail.google.com/mail/u/0/h/htsxxrphy06a/?&&title=Gmail
- Inbox&body=

if i hit the back button in firefox i get gmail again.

as for emacs, it has a new buffer that is visiting like this
file:

  /home/samuel/org-protocol:/capture?url=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2Fh%2Fhtsxxrphy06a%2F%3F%26&title=Gmail%20-%20Inbox&body=

the value of org-protocol-default-template-key is nil.  so i
tried changing it to "p" and "L" which have templates.

then i tried it on another site with a selection.  it popped
up emacs (i do not want this and my templates are set to
immediately finish) and said:

  Use M-x make-directory RET RET to create the directory and its parents
  When done with a buffer, type C-x #

it also created a blank buffer visiting a file.

then i tried it on a few other sites, and got similar
results, but sometimes with slight differences.

so i am still lost.

interstitial:

On 6/4/16, Matt Lundin <mdl@imapmail.org> wrote:
>> will try.  this is supposed to imitate clicking on the unicorn or
>> calling the bookmark?
>
> This is the content of the bookmark. Pasting it into the location bar is
> just a quick way to test if everything is working prior to saving it
> permanently as a bookmark. But it might be easier to go straight to the
> bookmark step (see below).

ok

> Do you mean clicking on the unicorn icon installed with this extension?
>
> https://addons.mozilla.org/en-US/firefox/addon/org-mode-capture/
>
> If you have installed that extension, I think everything should just
> work with minimal configuration. The extension is distinct from the

i have installed that extension.  it fails most of the time, just like
the 2 bookmarks i tried fail most of the time.  when it stops working
it really stops working.  when it is working, it's maybe 50%.  but
sometimes it has runs of working.

> universal. Once you get it set up the protocol system-wide, the bookmark
> should work in any browser.

ah.

> To save it as a bookmark in firefox, right click on the bookmark bar,
> select "New Bookmark," and paste it into the Location field.
>
>> do i try with selecting and without selecting?
>
> The bookmark should work with and without selections.
>
>> which capture key does it call?
>
> This can be controlled with the emacs variable
> `org-protocol-default-template-key'. You can also specify a template
> shortcut by changing the bookmark. For instance, to call a template
> designated by "x", you could use the following:
>
> javascript:location.href='org-protocol://capture?template=x&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())
>
> Matt
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-09-04  3:23       ` Samuel Wales
@ 2016-09-12 23:14         ` Adam Porter
  2016-09-20  1:38           ` Samuel Wales
  0 siblings, 1 reply; 17+ messages in thread
From: Adam Porter @ 2016-09-12 23:14 UTC (permalink / raw)
  To: emacs-orgmode

Samuel, in case you missed it, you might find this message helpful:

Message-ID: <loom.20160721T115626-393@post.gmane.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: capture with iceweasel/firefox -- nothing works
  2016-09-12 23:14         ` Adam Porter
@ 2016-09-20  1:38           ` Samuel Wales
  0 siblings, 0 replies; 17+ messages in thread
From: Samuel Wales @ 2016-09-20  1:38 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

On 9/12/16, Adam Porter <adam@alphapapa.net> wrote:
> Samuel, in case you missed it, you might find this message helpful:
>
> Message-ID: <loom.20160721T115626-393@post.gmane.org>

i don't have a client that reads message ids but i presume you mean
the alphapapa github package suggestion earlier in this thread.  i
will try that, thank you.

i should point out that trying the instructions in this thread has
left my firefox in an even worse state: capture does not work at all,
whereas before it was intermittent.  i followed them exactly, as far
as i know.

now every capture i make with org-capture extension OR the bookmark i
tried before OR the bookmark suggested in this thread creates a buffer
with the name like listed at the end here:

Greedy org-protocol handler.  Killing client.
No server buffers remain to edit
Use M-x make-directory RET RET to create the directory and its parents
When done with a buffer, type C-x #
/home/tsugi/org-protocol:/capture-html:/w/https%3A%2F%2Fwww.masteringemacs.org%2Farticle%2Fwhats-new-in-emacs-25-1/What's%20New%20in%20Emacs%2025.1%20-%20Mastering%20Emacs/For%20example%2C%20to%20get%20the%20old%20behavior%20--%20'*shell*'%20buffer%20displays%20in%20current%20window%20--%20use%20(add-to-list%20'display-buffer-alist%20%20%20%20%20%20'(%22%5E%5C%5C*shell%5C%5C*%24%22%20.%20(display-buffer-same-window))).

i wish i could get capture to work.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-09-20  1:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-04  1:23 capture with iceweasel/firefox -- nothing works Samuel Wales
2016-06-04  1:30 ` Samuel Wales
2016-06-04  1:33   ` Samuel Wales
2016-06-04  3:04     ` Xebar Saram
2016-06-04  4:05       ` Matt Lundin
2016-06-04  3:56 ` Matt Lundin
2016-06-04  4:00   ` Matt Lundin
2016-06-04  5:13   ` Samuel Wales
2016-06-04 15:11     ` Matt Lundin
2016-09-04  3:23       ` Samuel Wales
2016-09-12 23:14         ` Adam Porter
2016-09-20  1:38           ` Samuel Wales
2016-07-21 10:01     ` Adam Porter
2016-06-04  8:26 ` tumashu
2016-06-04 12:03 ` Philip Hudson
2016-06-04 20:53   ` [OT] " Matt Lundin
2016-06-04 23:01     ` Philip Hudson

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).