bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20845: 25.0.50; bookmark.el, handling of fictitious `buffer' propert


From: Stefan Kangas
Subject: bug#20845: 25.0.50; bookmark.el, handling of fictitious `buffer' property
Date: Fri, 5 Jul 2019 14:45:19 +0200

Hi Stefan,

I'm looking into Emacs Bug#20845 which asks about the purpose of the
"bookmark" property in bookmark.el.  I'm confused as to what its
purpose is, as is Drew in the bug report quoted below.

Drew Adams <drew.adams@oracle.com> writes:

> Function `bookmark-default-handler' picks up and handles the property
> (field) named `bookmark', if present.
>
> I see nowhere else where this property is used, and nowhere where it is
> set.  And it is not documented.
>
> IOW, there is no notion or existence (AFAICT) of any bookmarks that
> record a `buffer' property.  And yet, the *default* handler handles
> this unknown property - in two ways:
>
> * If the file is readable and is not visited then it visits the file
>   using `find-file-noselect'.  Why?
>
> * Otherwise, if the buffer named by property `buffer' exists then the
>   default handler does nothing (no-op).  The (non-English) comment here
>   is "See if buffer BUF have been created.", which tells us nothing
>   about why it is handled by doing nothing.
>
> This partial "handling" of the undocumented and never-set property
> `buffer' was apparently introduced in Emacs 23.1.  As it never did
> anything, it was seemingly never noticed.
>
> This property should either be properly documented (in the doc string of
> `bookmark-alist'), as to its use and meaning, or its default "handling"
> should be removed, as misguided.  I'd suggest that the unclear handling
> should just be removed.
>
> If there is some existing code distributed with Emacs that actually uses
> this property (and I can find none) then a bug can be filed for it.
>
> A grep of the Emacs sources for `bookmark-prop-set' shows no occurrences
> of that function outside bookmark.el, and that function is never used to
> set property `bookmark'.  I have also checked all occurrences of
> `bookmark-make-record' in the Emacs Lisp sources, and found none that
> set or use property `bookmark'.
>
> AFAICT, this property does not exist, and its incomplete "handling"
> should be removed.
>
> On the other hand, if this handling was just added to bookmark.el by
> someone only as support for some 3rd-party code, then it doesn't belong
> here anyway - that 3rd-party code can advise `bookmark-default-handler'
> or simply define its own, non-default, handlers.

This handling was added in this commit:

    commit dbf8402bc76a775284905f09399b4d88ee0c03e5
    Author: Stefan Monnier <monnier@iro.umontreal.ca>
    Date:   Wed Feb 10 15:02:54 2010 -0500

        (bookmark-handle-bookmark): Catch the right error.
        (bookmark-default-handler): Accept new bookmark field `buffer'.

This was authored by Thierry Volpiatto according to ChangeLog:

    +2010-02-10  Thierry Volpiatto  <thierry.volpiatto@gmail.com>

But trying to find out why this was committed made me even more
confused.  I could find Stefan Monnier arguing against this change on
two different occasions:

    2010-01-25 - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=5476#14
    2010-01-26 - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=5476#20

Yet this was committed on 2010-02-10.  I was unable to find any
discussion that would explain what had changed.

I understand this was a long time ago, but if you still remember it,
do you think you could help shed some light into the purpose of this
code?

The suggestion given by Drew above is to remove it.  Do you have an
opinion about that?

Thanks in advance!

Best regards,
Stefan Kangas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]