From 39538d29efcbd4fecc31d1ea27f9b7ae4f273318 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 29 Mar 2021 01:06:55 +0100 Subject: lazier w3m loading (if at all) --- init.org | 18 ++++++++---------- lib/eos/jao-afio.el | 5 ++++- org.org | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/init.org b/init.org index 8c8f510..804e319 100644 --- a/init.org +++ b/init.org @@ -1270,10 +1270,10 @@ (setq line-move-visual t) (use-package iscroll :ensure t :diminish) - (with-eval-after-load "w3m" - (add-hook 'w3m-mode-hook #'iscroll-mode)) (with-eval-after-load "gnus-art" (add-hook 'gnus-article-mode #'iscroll-mode)) + (with-eval-after-load "eww" + (add-hook 'eww-mode-hook #'iscroll-mode)) #+END_SRC *** Splitting and switch #+begin_src emacs-lisp @@ -1295,7 +1295,6 @@ #+begin_src emacs-lisp :load no (use-package switch-window :ensure t - :demand t :custom ((switch-window-minibuffer-shortcut ?z) (switch-window-background t) (switch-window-shortcut-style 'qwerty) @@ -1329,8 +1328,6 @@ ("C-x 4 d" . jao-switch-window-then-dired) ("C-x 4 f" . jao-switch-window-then-find-file) ("C-x 4 b" . jao-switch-window-then-consult-buffer))) - - (require 'switch-window) #+end_src *** first window and transient other window #+begin_src emacs-lisp @@ -2266,14 +2263,14 @@ (defun jao-rss--find-url () (when (derived-mode-p 'w3m-mode 'eww-mode) (save-excursion - (if (derived-mode-p 'w3m-mode) + (if (fboundp 'w3m-view-source) (w3m-view-source) (eww-view-source)) (goto-char (point-min)) (let* ((m (re-search-forward jao-rss--rss-rx nil t)) (url (and m (match-string 2))) (title (and m (match-string 1)))) - (if (derived-mode-p 'w3m-mode) + (if (fboundp 'w3m-view-mode) (w3m-view-source) (View-quit)) (when url (cons url (or title ""))))))) @@ -2319,6 +2316,7 @@ :config (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) @@ -2383,19 +2381,19 @@ "Visit a URL, maybe from `eww-prompt-history', with completion. With optional prefix ARG (\\[universal-argument]) open URL in the - same buffer. + a new buffer. If URL does not look like a valid link, run a web query using `eww-search-prefix'." (interactive (list - (completing-read "Run EWW on: " + (completing-read (if current-prefix-arg "eww in new buffer: " "eww: ") (setq eww-prompt-history (cl-remove-duplicates eww-prompt-history :test #'string=)) nil nil nil 'eww-prompt-history) current-prefix-arg)) - (eww url (if arg nil 4))) + (eww url (if arg 4 nil))) (defun jao-eww--at-link () (and (get-text-property (point) 'shr-url) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index ab5fd12..d031e59 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -82,6 +82,9 @@ (find-file doc))))))) (defvar jao-afio-use-w3m nil) +(declare w3m "w3m") +(declare w3m-alive-p "w3m") +(declare w3m-previous-buffer "w3m") ;;;###autoload (defun jao-afio-open-www () @@ -165,7 +168,7 @@ (interactive "P") (if (jao-afio--check-frame-p) (jao-afio--goto-frame ?w reset) - (when (w3m-alive-p) + (when (and jao-afio-use-w3m (w3m-alive-p)) (pop-to-buffer (w3m-alive-p))))) (defun jao-afio--try-init (&optional f) diff --git a/org.org b/org.org index 30a00f7..897fc41 100644 --- a/org.org +++ b/org.org @@ -22,7 +22,7 @@ '((gnus . (lambda (&optional x) (jao-open-gnus-frame))) (file . find-file-other-window)) org-log-done nil - org-modules '(bbdb bibtex gnus info w3m) + org-modules '(bbdb bibtex gnus info eww eshell git-link) org-odd-levels-only t org-outline-path-complete-in-steps nil org-refile-allow-creating-parent-nodes 'confirm -- cgit v1.2.3