emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : [emacs bookmark.el] Sorting by last set


From: Karl Fogel
Subject: Re: [External] : [emacs bookmark.el] Sorting by last set
Date: Sat, 04 Jun 2022 01:07:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

A few thoughts I just had while looking over the recent improvement to bookmark.el sorting (commit f461eb8fa -- not the later followup commit fccde52158, which isn't relevant for these thoughts):

1) We use the value `last-modified' (for `bookmark-sort-flag') to represent sorting by the date the bookmark was most recently updated to point to a particular target.

But there are other ways to "modify" bookmarks: for example, you could edit a bookmark's annotation without updating its target. One could make a reasonably good argument as to why an annotation change should count as a "modification" for the purposes of sorting... and, one could make a reasonably good argument why it shouldn't.

My purpose here is just to ask: is the name "last-modified" really the most appropriate one for the behavior currently implemented?

The simple solution would be to just change the symbol to `last-set-date'. I think that would be my choice. It would reduce the potential for confusion and misunderstanding.

(I won't go in to the more complex solutions here, as I'm not sure that bookmark.el really needs its sorting capability to be fully operational battle station.)

* Now that we're using a symbol for *one* possible value of `bookmark-sort-flag', should we use symbols for *all* possible values? (And leave the treatments of `t' and nil as legacy compatibility behaviors, documented as such but deprecated in favor of using the corresponding new symbols instead when writing new configurations.)

* Finally, perhaps `bookmark-sort-flag' is no longer the right name for this variable? It's not a "flag" anymore -- a "flag" should be either `t' or nil.

This naming tradition mostly holds throughout Emacs, although there is at least one other exception. Of the 54 symbols whose names end in "-flag" that I found via `M-x apropos', I did a random sampling of about 15. A few don't have real doc strings (sigh), but their values at least were either 't' or nil. Of the documented ones in my sample, all but one were true Boolean flags. The single exception was `quit-flag', which I would now also argue is misnamed, but I'm not advocating here that we change that one :-).

However, I think it would be good to deprecate `bookmark-sort-flag' in favor of 'bookmark-sort-behavior' or something, and do whatever the usual compatibility dance is for such situations. It's useful for the suffix "-flag" to actually mean something, and I'd rather not have bookmark.el contribute to the dilution of that linguistic tradition.

By the way, I still think the change as currently landed is an unambiguous improvement. I would still want to keep it even if we didn't take any of my suggestions above.

Best regards,
-Karl



reply via email to

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