Remove obsolete "Qutebrowser userscript" section
This commit is contained in:
parent
f30a790b01
commit
17a25a336c
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,7 +19,6 @@ example.py
|
||||
init.el
|
||||
latexmkrc
|
||||
nuggy.py
|
||||
org-store-link
|
||||
property-syntax-demonstration.org
|
||||
pyproject.toml
|
||||
variables.el
|
||||
|
43
README.org
43
README.org
@ -1118,12 +1118,9 @@ Listing [[lst:configure-keycast]] configures =keycast=.
|
||||
|
||||
Emacs can act as a server that listens to a socket to share its state (for
|
||||
instance buffers and command history) with other programs by means of a shell
|
||||
command =emacsclient=. Section [[#sec:latexmk-save-compile-display-loop]] and
|
||||
[[#sec:qutebrowser-userscript]] show how to use ~emacsclient~ to:
|
||||
1. Install an asynchronous (or background) loop of saving a LaTeX file,
|
||||
compiling it, and redisplaying the output in Emacs.
|
||||
2. Make [[https://qutebrowser.org][qutebrowser]] send html links with document titles to Emacs.
|
||||
The code in listing [[lst:start-emacs-server]] starts the Emacs server.
|
||||
command =emacsclient=. Section [[#sec:latexmk-save-compile-display-loop]] how to
|
||||
use ~emacsclient~ to install an asynchronous (or background) loop of saving a
|
||||
LaTeX file, compiling it, and redisplaying the output in Emacs.
|
||||
|
||||
#+caption[Start the Emacs server]:
|
||||
#+caption: Start the Emacs server.
|
||||
@ -1174,40 +1171,6 @@ sub makeglossaries {
|
||||
# End:
|
||||
#+end_src
|
||||
|
||||
** [[https://qutebrowser.org/doc/userscripts.html][Qutebrowser userscript]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:qutebrowser-userscript
|
||||
:END:
|
||||
|
||||
The next block contains an userscript that sends a [[info:org#The store-link protocol][store-link org-protocol]]
|
||||
message with the url and the title from [[https://qutebrowser.org][qutebrowser]] to =emacsclient=. The
|
||||
function =urlencode= translates the url and the title for the message. The
|
||||
[[info:python#Examples<22>][Python urllib examples]] show how to use =urlencode=. The final =execvp= call
|
||||
deals with a [[https://qutebrowser.org][qutebrowser]] userscript requirement: the =emacsclient= process must
|
||||
get the PID of the userscript that must kill itself after the take-over.
|
||||
Termination of the =emacsclient= process hands control back to [[https://qutebrowser.org][qutebrowser]].
|
||||
|
||||
On a [[https://en.wikipedia.org/wiki/POSIX][POSIX]] system, you can run the userscript from [[https://qutebrowser.org][qutebrowser]] or from a
|
||||
terminal to see whether it works. In case you try to run it from Emacs, Emacs
|
||||
may hang or die.
|
||||
|
||||
#+caption[Tangle a qutebrowser userscript]:
|
||||
#+caption: Tangle a qutebrowser userscript.
|
||||
#+header: :comments no
|
||||
#+header: :tangle-mode (identity #o755)
|
||||
#+name: lst:qutebrowser-userscript
|
||||
#+begin_src python -n :eval never :tangle org-store-link
|
||||
#!/usr/bin/env python
|
||||
from urllib.parse import urlencode
|
||||
from os import environ, execvp
|
||||
|
||||
url = environ.get("QUTE_URL", "https://orgmode.org")
|
||||
title = environ.get("QUTE_TITLE", "Org Mode")
|
||||
parameters = urlencode({"url": url, "title": title})
|
||||
print(payload := f"org-protocol://store-link?{parameters}")
|
||||
execvp("emacsclient", ("-n", payload))
|
||||
#+end_src
|
||||
|
||||
** TODO Org-protocol handling with other browser on Darwin :noexport:
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:org-protocol-darwin
|
||||
|
Loading…
Reference in New Issue
Block a user