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

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

RE: Bookmark the end of file?


From: Drew Adams
Subject: RE: Bookmark the end of file?
Date: Tue, 7 Apr 2015 15:27:01 -0700 (PDT)

> I think it'd be OK to refine the current code such that a bookmark
> that's at a position equal to point-max would be marked as "go the EOB"
> instead of "go to the position that happened to be EOB back when we
> created the bookmark".

Unless that's not what the user wants. ;-)

The usual behavior of a bookmark is to take you to a recorded
position, which is understood not to be absolute but relative to the
surrounding context (i.e., located by that context).

A buffer (file) position is what is bookmarked.  But the intention
is for the bookmark to be automatically repositioned to stay, if
possible, surrounded by the same text context.  The recorded position
is used only as a starting point.  The actual jump position is
adjusted to try to place it in the same context.

So is "relative to the surrounding context" to be understood in this
particular case as just after the text that precedes the bookmarked
place?  Or is it to be understood as just before the (nonexistent)
text that follows it, i.e., at eob?

Do you assume that most users want to track eob in such a case?
Or do you assume that they want to track the text that preceded the
bookmarked position?

Consider also this comment for the code that automatically relocates
a bookmark when you jump to it, to keep it within/near its originally
recorded context:

;; Go searching forward first.  Then, if forward-str exists and
;; was found in the file, we can search backward for behind-str.
;; Rationale is that if text was inserted between the two in the
;; file, it's better to be put before it so you can read it,
;; rather than after and remain perhaps unaware of the changes.

In the special case we are considering now, you seem to assume that
it is better for the cursor to be put *after* any text inserted
since bookmarking, not that "it's better to be put before it so you
can read it".

I'd say there are different use cases to consider.

One approach is to offer users some ways to obtain one or the other
behavior after the (ordinary) bookmark has been created.  (Bookmark+
does that.)

Another approach could be to let users choose the behavior when a
bookmark is created at eob, and save that behavior choice in the
bookmark.  Of course then the bookmark is essentially of a different
type (different recorded info), and if a user wants to later switch
it to the other behavior then sh?e will need to jump through some hoops.



reply via email to

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