alphapapa / alphapapa/org-protocol-capture-html

URL in buffer name, not capturing

未关闭
#27 24 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Emacs Lisp
星标
461
派生
41
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。