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 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'init.org') 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) -- cgit v1.2.3