unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Colin Baxter <m43cap@yandex.com>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: Bastien <bzg@gnu.org>, Boruch Baum <boruch_baum@gmx.com>,
	"48179@debbugs.gnu.org" <48179@debbugs.gnu.org>
Subject: bug#48179: [External] : bug#48179: bookmark-fontify [PATCH]
Date: Fri, 7 May 2021 16:22:09 +0000	[thread overview]
Message-ID: <SA2PR10MB4474BEA9111E27483AC763FCF3579@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87mtt6slam.fsf@yandex.com>

>> setting multiple bookmarks in the same file works
>> without problems with the built-in bookmark.el,
>> as far as I can tell?  (You just have to give the
>> bookmarks different names.)

First, a correction of that, assuming I understand
what it wants to say.  You can have any number of
bookmarks in the same file, and even with the same
location in the file.  And they need _NOT_ have
different names.

[This is true for both vanilla bookmark.el and
 Bookmark+.  But in vanilla all but the first
 bookmark with the same name are unused/unavailable.
 With Bookmark+ you can use all bookmarks that have
 the same name.

 For instance, you can have two bookmarks named
 `foo.el', each named for a file named `foo.el',
 where those files are in different directories.
 That's the case for autofile bookmarks, for
 example.]

> That's true, but, as you wrote, the user has
> to come up new names.

See above - the names need NOT be different.

