[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: EWW improvements: open in new buffer, tags, quickmarks, search engin
From: |
Drew Adams |
Subject: |
RE: EWW improvements: open in new buffer, tags, quickmarks, search engines, ... |
Date: |
Thu, 3 May 2018 08:12:08 -0700 (PDT) |
> >> As far as I understand, Emacs native bookmarks won't work with EWW.
> >> `M-x bookmark-set' complains the the EWW buffer does not point to a
> >> real file.
> >
> > No, normal Emacs bookmarks do not need a file as
> > target. Even vanilla Emacs can bookmark Dired and
> > Info nodes (albeit not so well). A bookmark handler
> > can do anything you want it to do.
>
> Can you explain how you bookmark an EWW buffer with Emacs
> vanilla bookmarks?
A new type of bookmark needs to be defined, with a handler
that "jumps" to the URL. Code from Bookmark+ or similar
could be used.
My point was that just to add EWW support for (real)
Emacs bookmarks it's not required to add all of Bookmark+
to Emacs. All that's needed are to define a format for
the bookmarks and define a hander function to jump to
such a bookmark.
In Bookmark+, the handler function is `bmkp-jump-eww',
and a bookmark with EWW format is made by function
`bmkp-make-eww-record'.
(defun bmkp-make-eww-record ()
"Make a record for an EWW buffer."
`(,(bmkp-eww-title)
(buffer-name . ,(bmkp-eww-new-buffer-name))
,@(bookmark-make-record-default 'NO-FILE)
(location . ,(bmkp-eww-url))
(handler . bmkp-jump-eww)))
The logic behind jumping to an EWW bookmark, and how
that is hooked into EWW is more complicated - see the
Bookmark+ code for how Bookmark+ does it.
> Besides it does not seem to effectively work with many other modes. For
> instance, bookmarking a *Help* buffer works at first glance, but Emacs
> fails to look read the bookmarks file upon restart.
Dunno what that means. But yes, vanilla Emacs needs
to have some support for bookmarking arbitrary buffers,
as does Bookmark+, or else it needs to at least have
support for bookmarking some specific kinds of
bookmarks (*Info*, *Help* or whatever).
But I believe that vanilla Emacs already does have
support for bookmarking some kinds of buffers, such
as Info and Dired. I don't recall really, but I was
thinking it does when I wrote that. Emacs added
bookmark field `location', for example, and its value
need not be a file name.
In any case, the infrastructure is there in vanilla
Emacs to do any of this.
My point was:
1. Bookmark+ is freely available. It can be
integrated into Emacs; and it already provides
EWW support.
2. It's not _necessary_ to integrate Bookmark+ to add
EWW support to Emacs. That could be done either
by just copying the Bookmark+ EWW-support code to
Emacs or by Emacs rolling its own support.
3. In reply to your statement that vanilla Emacs
requires that a bookmark target a file I replied
that I don't think that's true.
Grepping the Emacs source code for "'location"
shows only one use of that property, in
`gnus-summary-bookmark-jump', and I might be
reading that wrong, so I could be wrong about this.
There are other ways than property `location' to do
this, so grepping `location" (no preceding quote')
might tell more.
And I see that an Info bookmark records both the
Info file and the node (so it does record a file
name).
Grepping for `bookmark-default-handler' can also
tell us whether some bookmark types do not record
a file name. Maybe `Man-bookmark-jump'?
`doc-view-bookmark-jump'?
- Re: EWW improvements: open in new buffer, tags, quickmarks, search engines, ..., Pierre Neidhardt, 2018/05/03
- Re: EWW improvements: open in new buffer, tags, quickmarks, search engines, ..., Pierre Neidhardt, 2018/05/03
- RE: EWW improvements: open in new buffer, tags, quickmarks, search engines, ...,
Drew Adams <=