-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request : eww bookmark integration #347
Comments
Of course, it should be possible to write an eww bookmark source (see multi sources). It is a bit unfortunate that eww does not make use of the standard bookmark facilities by default. The eww source should then be documented in the wiki. We may also consider to add this ootb. Unfortunately adding such an eww source ootb to the list of buffer sources will force loading eww in any case when [[ Unrelated - there seems to be also https://github.com/astoff/devdocs.el - how is this different? cc @astoff ]] |
My devdocs.el package (which is new) doesn't use eww at all (it only uses the underlying HTML rendering engine, shr.el). The mentioned package, https://github.com/skeeto/devdocs-lookup in fact uses a browser (possibly eww), but it's not recent. I don't see how devdocs.el would benefit from any sort of bookmarking, since looking up the bookmark seems to be as much work as searching directly for whatever you need. |
Right. That's a good point. However supporting eww bookmarks in Consult still makes sense. |
@astoff bookmarks exist for a reason. So you don't need to search. I type in "lldb" in my consult-buffer and I see it.. Done. And I'm not talking about devdocs specifically... Any eww bookmarks. Its very convenient to use an in emacs text browser. |
Its a lot more work. devdocs works on a per mode basis for a start (or mine does). And opening up devdocs, searching for a term, getting a myriad of results back and then determining which one it is, is a lot more effort, and less logical, than just jumping to my bookmark "lldb scripting" for example. But as I mentioned before, its not about devdocs, more about eww in general. |
I don't believe it is signficantly more work. Vertico/Selectrum sort by history for completing-read. This means if you have looked up a function once it will be quickly accessible again. Bookmarks are of course are of course useful to keep things accessible for longer. You may still want to give devdocs.el a try. @astoff I think there exist at least three devdocs emacs packages now? You may want to mention these as alternatives in your README with a brief comparison. |
@minad I think we're sidetracked. It's not about devdocs (I linked the one I use). It's simply eww bookmarks. I'm talking from anywhere. I mentioned eww use only in the context that I use it for devdocs too :) and in addition using bookmarks from the all powerful consult-buffer "unified switcher". Hopefully that's clarified it a little. |
@rileyrg No worries. I am aware of what this issue is about. I've already said it is possible - you can add the eww source to the wiki and we may even add it to consult ootb. However there is the issue that this will force loading eww which is undesired. |
I guess this makes sense, yes.
Of course, a completing-read interface for EWW bookmarks makes a lot of sense. Now, concerning devdocs specifically, I believe the devdocs.el package is more efficient than the workflow you described above; I know you're not asking for advice, but you might want to check it out :-). |
What about using normal Emacs bookmarks for eww too? The missing integration is pretty easy to write as you see in the snippet below. I assume bookmark+ contains something like this. I don't really see a point in eww-specific bookmarks honestly. (require 'bookmark)
(require 'eww)
(defun bookmark-eww--make ()
"Make eww bookmark record."
`((filename . ,(plist-get eww-data :url))
(title . ,(plist-get eww-data :title))
(time . ,(current-time-string))
(handler . ,#'bookmark-eww-handler)
(defaults . (,(concat
;; url without the https and path
(replace-regexp-in-string
"/.*" ""
(replace-regexp-in-string
"\\`https?://" ""
(plist-get eww-data :url)))
" - "
;; page title
(replace-regexp-in-string
"\\` +\\| +\\'" ""
(replace-regexp-in-string
"[\n\t\r ]+" " "
(plist-get eww-data :title))))))))
(defun bookmark-eww-handler (bm)
"Handler for eww bookmarks."
(eww-browse-url (alist-get 'filename bm)))
(defun bookmark-eww--setup ()
"Setup eww bookmark integration."
(setq-local bookmark-make-record-function #'bookmark-eww--make))
(add-hook 'eww-mode-hook #'bookmark-eww--setup)
(define-key eww-mode-map "b" #'bookmark-set)
(define-key eww-mode-map "B" #'bookmark-jump)
(define-key eww-mode-map (kbd "M-n") nil)
(define-key eww-mode-map (kbd "M-p") nil) |
I don't know what the current state is, but there has been recent discussion of eww using standard bookmarks. https://lists.gnu.org/archive/html/emacs-devel/2020-10/msg01651.html |
I consider Eww bookmarks to be a legacy feature. Therefore I have no intention to add Eww bookmark support out of the box to Consult. Hopefully Eww pages can be bookmarked using standard Emacs bookmarks at some point. For now Eww bookmarks can be used with Consult as follows: (require 'eww)
(defvar consult--source-eww
(list
:name "Eww"
:narrow ?e
:action (lambda (bm)
(eww-browse-url (get-text-property 0 'url bm)))
:items (lambda ()
(eww-read-bookmarks)
(mapcar (lambda (bm)
(propertize
(format "%s (%s)"
(plist-get bm :url)
(plist-get bm :title))
'url (plist-get bm :url)))
eww-bookmarks))))
(add-to-list 'consult-buffer-sources 'consult--source-eww 'append) I've documented the eww bookmark source in the wiki: https://github.com/minad/consult/wiki#eww-bookmarks |
I pretty much use consult-buffer for all "switch" actions ;) bookmark+ is way too big for me to just integrate eww bookmarks into consult-buffer. Any chance of it coming out of the box? The recent package devdocs https://github.com/skeeto/devdocs-lookup has me using eww a lot more to browse APIs etc.
cheers.
The text was updated successfully, but these errors were encountered: