alphapapa / alphapapa/org-protocol-capture-html

URL in buffer name, not capturing

Ouverte
#27 24 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Emacs Lisp
Étoiles
461
Forks
41
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.