Pierre Neidhardt
2018-04-16 10:26:40 UTC
I've recently hacked around EWW and since it's coming into good shape
I'm thinking of committing this upstream.
Before sending a patch, here is the current state of my hacks:
https://github.com/Ambrevar/dotfiles/blob/master/.emacs.d/lisp/init-eww.el
Summary:
- Add `eww-copy-page-title' that mirrors `eww-copy-page-url', it's
useful enough.
- Enhances eww-next-url / eww-previous-url so that when there is no next /
previous links, it tries to increment / decrement the last number in
the last element of the URL. ("do what you mean" style.)
- Add a `eww-reload-all' command to reload all *eww* buffers, it's
useful when using desktop-mode but when `eww-restore-desktop' is nil.
- Make `eww' so that the default value is in the prompt, ready to be
edited by the user. Very convenient in my opinion.
- Change `eww-open-in-new-buffer' so that it queries for a URL instead
of cloning the current buffer (which is not very useful in my
opinion).
- Make eww-update-header-line-format also update the buffer name so that
it contains the page title. _Very useful_ to browse / search *eww*
buffers (think Ivy/Helm).
- Ask for tags when saving a bookmark. Tags are stored under the key
:tags as a list of strings.
- Make `eww-add-bookmark' run a customizable function to decide when.
to error out. For instance, error out when a duplicate is detected
with protocol stripped out (https://foo.bar is seen as a duplicate of
http://foo.bar).
- Make `eww-write-bookmarks' run a customizable function before saving
the file. That function can be used, for instance, to detect
duplicates or to sort the bookmarks. This would make the eww-bookmarks
file more friendly to versioning.
- Bookmarks can have a mark which is a string saved under the key :mark.
The mark should be unique. It could be used like the "quickmark"
function found in some browsers: use it to quickly load a
bookmark. (Work in progress.)
- Bookmarks can have a search engine which is either appended to the
bookmark' URL if it does not start with "https?://", or used as-is
otherwise.
The search engine is stored as a string under the key :search.
A "%s" must be present in the search engine string as a place-holder
for the query.
- Make `eww-bookmark-prepare' only load bookmarks from file if not
already set. This makes it possible to display a custom / narrowed
list of bookmarks in the bookmark buffer.
- Make `eww-bookmark-prepare' display the mark, the tags and the search
engine, if available. Work in progress. I'm thinking of using a
different face for the mark if a search engine is present.
- Add a `eww-bookmarks-by-tags' command which queries the user for a
completing list of tags and then displays a bookmark buffers of all
the bookmarks which match the tags. The matching can be either
inclusive or exclusive (bookmarks which match at least one tag vs. all
of them).
- Make `eww--dwim-expand-url' follow a different logic to bind it all together:
- With a multi-word query, if first word is a mark of a bookmark with a search engine,
then use the said search engine over the rest of the query.
- With a single word query, if first word is a mark then open the
corresponding bookmark.
- Else query the default search engine.
- Fix `eww-forward-url' as it seems to corrupt the history. (Work in progress.)
Of course in its present state my hacks are what they are, very hacky.
It needs to be made more customizable and interfaceable.
What do you think?
--
Pierre Neidhardt
Power corrupts. Absolute power is kind of neat.
-- John Lehman, Secretary of the Navy, 1981-1987
I'm thinking of committing this upstream.
Before sending a patch, here is the current state of my hacks:
https://github.com/Ambrevar/dotfiles/blob/master/.emacs.d/lisp/init-eww.el
Summary:
- Add `eww-copy-page-title' that mirrors `eww-copy-page-url', it's
useful enough.
- Enhances eww-next-url / eww-previous-url so that when there is no next /
previous links, it tries to increment / decrement the last number in
the last element of the URL. ("do what you mean" style.)
- Add a `eww-reload-all' command to reload all *eww* buffers, it's
useful when using desktop-mode but when `eww-restore-desktop' is nil.
- Make `eww' so that the default value is in the prompt, ready to be
edited by the user. Very convenient in my opinion.
- Change `eww-open-in-new-buffer' so that it queries for a URL instead
of cloning the current buffer (which is not very useful in my
opinion).
- Make eww-update-header-line-format also update the buffer name so that
it contains the page title. _Very useful_ to browse / search *eww*
buffers (think Ivy/Helm).
- Ask for tags when saving a bookmark. Tags are stored under the key
:tags as a list of strings.
- Make `eww-add-bookmark' run a customizable function to decide when.
to error out. For instance, error out when a duplicate is detected
with protocol stripped out (https://foo.bar is seen as a duplicate of
http://foo.bar).
- Make `eww-write-bookmarks' run a customizable function before saving
the file. That function can be used, for instance, to detect
duplicates or to sort the bookmarks. This would make the eww-bookmarks
file more friendly to versioning.
- Bookmarks can have a mark which is a string saved under the key :mark.
The mark should be unique. It could be used like the "quickmark"
function found in some browsers: use it to quickly load a
bookmark. (Work in progress.)
- Bookmarks can have a search engine which is either appended to the
bookmark' URL if it does not start with "https?://", or used as-is
otherwise.
The search engine is stored as a string under the key :search.
A "%s" must be present in the search engine string as a place-holder
for the query.
- Make `eww-bookmark-prepare' only load bookmarks from file if not
already set. This makes it possible to display a custom / narrowed
list of bookmarks in the bookmark buffer.
- Make `eww-bookmark-prepare' display the mark, the tags and the search
engine, if available. Work in progress. I'm thinking of using a
different face for the mark if a search engine is present.
- Add a `eww-bookmarks-by-tags' command which queries the user for a
completing list of tags and then displays a bookmark buffers of all
the bookmarks which match the tags. The matching can be either
inclusive or exclusive (bookmarks which match at least one tag vs. all
of them).
- Make `eww--dwim-expand-url' follow a different logic to bind it all together:
- With a multi-word query, if first word is a mark of a bookmark with a search engine,
then use the said search engine over the rest of the query.
- With a single word query, if first word is a mark then open the
corresponding bookmark.
- Else query the default search engine.
- Fix `eww-forward-url' as it seems to corrupt the history. (Work in progress.)
Of course in its present state my hacks are what they are, very hacky.
It needs to be made more customizable and interfaceable.
What do you think?
--
Pierre Neidhardt
Power corrupts. Absolute power is kind of neat.
-- John Lehman, Secretary of the Navy, 1981-1987