Secondly, if your point is about a user always
needing to come up with names whenever s?he
_wants_ different names (underlining "wants",
because that's not an Emacs requirement):

Sometimes you _want_ to name a bookmark.
Sometimes you might prefer not to have to do that,
and instead just hit a key to set a bookmark -
no prompting for a name, no need to even hit `RET'
to accept a default name at a prompt.

With Bookmark+, by default `C-x x RET' does that.
No prompting - autonaming.

(Bookmarking keys are on a keymap that's bound,
by default, to `C-x x'.  You can instead of course
put that command on a shorter key.)

That's `bmkp-toggle-autonamed-bookmark-set/delete':

  If there is an autonamed bookmark at point, delete
   it, else create one.

  The bookmark created has no region.  Its name is
  formatted according to option
  `bmkp-autoname-bookmark-function'.

  With a prefix arg, delete *ALL* autonamed bookmarks
  for this buffer.

  Non-interactively, act at POSITION, not point.
  If nil, act at point.

So one key to either create or delete an autonamed
bookmark at point.  And a prefix arg deletes all.

> This is done automatically in bm-bookmarks, which
> inserts the corresponding line as the name.

Bookmark+ lets users customize the autonaming, using
option `bmkp-autoname-bookmark-function':

  Function to automatically name a bookmark at point
   (cursor position).

  It should accept a buffer position as its (first)
   argument.
  The name returned should match the application of
  `bmkp-autoname-format' to the buffer name.

The default value of the option does this:

  Return a bookmark name using POSITION and the current
   buffer name.

  The name is composed as follows:
   POSITION followed by a space and then the buffer name.
   The position value is prefixed with zeros to comprise
     9 characters.
   For example, for POSITION value 31416 and current buffer
     `my-buffer', the name returned would be
     `000031416 my-buffer'.

It's trivial to define a function that returns any
kind of name you want, including using the text of
the current line as the name.

The name of an autonamed bookmark matches option
`bmkp-autoname-format', which is a format string.
By default, the format string accepts a buffer name.
The default value is "^[0-9]\\{9\\} %B".  So a
default bookmark name is the position followed by
the buffer name.

> The disadvantage is that bm-bookmarks can't 
> easily bookmark blank lines.

That's a problem only for BM's particular way of
naming.  The default Bookmark+ naming doesn't have
that problem, for example.

What's important is that users themselves can
easily define the automatic naming they want.  And
that they can create bookmarks both by autonaming
and by providing names explicitly.

> It seems to me that all the bookmarks, bm, built-in (including
> emacs-28), bookmark+, have disadvantages. Personally, I would use
> bookmark+ if were not for the fact that it writes unprompted to ~/.emacs.

I don't know what you mean by that.  Could you
elaborate?

1. It never writes to ~/.emacs, unless you've defined
   that as the bookmark file you want to write to.

2. It never writes to your bookmark file unprompted
   unless you've configured it to do so.  You do that
   in the same way as for vanilla bookmark.el: option
   `bookmark-save-flag'.  Set that option to `nil'
   and bookmarks will never be saved except when you
   explicitly ask to save, e.g. when using command
   `bookmark-save'.





  reply	other threads:[~2021-05-07 16:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03  0:13 bug#48179: bookmark-fontify [PATCH] Boruch Baum
2021-05-03  0:40 ` bug#48179: [External] : " Drew Adams
2021-05-03  1:20   ` Boruch Baum
2021-05-03  1:25     ` Drew Adams
2021-05-04  0:35       ` Stefan Kangas
2021-05-04 16:37         ` bug#48179: [External] : " Drew Adams
2021-05-03  7:54 ` Lars Ingebrigtsen
2021-05-03  9:12   ` Boruch Baum
2021-05-03  9:19     ` Lars Ingebrigtsen
2021-05-03  9:58       ` Boruch Baum
2021-05-04  8:59         ` Lars Ingebrigtsen
2021-05-04  9:02           ` Lars Ingebrigtsen
2021-05-04  9:58             ` Basil L. Contovounesios
2021-05-05  8:13               ` Lars Ingebrigtsen
2021-05-05 12:26                 ` Basil L. Contovounesios
2021-05-05 16:30                   ` Boruch Baum
2021-05-06  8:57                     ` Lars Ingebrigtsen
2021-05-06 10:31                       ` Boruch Baum
2021-05-06 18:52                         ` Basil L. Contovounesios
2021-05-06 18:52                     ` Basil L. Contovounesios
2021-05-06 19:13                       ` Boruch Baum
2021-05-06 19:41                         ` Basil L. Contovounesios
2021-05-05 17:08                   ` Boruch Baum
2021-05-06  8:58                     ` Lars Ingebrigtsen
2021-05-06 10:38                       ` Boruch Baum
2021-05-06 18:53                         ` Basil L. Contovounesios
2021-05-06 11:03                       ` Boruch Baum
2021-05-04 18:38             ` Boruch Baum
2021-05-05  8:15               ` Lars Ingebrigtsen
2021-05-05 10:48                 ` Boruch Baum
2021-05-05 16:43                   ` bug#48179: [External] : " Drew Adams
2021-05-06  8:53                   ` Lars Ingebrigtsen
2021-05-05 15:39           ` Bastien
2021-05-05 17:25             ` Boruch Baum
2021-05-05 18:54               ` Eli Zaretskii
2021-05-06  8:54               ` Lars Ingebrigtsen
2021-05-06  9:57               ` Bastien
2021-05-06 10:12                 ` Colin Baxter
2021-05-06 10:59                 ` Boruch Baum
2021-05-06  8:49             ` Colin Baxter
2021-05-06  8:55               ` Lars Ingebrigtsen
2021-05-06  9:41                 ` Colin Baxter
2021-05-06 10:24                 ` Boruch Baum
2021-05-06 10:46                   ` Colin Baxter
2021-05-06 10:52                     ` Colin Baxter
2021-05-07 11:22                     ` Lars Ingebrigtsen
2021-05-07 13:52                       ` Colin Baxter
2021-05-07 16:22                         ` Drew Adams [this message]
2021-05-07 18:48                           ` bug#48179: [External] : " Colin Baxter
2021-05-08  0:25                             ` Drew Adams
2021-06-06  0:27 ` bug#48179: bookmark-fontify disable by default Y. E.
2021-06-06  3:30   ` Pankaj Jangid

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR10MB4474BEA9111E27483AC763FCF3579@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=48179@debbugs.gnu.org \
    --cc=boruch_baum@gmx.com \
    --cc=bzg@gnu.org \
    --cc=larsi@gnus.org \
    --cc=m43cap@yandex.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).