summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--init.org22
-rw-r--r--org.org12
-rw-r--r--w3m.org2
3 files changed, 26 insertions, 10 deletions
diff --git a/init.org b/init.org
index 8fdb808..8c8f510 100644
--- a/init.org
+++ b/init.org
@@ -2315,16 +2315,22 @@
(shr-max-width 130)
(shr-blocked-images ".*")
(shr-max-image-proportion 0.9))
+
:config
- (defun prot-eww--rename-buffer ()
- (let ((name (if (eq "" (plist-get eww-data :title))
- (plist-get eww-data :url)
- (plist-get eww-data :title))))
+ (with-eval-after-load "org" (require 'ol-eww nil t))
+
+ (defun jao-eww--title ()
+ (if (eq "" (plist-get eww-data :title))
+ (plist-get eww-data :url)
+ (plist-get eww-data :title)))
+
+ (defun jao-eww--rename-buffer ()
+ (let ((name (jao-eww--title)))
(rename-buffer (format "*%s # eww*" name) t)))
- (add-hook 'eww-after-render-hook #'prot-eww--rename-buffer)
- (advice-add 'eww-back-url :after #'prot-eww--rename-buffer)
- (advice-add 'eww-forward-url :after #'prot-eww--rename-buffer)
+ (add-hook 'eww-after-render-hook #'jao-eww--rename-buffer)
+ (advice-add 'eww-back-url :after #'jao-eww--rename-buffer)
+ (advice-add 'eww-forward-url :after #'jao-eww--rename-buffer)
(defun jao-eww--close ()
(interactive nil eww-mode)
@@ -2353,7 +2359,9 @@
("r" . eww-reload)
("S" . jao-eww-session-load)
("W" . jao-eww--close)
+ ("w" . org-eww-copy-for-org-mode)
("x" . jao-rss-subscribe)
+ ("y" . eww-copy-page-url)
("C-c C-w" . jao-eww--close))))
(defun jao-eww-browse-url (url &rest r)
diff --git a/org.org b/org.org
index ef26654..30a00f7 100644
--- a/org.org
+++ b/org.org
@@ -228,13 +228,19 @@
#+begin_src emacs-lisp
(require 'org-gnus nil t)
(require 'ol-gnus nil t)
- (require 'ol-w3m nil t)
(require 'ol-eshell nil t)
(require 'ol-bbdb nil t)
(require 'ol-docview nil t)
(require 'ol-info nil t)
-
(setq org-link-abbrev-alist '(("jao.io" "https://jao.io/")))
+
+ (defun jao-insert-eww-link ()
+ "Look for last eww buffer and insert an org link to it."
+ (interactive)
+ (when-let (b (car (last (jao-eww-session--list-buffers))))
+ (let ((lnk (with-current-buffer b
+ (format "[[%s][%s]]" (eww-current-url) (jao-eww--title)))))
+ (insert lnk))))
#+end_src
* jao-org
#+begin_src emacs-lisp
@@ -263,7 +269,7 @@
(define-key org-mode-map "\C-cv" 'jao-org-copy-link-at-point)
(define-key org-mode-map [(control ?c) tab] 'org-force-cycle-archived)
(define-key org-mode-map [(f7)] 'org-archive-to-archive-sibling)
- (define-key org-mode-map "\C-cW" 'jao-insert-w3m-link)
+ (define-key org-mode-map "\C-cW" 'jao-insert-eww-link)
(define-key org-mode-map "\C-c'" 'org-edit-src-code)
(define-key org-mode-map "\C-co" 'outline-hide-other)
(global-set-key "\C-cr" 'org-capture)
diff --git a/w3m.org b/w3m.org
index dc25c98..e169e28 100644
--- a/w3m.org
+++ b/w3m.org
@@ -36,6 +36,8 @@
w3m-use-favicon nil
w3m-use-header-line nil
w3m-use-refresh nil)
+
+ (with-eval-after-load 'org (require 'ol-w3m nil t))
(setq jao-browse-url-function 'jao-w3m-browse-url)
:config (defalias 'jao-goto-w3m-frame 'jao-afio--goto-www)
:bind (:map w3m-mode-map (("C-c C-@" . tracking-next-buffer)