summaryrefslogtreecommitdiffhomepage
path: root/eww.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-05-20 02:48:46 +0100
committerjao <jao@gnu.org>2021-05-20 02:48:46 +0100
commit9235eb0e986235cc71bf2addc6a161ff2f524ab6 (patch)
tree50a59e0c61b904285ad1e11aa39d726af5ef7a57 /eww.org
parent95b95acb5eb314e692de770c24a584031485ba68 (diff)
downloadelibs-9235eb0e986235cc71bf2addc6a161ff2f524ab6.tar.gz
elibs-9235eb0e986235cc71bf2addc6a161ff2f524ab6.tar.bz2
clean-ups
Diffstat (limited to 'eww.org')
-rw-r--r--eww.org72
1 files changed, 0 insertions, 72 deletions
diff --git a/eww.org b/eww.org
index 2aa5dcf..e2e9ae5 100644
--- a/eww.org
+++ b/eww.org
@@ -30,21 +30,6 @@
(mm-shr handle)))
(setq mm-text-html-renderer 'jao-eww-html-renderer)
#+end_src
-* Buffer names
- #+begin_src emacs-lisp
- (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 (truncate-string-to-width (jao-eww--title) 90 nil nil t)))
- (rename-buffer (format "*%s # eww*" name) t)))
-
- (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)
- #+end_src
* Opening URLs
#+begin_src emacs-lisp
(defun jao-eww-browse (arg)
@@ -99,63 +84,6 @@
(interactive)
(jao-eww-reopen t))
#+end_src
-* Visiting links in a page
- #+begin_src emacs-lisp
- (defun jao-eww-copy-link ()
- (interactive)
- (when-let (lnk (or (car (eww-links-at-point)) (eww-current-url)))
- (message "%s" lnk)
- (kill-new lnk)))
-
- (defun jao-eww--at-link ()
- (and (get-text-property (point) 'shr-url)
- (not (get-text-property (point) 'eww-form))))
-
- (defun jao-eww--previous-url ()
- (text-property-search-backward 'shr-url nil nil t))
-
- (defun jao-eww--pp-link ()
- (format "%s @ %s"
- (button-label (point))
- (propertize (get-text-property (point) 'shr-url) 'face 'link)))
-
- (defun jao-eww-visit-url-on-page (&optional arg)
- "Visit URL from list of links in the page using completion."
- (interactive "P")
- (when (derived-mode-p 'eww-mode)
- (let ((links))
- (save-excursion
- (goto-char (point-max))
- (while (jao-eww--previous-url)
- (when (jao-eww--at-link) (push (jao-eww--pp-link) links))))
- (let* ((selection (completing-read "Browse: " links nil t))
- (url (replace-regexp-in-string ".*@ " "" selection)))
- (eww url (if arg 4 nil))))))
-
- (defun jao-eww-jump-to-url-on-page ()
- "Jump to URL position in the page using completion."
- (interactive)
- (when (derived-mode-p 'eww-mode)
- (let ((links))
- (save-excursion
- (goto-char (point-max))
- (while (jao-eww--previous-url)
- (when (jao-eww--at-link)
- (push (format "%s ~ %d" (jao-eww--pp-link) (point)) links))))
- (let* ((selection (completing-read "Jump to URL in page: " links nil t))
- (position (replace-regexp-in-string ".*~ " "" selection))
- (point (string-to-number position)))
- (goto-char point)))))
-
- (defun jao-eww--append-html (oldfn &rest args)
- (let ((p (apply oldfn args)))
- (when (stringp p)
- (let ((r (if (string-match-p ".*\\.html$" p) p (concat p ".html"))))
- (kill-new (format "[[doc:%s]]" r))
- r))))
-
- (advice-add 'eww-make-unique-file-name :around #'jao-eww--append-html)
- #+end_src
* eww-lnum
#+begin_src emacs-lisp
(use-package eww-lnum :ensure t)