From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Pierre Neidhardt Newsgroups: gmane.emacs.bugs Subject: bug#29110: 25.2; Should push-mark allow duplicates? Date: Wed, 01 Nov 2017 23:19:44 +0100 Message-ID: <87h8udiqv3.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1509574885 13064 195.159.176.226 (1 Nov 2017 22:21:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Nov 2017 22:21:25 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.2.1 To: 29110@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 01 23:21:18 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eA1Np-0001sO-JS for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Nov 2017 23:21:13 +0100 Original-Received: from localhost ([::1]:57900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA1Nq-00087N-Nf for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Nov 2017 18:21:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA1Nh-00087E-Se for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:21:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eA1Ne-0004vb-Ng for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eA1Ne-0004vQ-J6 for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eA1Ne-0005IA-6N for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Nov 2017 22:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29110 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150957480520239 (code B ref -1); Wed, 01 Nov 2017 22:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2017 22:20:05 +0000 Original-Received: from localhost ([127.0.0.1]:46546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eA1Mi-0005GA-Qs for submit@debbugs.gnu.org; Wed, 01 Nov 2017 18:20:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eA1Me-0005FW-Q6 for submit@debbugs.gnu.org; Wed, 01 Nov 2017 18:20:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eA1MX-0004Bm-LE for submit@debbugs.gnu.org; Wed, 01 Nov 2017 18:19:54 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:37337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eA1MX-0004Bb-G5 for submit@debbugs.gnu.org; Wed, 01 Nov 2017 18:19:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA1MW-0007xM-8Z for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:19:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eA1MT-000494-4F for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:19:52 -0400 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:56314) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eA1MS-00048Q-UG for bug-gnu-emacs@gnu.org; Wed, 01 Nov 2017 18:19:49 -0400 Original-Received: by mail-wm0-x233.google.com with SMTP id y83so7522372wmc.4 for ; Wed, 01 Nov 2017 15:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:date:message-id:mime-version; bh=1DOqmwotu53MjePNV5MqWKvk+MU1A4tBKsA7hzByPE0=; b=sM/08B3TqUk1gpFZNmy72ZIbrLn3P24mjPVB1um2e0pe8h7o1PSWspz+bQaXrWMC+p ikJMLIF01Zeo197W1ThZ9R4B+H2xMZ8vFT3rklypqmrYcuKp2POszykqu8fcssjWX0sf heTZV0ptjIl+SOYKGnz39qo5fJYrhZeO8oQrlyIbdAJKq08C6MKprCiJ7NHuXexLudDP BLdXZCtEv1FwcUbcJsN1cRchvI7rDFejn9rjCsRkdGVxqh8GcY/PnBorZH99SLtO1nwV JuUR7f30Hx5wW5ugk2yLfYkiCQEGybdj/PzLYRW05LhNxkWRm5fgDGfqdnYTJxOHUb1c h+dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=1DOqmwotu53MjePNV5MqWKvk+MU1A4tBKsA7hzByPE0=; b=hJ6T3JoF7JVkRpejrncdtVzLzOF40e/N7BML27pFllAuUh3XhQfEc5XyJ9s6oVehFH 20RAK8E7Qe7ZvOTR4lVTQO6ZLtHrKQ4qM+CBYZjC/JrRnQqFl0xErQ7kq52WAOHnZExH bleMGlGUZXdlNHyq1QrgH4dPbewUFfboLe1hIliJLkjZOTLAZwklpzxDaQLCiMzrvakk 72hqUaT/8r0xITkYjGWXRdMKLqCbdEU5JKA7WG4UHCm1qv4okDOUVZoMGCk8Gcve5nP5 W+t5Q4Kbv9H7mDs3C7n7UPk15PKz5ji6DP3jSQBTBFMXIu0QaB5XTqhH/G/f9SoH9+Gd TKbw== X-Gm-Message-State: AMCzsaUMewbOY3+leGxDr/n9SJZrc0g5EX/MPccc1hKa7b7AprIxDP/z QYpqYb6WM7xPycgvjX2uWVE5hw== X-Google-Smtp-Source: ABhQp+SUqP/MezwZitD/MXRS3lUK0bCMkyS2+4lqg8jw6c7xRay0EuGDp3pHW05b17+H/i1alolHTA== X-Received: by 10.28.98.212 with SMTP id w203mr1457465wmb.88.1509574787389; Wed, 01 Nov 2017 15:19:47 -0700 (PDT) Original-Received: from dhiov23k ([41.230.116.46]) by smtp.gmail.com with ESMTPSA id 80sm2439637wmk.14.2017.11.01.15.19.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2017 15:19:46 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139336 Archived-At: The `push-mark' function allows for duplicate marks. I fail to see a use case, but otherwise I think it's rather inconvenient: - 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. - Functions working with rings will probably want to remove the duplicates, so they end up calling `remove' and the like over and over again. - It eats up more memory. - 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. I got bitten hard by this while trying to figure out why `helm-mark-ring` would randomly fail to follow the marks when Evil mode was `require'd (not even turned on). I reported the issues on both bug trackers: - https://github.com/emacs-evil/evil/issues/845 - https://github.com/emacs-helm/helm/issues/1891 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. To reproduce, start emacs -Q and use "C-SPC C-SPC" a few times at different spots. Then move point somewhere and eval: (set-marker (mark-marker) (point)) (push-mark) mark-ring You should now have one duplicate in the ring. Here is the proposed fix implemented in Helm: https://github.com/emacs-helm/helm/commit/ffd2abf5c4bdfc998c09730387b11d2bf9ac1032 In GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.16) of 2017-09-02 built on dhiov23k Windowing system distributor 'The X.Org Foundation', version 11.0.11905000 System Description: Gentoo Base System release 2.4.1 Configured using: 'configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --docdir=/usr/share/doc/emacs-25.2 --htmldir=/usr/share/doc/emacs-25.2/html --libdir=/usr/lib64 --program-suffix=-emacs-25 --infodir=/usr/share/info/emacs-25 --localstatedir=/var --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --with-gameuser=:gamestat --without-compress-install --with-file-notification=inotify --enable-acl --without-dbus --without-modules --without-gpm --without-hesiod --without-kerberos --without-kerberos5 --with-xml2 --without-selinux --with-gnutls --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns --without-gconf --without-gsettings --without-toolkit-scroll-bars --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --with-imagemagick --with-xft --without-cairo --without-libotf --without-m17n-flt --with-x-toolkit=gtk3 --without-xwidgets GENTOO_PACKAGE=app-editors/emacs-25.2 'CFLAGS=-march=ivybridge -O2 -pipe' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND NOTIFY ACL GNUTLS LIBXML2 FREETYPE XFT ZLIB GTK3 X11 Important settings: value of $LANG: en_US.utf8 locale-coding-system: utf-8-unix Major mode: Debbugs