unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Pierre Neidhardt <ambrevar@gmail.com>, 29110@debbugs.gnu.org
Subject: bug#29110: 25.2; Should push-mark allow duplicates?
Date: Wed, 1 Nov 2017 15:43:14 -0700 (PDT)	[thread overview]
Message-ID: <de246820-57f4-4794-84a3-2342cd550fe2@default> (raw)
In-Reply-To: <87h8udiqv3.fsf@gmail.com>

> The `push-mark' function allows for duplicate marks.  I fail to see a
> use case, but otherwise I think it's rather inconvenient:

It's not necessarily inconvenient for everyone or every use case.

If you or Helm or whatever wants to remove duplicates you can
always do so.  You can also prevent a duplicate from being
added.  And you can choose whether pushing what would otherwise
become a duplicate should remove an "older" duplicate member or
prevent the "newer" potentially duplicate member.  There are
lots of possibilities.

Consider the simple case of someone using vanilla `C-u C-SPC'.
Someone might want to have duplicates at different positions
in the ring, visiting them in order.

I, like you apparently, use an interface that lets me cycle
among marks in various ways (various orders), cycle among
various subsets of the available marks (filtering), or access
marks directly.  And with the interface I use (Icicles) I
can choose to remove duplicates, in general.  (And the default
command that moves among markers does remove duplicates.)

But I can imagine other interfaces and other use cases.

I think this kind of choice should be up to the user or the
interface author.  Helm can decide to remove/prevent duplicates,
or you can as one user.  I don't see why Emacs itself should.
(Just one opinion, though.)

> - It makes traversing the ring tedious with respect to end-user
> interaction.  (Think Ivy / Helm for the mark ring.)
> Duplicates are probably not the expected behaviour for the end-user.

It depends on the interface, the user, and the use case.

> - Functions working with rings will probably want to remove the
> duplicates, so they end up calling `remove' and the like over and over
> again.

Why "over and over again"?  You can prevent adding duplicates, no?

> - It eats up more memory.

Seriously?  Bof.

> - It's counter-intuitive to developers who may in turn write code
> without being careful that rings may contain duplicates.  This may
> result in unexpected behaviour.

Bof.  Developers should get beyond depending on any such naive
"intuition".

> I got bitten hard by this

And now you know. ;-)

> We could not find out the root of the issue, but we discovered that
> advising `push-mark' so that it does not duplicate marks would do it.  I
> know it's not a solution per se, but at least we've got a lead.

It's a fine individual solution, IMO, if you never want duplicates.





  reply	other threads:[~2017-11-01 22:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 22:19 bug#29110: 25.2; Should push-mark allow duplicates? Pierre Neidhardt
2017-11-01 22:43 ` Drew Adams [this message]
2017-11-01 23:07   ` Pierre Neidhardt
2017-11-01 23:30     ` Noam Postavsky
2017-11-02  6:43       ` Pierre Neidhardt
2017-11-02  0:53     ` Drew Adams
2017-11-02  6:40       ` Pierre Neidhardt
2017-11-02 13:34         ` Drew Adams
2017-11-05 14:59           ` Pierre Neidhardt
2017-11-05 18:41             ` Drew Adams
2022-02-08  6:24 ` Lars Ingebrigtsen

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=de246820-57f4-4794-84a3-2342cd550fe2@default \
    --to=drew.adams@oracle.com \
    --cc=29110@debbugs.gnu.org \
    --cc=ambrevar@gmail.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).