diff options
-rw-r--r-- | eww-conf.el | 34 | ||||
-rw-r--r-- | org-conf.el | 4 |
2 files changed, 34 insertions, 4 deletions
diff --git a/eww-conf.el b/eww-conf.el index 3faa82d..1f6ff46 100644 --- a/eww-conf.el +++ b/eww-conf.el @@ -396,11 +396,34 @@ For the meanings of NAME and DIR, see the documentation of ;;; Bookmark integration -;; This section defines functions to make bookmarks for EWW buffers -;; and to jump to those bookmarks. +;;;; Readbable mode distinction + +;; This section modifies the behaviour of `eww-readable' so that when +;; we are viewing readable parts of the webpage, there is a variable +;; saying so. + +(defvar durand-eww-readable-p nil + "If non-nil, we are viewing the readable parts of a webpage.") + +(make-variable-buffer-local 'durand-eww-readable-p) + +(defun eww-non-readable-h () + "Set `durand-eww-readable-p' to nil." + (setq-local durand-eww-readable-p nil)) + +(defun eww-readable-h () + "Set `durand-eww-readable-p' to t." + (setq-local durand-eww-readable-p t)) + +(add-hook 'eww-after-render-hook #'eww-non-readable-h) + +(advice-add #'eww-readable :after #'eww-readable-h) ;;;; Making records +;; This section defines functions to make bookmarks for EWW buffers +;; and to jump to those bookmarks. + (defun durand-eww-bookmark-make-record () "Return a bookmark record for the current page." (cond @@ -409,6 +432,7 @@ For the meanings of NAME and DIR, see the documentation of (let* ((url (plist-get eww-data :url)) (title (format "(EWW) %s" (plist-get eww-data :title))) (position (point)) + (readablep durand-eww-readable-p) (defaults (delq nil (list 'defaults title url)))) (cond ((null url) (user-error "No link for the current page"))) @@ -417,6 +441,7 @@ For the meanings of NAME and DIR, see the documentation of title (cons 'location url) (cons 'handler #'durand-eww-bookmark-jump) + (cons 'readablep readablep) defaults) (bookmark-make-record-default 'no-file nil position)))) @@ -526,6 +551,11 @@ Otherwise, fetch URL and afterwards try to restore the point." (lambda () (remove-hook 'eww-after-render-hook function-symbol) + ;; if the bookmark records a readable webpage, + ;; enter readable mode again. + (cond + ((bookmark-prop-get bookmark 'readablep) + (eww-readable))) (bookmark-default-handler (list "" (cons 'buffer buffer) diff --git a/org-conf.el b/org-conf.el index f964d3c..cec2d41 100644 --- a/org-conf.el +++ b/org-conf.el @@ -736,8 +736,8 @@ TITLE is the title of the sitemap. REP is a representation of the files and directories in the project. Use such functions as `org-list-to-org' or `org-list-to-subtree' to transform it." - (format "#+TITLE: %s\n#+AUTHOR: JSDurand\n%s#+DATE: <%s>\n\n%s\n\n\ -#+ATTR_HTML: :border nil :rules nil :frame nil\n\ + (format "#+TITLE: %s\n#+AUTHOR: JSDurand\n%s\n#+DATE: <%s>\n\n%s\n\ +\n#+ATTR_HTML: :border nil :rules nil :frame nil\n\ %s\n\n\ [[https://jsdurand.xyz/%s][Web feed]]" title |