alphapapa / alphapapa/org-protocol-capture-html

URL in buffer name, not capturing

Aperta
#27 24 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Emacs Lisp
Stelle
461
Fork
41
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This is a similar issue to #26 "Strange emacs buffer instead of capture buffer".

Ubuntu 17.10
Emacs 25.2.2
Chrome and Firefox
emacs -Q

```

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)

(package-install 's)
(add-to-list 'load-path "~/tmp/org-protocol-capture-html")

(require 'org)
(require 'org-capture)
(require 'org-protocol)
(require 'org-protocol-capture-html)
(server-start)

(setq org-capture-templates
'(
("l" "Org-protocol link" entry (file "notes.org") (file "~/.org.d/templates/link.tpl"))
("w" "Web site" entry (file "") "* %a :website:\n\n%U %?\n\n%i")
)

```

This works for the `l` command:

```
javascript:(function () { window.location.href='org-protocol://capture://l/' +encodeURIComponent(window.location.href)+'/' +encodeURIComponent(document.title)+'/' +encodeURIComponent(window.getSelection()); })();
```

but this one does not:
```
javascript:location.href = 'org-protocol://capture-eww-readable?template=w&url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title || "[untitled page]");
```

I just get this buffer name:

```
?template=w&url=https%3A%2F%2Fgithub.com%2Falphapapa%2Forg-protocol-capture-html&title=alphapapa%2Forg-protocol-capture-html%3A%20Capture%20HTML%20from%20the%20browser%20selection%20into%20Emacs%20as%20org-mode%20content
```
Tried debugging a bit

This works, `(org-protocol-capture-html--url-html "http://github.com")`.

But not sure what I'm supposed to pass to `org-protocol-capture-html--capture-eww-readable`, if that's the right way to proceed.

Alternatively, since `org-protocol://capture:` works, I should be able to just use a `%(...)` function call in my template file, but I'm not sure what function to put there (or what its arguments should be).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.