summaryrefslogtreecommitdiffhomepage
path: root/custom/jao-custom-eww.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2024-10-19 19:40:21 +0100
committerjao <jao@gnu.org>2024-10-19 19:40:21 +0100
commit6203f490e8747977c0dfdb797cd46327fe7c63dd (patch)
tree9e8309ea8ce8a15dce96087554237f4fd276d583 /custom/jao-custom-eww.el
parent22b6c1dd68436d18f16e0e65dc53f85db89e4c0c (diff)
downloadelibs-6203f490e8747977c0dfdb797cd46327fe7c63dd.tar.gz
elibs-6203f490e8747977c0dfdb797cd46327fe7c63dd.tar.bz2
notes: capture org note from eww instead of tmp buffer
Diffstat (limited to 'custom/jao-custom-eww.el')
-rw-r--r--custom/jao-custom-eww.el25
1 files changed, 12 insertions, 13 deletions
diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el
index a3f4df9..987040f 100644
--- a/custom/jao-custom-eww.el
+++ b/custom/jao-custom-eww.el
@@ -121,11 +121,11 @@
(let ((shr-width 80)) (eww-readable)))
(let* ((start (if (org-region-active-p) (region-beginning) (point-min)))
(end (if (org-region-active-p) (region-end) (point-max)))
- (buff (or dest (generate-new-buffer "*eww-to-org*")))
(link (eww-current-url))
- (title (or (plist-get eww-data :title) "")))
+ (title (plist-get eww-data :title))
+ (buff (save-current-buffer (or dest (jao-org-notes-create title)))))
(with-current-buffer buff
- (insert "#+title: " title "\n#+link: " link "\n\n")
+ (insert "#+link: " link "\n\n")
(org-mode))
(save-excursion
(goto-char start)
@@ -183,6 +183,15 @@ It should be the title of the web page as returned by `rdrview'"
(if eww-rdrview-mode (eww-rdrview-mode -1)
(eww-rdrview-mode 1))
(eww-reload))
+;;; auto-readable
+(defvar jao-eww-auto-readable-urls
+ (regexp-opt '("guardian.co.uk" "theguardian.com" "github.com" "eldiario.es")))
+
+(defun jao-eww-autoread ()
+ (when (string-match-p jao-eww-auto-readable-urls (or (eww-current-url)))
+ (eww-readable)))
+
+(add-hook 'eww-after-render-hook #'jao-eww-autoread)
;;; package
(use-package shr
:custom ((shr-width nil)
@@ -246,16 +255,6 @@ It should be the title of the web page as returned by `rdrview'"
("C-c C-w" . jao-eww-close)
("M-i" . eww-toggle-images))))
-;;; auto-readable
-(defvar jao-eww-auto-readable-urls
- (regexp-opt '("guardian.co.uk" "theguardian.com" "github.com" "eldiario.es")))
-
-(defun jao-eww-autoread ()
- (when (string-match-p jao-eww-auto-readable-urls (or (eww-current-url)))
- (eww-readable)))
-
-(add-hook 'eww-after-render-hook #'jao-eww-autoread)
-
;;; fixes for shr image rendering
(require 'shr)