alphapapa/org-protocol-capture-html

cant get it to work (yeah i know its a general discription :))

Opened this issue · 14 comments

Hi again :)

ok so i followed all the steps (as best as i could :)) and cant get it to work, and not 100% sure at which stage its failing :)

anyway..i have these relevant parts in my emacs init

(require 'org-protocol)
(require 'org-capture)
(add-to-list 'load-path "/home/zeltak/.emacs.g/org-protocol-capture-html/")
(require 'org-protocol-capture-html) 

also added the appropriate capture template to my capture list

("w" "Web site" entry
  (file "")
  "* %a :website:\n\n%U %?\n\n%:initial")

i have the ~/.local/share/applications/org-protocol.desktop entry

and in FF added the network.protocol-handler.expose.org-protocol and set it to true

also added the relevant basic bookmarklet.

yet when i issue the bookmarklet nothing happens

any clue whatsoever how to try and debug this :-)

thx again

Z
PS ...OFF-TOPIC but org-protocol is such a pain in the arse...could never get it working ;-)

Hmm. Well, I hate to be "that guy," but I think the first thing I would try is to remove all of the configuration you did and start from scratch. As far as I know, if you follow the directions precisely, it will work. I've gone over them several times, and it seems like other people have gotten it to work by following them. I know it seems confusing--sometimes it still does to me--but they should work.

Well, one thing I would try first: use the shell script and see if it causes Emacs to open a capture buffer like it should. If it does, you know the problem is with Firefox or the protocol handler. If it doesn't, maybe the problem is with Emacs.

and in FF added the network.protocol-handler.expose.org-protocol and set it to true

I don't think this is necessary with current Firefox versions, but I left it in there just in case someone is on an older version. I think it will still work, but I would try without it first.

Also, I noticed that you didn't mention using kbuildsycoca4 or update-desktop-database. That might be the issue.

Let me know what you find. :)

Did you have any luck?

Hi alphapapa

sorry for the late response but i had a crazy time at work past 2 months..now i can breathe a bit :)

so i tried your suggestion of using the shell scrip to see if that works. this does open a emacs cleint but not the capture buffer.
this is the output:

Waiting for Emacs...^C                                                                                             
zeltak@zx1voics bin ↳ org-protocol-capture-html.sh --readability --url "https://lwn.net/Articles/615220/"  master⚡ 
  File "<string>", line 1                                                                                          
    import sys, urllib; print urllib.quote(sys.stdin.read(), safe='')                                              
                                   ^                                                                               
SyntaxError: invalid syntax                                                                                        
  File "<string>", line 1                                                                                          
    import sys, urllib; print urllib.quote(sys.stdin.read(), safe='')                                              
                                   ^                                                                               
SyntaxError: invalid syntax                                                                                        
  File "<string>", line 1                                                                                          
    import sys, urllib; print urllib.quote(sys.stdin.read(), safe='')                                              
                                   ^                                                                               
SyntaxError: invalid syntax                                                                                        
Waiting for Emacs...                                                                                               

does this syntax error mean anything?

anyway i now have more time and would love to debugg this :)

best

Z

Hey Z, no problem, I'll help when we both have time.

What you're seeing there is an error from Python. What version of Python do you have installed, and what OS are you running on?

Anyway, that is a separate problem from the one with the bookmarklet, because it doesn't go through the shell script or Python. But maybe if you can get the shell script working, it will help with figuring out the other problem.

Hi again. im using up to date arch linux with python version 3.5.2 and python2 2.7.11

thx

z

Which Python is linked to /usr/bin/python? If it's Python 3, that's probably the problem.

yup its python 3. so some progress i changed the python path in the script to python2 and the script does launch now:

eltak@zx1voics ZH_tmp ↳ ./org-protocol-capture-html.sh -u www.cnn.com                                                                                                                                                         master⚡
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Waiting for Emacs...^C

bit all that happens is a empty emacsclient opens up? what should i do next?

thx!

Z

Hi Z,

There is a limit to how much data can be passed to emacsclient through command line args, and trying to capture the entire cnn.com home page probably exceeds that limit. Try capturing a smaller page, or just some text directly, and see if that works.

hi again

ok i created a simple html file with and tried again yet it still acts the same and says Waiting for Emacs..

zeltak@zx1voics ZH_tmp ↳ ./org-protocol-capture-html.sh -u file:///home/zeltak/ZH_tmp/expenses.bresicajuly2016.htm

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                   
                                 Dload  Upload   Total   Spent    Left  Speed                                     
100 10401  100 10401    0     0   381M      0 --:--:-- --:--:-- --:--:--  381M                                    
Waiting for Emacs...^C                                                                                            
zeltak@zx1voics ZH_tmp ↳                                                                                   master⚡

anything else to try?

Well, according to the --help message (had to look it up because I forgot), "If only URL is given, it will be downloaded and its contents used." And I don't know if a file:// URL will work with curl. Try a simple HTTP URL to a simple web page.

If that doesn't work, try running this command:

emacsclient "org-protocol://capture-html://w/example.com/TEST HEADING/<b>This text should be bold.</b>"

If even that does not work, then I'm about out of ideas. It works fine for me, and I know other people are using it without any problems. The only other suggestion I can think of is to make a new user account on the system, log in as that user, install everything following the directions in the readme to the letter, and see if it works then.

Any updates on this bug? :)

hi alphapapa, how are you?

not yet i will explore it again next week when i have a bit more thime

thx!

Z

Ok so some updates :)

it now seems to open an emacs frame named "fundamental" when i run this

./org-protocol-capture-html.sh -u www.cnn.com

does that make any sense?

Z

Um...no, not really, haha. :) That seems bizarre.

At this point I think the only thing to do is to try with a clean Emacs configuration. Install only Org and this package and see if it works correctly. (i.e. just run emacs -Q, then (require 'org), then (require 'org-protocol) (or maybe you'll have to load-file it), then (load-file "org-protocol-capture-html.el"), then run the script.