From: Drew Adams <drew.adams@oracle.com>
To: Jamie Beardslee <beardsleejamie@gmail.com>, emacs-devel@gnu.org
Subject: RE: [PATCH] Add user option to disable location in bookmarks
Date: Sat, 20 Jun 2020 23:34:05 +0000 (UTC) [thread overview]
Message-ID: <062414c6-41f4-4803-9a62-28274825b8e0@default> (raw)
In-Reply-To: <87blld2x5h.fsf@gmail.com>
> > You don't specify what the actual problem is. How does a bookmark
> > interfere with save-place? Maybe provide a step-by-step recipe to
> > show the problem, starting from `emacs -Q' (no init file).
>
> ‘bookmark-set’ saves the position--by which I mean point and context
> strings--with no option (that I can find) of not saving it. When using
> ‘bookmark-jump’, point will always be moved to that position, ignoring
> the position from save-place.
That's not a recipe.
A bookmark can do anything. It can even make use of
save-place or any save-place info.
You can create whatever kind of bookmark you need, if
you need something special. See
`bookmark-make-record-function', and see how it's used
in the Elisp sources to create different kinds of
bookmarks.
`bookmark-set' uses `bookmark-make-record', which calls
the function value of `bookmark-make-record-function'.
It's only the default value of variable
`bookmark-make-record-function' that does what you say.
If the default `bookmark-make-record-function' doesn't
do what's needed for save-place, then maybe save-place
should define its own type of bookmark.
Or probably all it needs to do is `add-hook' for
`bookmark-after-jump-hook', just as it does for
`find-file-hook', `dired-initial-position-hook', and
`kill-emacs-hook'. IOW, after jumping to the position
that you bookmarked, move to the save-place position.
It's you who bookmarked a given position. And likely
you do sometimes want to return to that position. But
if there's a more recent position in that file, which
save-place has saved for you, then just use that one,
via `bookmark-after-jump-hook'.
(And again, a bookmark need not have a location. If
you use the default make-record function then yes,
the bookmark saves a position.)
> > Just what behavior are you looking for? Do you not want to open the
> > file at all? (If so, what do you want the bookmark to do with the
> > file, instead of opening it?)
> >
> > If you want the bookmark to open the file, where do you want the
> > cursor to be in it - at what position?
>
> My patch allows the user to choose whether or not the bookmark record
> should be in control of the position.
The bookmark record has already chosen that. Just
use a different kind of record. Why have an option
that acts in a blanket manner on all bookmarks, to
ignore their position?
If this is about save-place then save-place should
do the right thing. See above. If there's an option
to be added in that regard, it's a save-place option:
`save-place-ignore-bookmark-position'. The hook
function (see above) can move to the save-place place
if the option is non-nil, and just do nothing if it's
nil.
> > A bookmark can target a file in any way you want, including (but not
> > limited to) opening it at a given position. You can easily bookmark a
> > file so that the bookmark opens it with the cursor at position 1, for
> > example. (And you need not visit a file in order to bookmark it.)
> >
> > Finally, a bookmark need not have any `location' field.
>
> I understand this. I think it would be useful to have a simple
> accessible way to effectively disable the point manipulation part of
> bookmarks. It’s not exactly convenient to edit the bookmark file by
> hand every time a bookmark is created just to disable this feature.
No one suggested that you edit a bookmark file.
Your cure isn't localized to the ill. If this is a
good option to give users, to let save-place override
bookmark locations, just like it does for Dired and
`find-file', then that option belongs to save-place.
next prev parent reply other threads:[~2020-06-20 23:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-20 19:27 [PATCH] Add user option to disable location in bookmarks Jamie Beardslee
2020-06-20 21:35 ` Drew Adams
2020-06-20 22:24 ` Jamie Beardslee
2020-06-20 22:50 ` Stefan Monnier
2020-06-20 23:37 ` Drew Adams
2020-06-20 23:34 ` Drew Adams [this message]
2020-06-21 0:22 ` Jamie Beardslee
2020-06-21 5:19 ` Drew Adams
2020-06-21 9:56 ` Basil L. Contovounesios
2020-06-21 9:13 ` Yuri Khan
2020-06-21 18:44 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=062414c6-41f4-4803-9a62-28274825b8e0@default \
--to=drew.adams@oracle.com \
--cc=beardsleejamie@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.