From unknown Sat Aug 16 15:58:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#4854 <4854@debbugs.gnu.org> To: bug#4854 <4854@debbugs.gnu.org> Subject: Status: 23.1.50; before-string overlay and show-paren-mode Reply-To: bug#4854 <4854@debbugs.gnu.org> Date: Sat, 16 Aug 2025 22:58:36 +0000 retitle 4854 23.1.50; before-string overlay and show-paren-mode reassign 4854 emacs submitter 4854 Stephen Berman severity 4854 minor tag 4854 notabug thanks From stephen.berman@gmx.net Mon Nov 2 07:28:51 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 2 Nov 2009 15:28:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.7 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nA2FSoZn031085 for ; Mon, 2 Nov 2009 07:28:51 -0800 Received: from mail.gnu.org ([199.232.76.166]:43968 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1N4ypt-00071B-N1 for emacs-pretest-bug@gnu.org; Mon, 02 Nov 2009 10:28:49 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1N4ypr-0004oN-UY for emacs-pretest-bug@gnu.org; Mon, 02 Nov 2009 10:28:49 -0500 Received: from mail.gmx.net ([213.165.64.20]:43997) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N4ypq-0004o8-Th for emacs-pretest-bug@gnu.org; Mon, 02 Nov 2009 10:28:47 -0500 Received: (qmail invoked by alias); 02 Nov 2009 15:28:45 -0000 Received: from i59F56ABD.versanet.de (EHLO escher.local.home) [89.245.106.189] by mail.gmx.net (mp008) with SMTP; 02 Nov 2009 16:28:45 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+LmPhuMHCLCNKM3Gjm33KcnXcB/JPtaBj2zw73Ct 04lUF5FHzW432b Received: by escher.local.home (Postfix, from userid 1000) id B167F1D0B79; Mon, 2 Nov 2009 15:49:55 +0100 (CET) From: Stephen Berman To: emacs-pretest-bug@gnu.org Subject: 23.1.50; before-string overlay and show-paren-mode Sender: steve@escher.local.home Date: Mon, 02 Nov 2009 15:49:55 +0100 Message-ID: <87fx8x0yng.fsf@escher.local.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.47 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Start Emacs with -Q, insert the following text into a buffer: begin (test) end then eval the following: (defun my-test () "" (interactive) (widen) (goto-char (point-min)) (let ((begin (search-forward "begin"))) (search-forward "end") (narrow-to-region (1+ begin) (line-beginning-position)) (goto-char (point-min))) (unless (let ((ovlist (overlays-in (1- (point)) (1+ (point))))) (when ovlist (overlay-get (car ovlist) 'before-string))) (let ((ov (make-overlay (point) (point) nil t t))) (overlay-put ov 'before-string "* ")))) (global-set-key "\C-cy" 'my-test) and now type `C-c y' in the buffer with the inserted text. The buffer nows displays this: * (test) As expected, now repeating `C-c y' does not alter the display, i.e. does not add more overlays. Now enable show-paren-mode (e.g. by checking "Paren Match Highlighting" in the Options menu). Now repeating `C-c y' display one additional "* " for each repetition (provided point remains on `('). Surprisingly, however, typing `M-x my-test' repeatedly does not add any "* ". In addition, typing a self-inserting character and then deleting it has the effect that typing `C-c y' no longer adds "* "; except after widening and removing the overlays: then repeating `C-c y' adds "* " once only, as when show-paren-mode is disabled. If the described behavior after enabling show-paren-mode is not a bug, can anyone explain it? In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4) of 2009-10-27 on escher Windowing system distributor `The X.Org Foundation', version 11.0.10502000 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=local locale-coding-system: utf-8-unix default enable-multibyte-characters: t From stephen.berman@gmx.net Wed Nov 4 15:08:10 2009 Received: (at 4854) by emacsbugs.donarmstrong.com; 4 Nov 2009 23:08:10 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.2 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with SMTP id nA4N87pv012910 for <4854@emacsbugs.donarmstrong.com>; Wed, 4 Nov 2009 15:08:09 -0800 Received: (qmail invoked by alias); 04 Nov 2009 23:08:02 -0000 Received: from i59F57F86.versanet.de (EHLO escher.local.home) [89.245.127.134] by mail.gmx.net (mp001) with SMTP; 05 Nov 2009 00:08:02 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18GhBJ12fYG8KsboCBP95sW9qv0u4H5LsCd251Ie2 gJK81NzpIPs2SR Received: by escher.local.home (Postfix, from userid 1000) id 5DC861D19F5; Thu, 5 Nov 2009 00:08:01 +0100 (CET) From: Stephen Berman To: 4854@debbugs.gnu.org Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> Sender: steve@escher.local.home Date: Thu, 05 Nov 2009 00:08:00 +0100 In-Reply-To: <87fx8x0yng.fsf@escher.local.home> (Stephen Berman's message of "Mon, 02 Nov 2009 15:49:55 +0100") Message-ID: <877hu5zy5r.fsf@escher.local.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 Here's a slightly simpler test, which has partly different behavior from the one I previously posted. 1. emacs -Q 2. eval this: (defun my-test () (interactive) (unless (let ((ovlist (overlays-in (1- (point)) (1+ (point))))) (when ovlist (overlay-get (car ovlist) 'before-string))) (let ((ov (make-overlay (point) (point) nil))) (overlay-put ov 'before-string "* ")))) 3. eval this: (global-set-key "\C-cy" 'my-test) 4. Insert the string "(test)" into a buffer, put the cursor on `('. 5. Type `C-c y' and/or `M-x my-test' any number of times: the overlay is added once only due to `unless', i.e. this is displayed: * (test) 6. Enable show-paren-mode 7. With the cursor still on `(', type `C-c y' repeatedly => each repetition adds an overlay, e.g. after three repetitions this is displayed (starting from the preceding display): * * * * (test) 8. With the cursor still on `(' and show-paren-mode still enabled, type `M-x my-test' repeatedly => no overlays are added, i.e. the display remains unchanged These two things seem very strange: (i) enabling show-paren-mode and getting the show-paren overlay somehow nullifies the unless test; (ii) this effect only happens when the command is invoked via a key sequence. The result after step 7 seems to be a reproducible heisenbug, in that stepping through my-test (called by typing `C-c y') with edebug does not result in more than one overlay being added. Also, unlike in my OP with narrowing, with the above my-test, typing and deleting a self-inserting character does not prevent repetitions of `C-c y' from adding more overlays. If anyone has any idea what's going on here, or how to debug it, I'd be grateful. Steve Berman From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 01 14:42:32 2016 Received: (at 4854) by debbugs.gnu.org; 1 Jul 2016 18:42:33 +0000 Received: from localhost ([127.0.0.1]:34132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJ3Oa-00060O-Ob for submit@debbugs.gnu.org; Fri, 01 Jul 2016 14:42:32 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:37497) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJ3OY-000601-Ss; Fri, 01 Jul 2016 14:42:31 -0400 Received: by mail-it0-f43.google.com with SMTP id f6so23342869ith.0; Fri, 01 Jul 2016 11:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=6OV14kWpyTO6nMx7nU1v8L8LglZBODbOfajRTg1qLYE=; b=EKbRHz0DdtTZxLM6vVgjyqXb8iKat1uSxBhYPv1BLF/veAwLx4LnzA34g7RVOCx3sE 6Em0ci01Iq16UFtvGonVOgyWxHVQblKJwyqPfsyelfTI6lMp1YlWNRQsVWUNPbroePDM BvKXwOjCyghRHGHbLRlIsqTb5f5m5xqqVaf2NcoVgu+u1afoseDINphDyusKp+CZ4xyy /VxbEB5uD+h3t//am09PK7MiDUHuXZlAMyyLNSftwRnbHihahvj6Xdqxss5ICXfSoNu0 Sw9SdIOF/F514kZbViB0bo+lnfw2Kk3wfADK9+4dnkqE9I3f+iX2pAh2+StZxLkoHLor RR3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=6OV14kWpyTO6nMx7nU1v8L8LglZBODbOfajRTg1qLYE=; b=ZBA7cbO3bgwtVeCknWsBMWQ3aWVtALYZq1Do+KbDUdIOpqLdmkeg66kTMTSwYBSdE/ m6tZGkiCZH/jegaMfMYs0/gP9e8vDlfz847XuSvUj7/O+h6kLxg5H8lXv8L6EkoZplCO lmyQmW7NKcnpOm1PQfP/8QLBO/F2kooqREsTsFpDRhBYDrV8RLNjv3GsSzcOrkOj67q1 ufGVccPdF8VmYchh3miYKQHVPJA+4X+hxUl9yVAOeFg6TcDX4hfkGA0M/Z6ySBwHlMDX jCtR5eNboO3GIiWaRMvGPsTuAC/YRTOafH6UNXnLm4nh8cpO0LAA6hvc2zUjVy1MU+gC GPeg== X-Gm-Message-State: ALyK8tK6GqZYIkPSUNCi2b9cCEO1ZdmpjYuWqplW2sWTZ0tvTlGYMo9exOsyw+RA6eXEZg== X-Received: by 10.36.227.68 with SMTP id d65mr912708ith.75.1467398545265; Fri, 01 Jul 2016 11:42:25 -0700 (PDT) Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id k101sm2025552ioi.9.2016.07.01.11.42.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jul 2016 11:42:24 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stephen Berman Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> <877hu5zy5r.fsf@escher.local.home> Date: Fri, 01 Jul 2016 14:42:30 -0400 In-Reply-To: <877hu5zy5r.fsf@escher.local.home> (Stephen Berman's message of "Thu, 05 Nov 2009 00:08:00 +0100") Message-ID: <87k2h5gpyh.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 4854 Cc: 4854@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) severity 4854 minor tags 4854 notabug quit A simpler test is 1. emacs -Q 2. eval (defun show-overlays () (interactive) (message "ovlist %S" (mapcar (lambda (o) (cons o (overlay-properties o))) (overlays-in (1- (point)) (1+ (point)))))) (global-set-key "\C-cs" 'show-overlays) 3. M-x show-paren-mode 4. with point on a parenthesis C-c s gives ovlist ((# face show-paren-match prio= rity 1000)) M-x show-overlays gives ovlist nil Stephen Berman writes: > These two things seem very strange: (i) enabling show-paren-mode and > getting the show-paren overlay somehow nullifies the unless test; (ii) > this effect only happens when the command is invoked via a key > sequence. It's because show-paren-mode uses a single (pair of) overlay(s) for all buffers and moves it to right place during idle time. When you invoke a command with M-x the overlay pair gets moved to the minibuffer. With a direct keybinding the overlay pair stays in the current buffer. This can be demonstrated by adding this advice (additional to the code evaluated above): (defun debug-show-paren-mode (&rest _args) (message "show-paren-function in buffer %S" (current-buffer))) (advice-add 'show-paren-function :before #'debug-show-paren-mode) When using C-c s: show-paren-function in buffer # [4 times] ovlist ((# face show-paren-match prio= rity 1000)) When using M-x show-overlays: show-paren-function in buffer # [5 times] ovlist nil You can run the command =E2=80=98show-overlays=E2=80=99 with C-c s So I think this is not a bug, it's just how show-paren-mode works. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 03 10:33:34 2016 Received: (at 4854) by debbugs.gnu.org; 3 Jul 2016 14:33:34 +0000 Received: from localhost ([127.0.0.1]:36022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJiSj-0002m5-Sg for submit@debbugs.gnu.org; Sun, 03 Jul 2016 10:33:34 -0400 Received: from mout.gmx.net ([212.227.15.15]:49232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJiSi-0002lt-Gt for 4854@debbugs.gnu.org; Sun, 03 Jul 2016 10:33:32 -0400 Received: from rosalinde ([89.245.64.176]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Llm5o-1bt3H734Mq-00ZQBM; Sun, 03 Jul 2016 16:33:13 +0200 From: Stephen Berman To: npostavs@users.sourceforge.net Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> <877hu5zy5r.fsf@escher.local.home> <87k2h5gpyh.fsf@users.sourceforge.net> Date: Sun, 03 Jul 2016 16:33:12 +0200 In-Reply-To: <87k2h5gpyh.fsf@users.sourceforge.net> (npostavs's message of "Fri, 01 Jul 2016 14:42:30 -0400") Message-ID: <87r3ban653.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:3RoetHAO4syIt9sL6YUZaEj2JyIvkuRXZQkd9q2qGjSYuxkSDtO 1fzGOZxP3dXCtr+C9Rivxp5Ej8DF8a/Q2vEQnx2WRU6g1uC5h8HR7r1DshrmQ9KVoGaukLt vcv+XRxcfkIzHDQgVHgwuO6ikw7nPJDwdAz4nF8+7KHpEjK9xfDJSUAnvWKSpRzuWY9oaOJ UWMdv9OM2yCoDmYbTI1Fw== X-UI-Out-Filterresults: notjunk:1;V01:K0:bzqpgfPiDRg=:YtLbrMIqHXbItaJOhG2Wq6 ToouylR7Eh2Y1Q0KlvbvqdLibJnXLYh/CN39LpQI4tKxfw0CWy4uZLrFb+/Mq7E7fAjHz2I7V rwyh/RG9tjR4l+mD57hqD3ugn1N+1ftc89dqEDBgTFJPY0PsdUq65qdN8rFaicfQYcvJ0RoZB FfYA2/3BV9+OtW3Ei2j1X7ylCV6wQTV+zzkHBjem0APn1ppV9llbQCG7Bwqta4IAYc1oF9xb2 h/fI3brUFBvvHgPnHaailLYGzhjnqdT4FkDOkD2iomPw5HfDWGSuagSkcv0pzE8japsvPS3ya SyfJFLzmXXcSrkNxN6yQAoOpE2wIniPdrUnWq+CPUjAJqWx6g7tAEOA3q4QlnJeBcvSjPfkXx 6Pbrj/5MrElx1HeH3ddkWB+NNG3SZ2h8EvGTRa2C6wsm0trmxkumDom1LAaD6XN94si6oBgw7 Qx5F4t7WyFAy5J5Yg8+smL2t7sjvYoCJAcvWKCaksPTcDBLDl+eO0vB+mCWsKyDC5pd7Sr+U0 6EuBFz48W2OSfiTBbEVueRolg7gIEFASLIyMQaRoeGyJNjMkA0PQbloC5VMCmIl3vEEguSCii CjcAay445kGiAydpJps+43MlWvLu72DI0TijRMFX/9rgCQbMqZIn6zyWlNFn8QWx+WYBbPk5v PzA0Fqvg74j/FG6rovzRqKgJ/kocmJmZPc8Vh3JMU7jMw1gxuWeSzSFxsP1QkmMkvhVcgJptZ cJ2/bHWMiEjd6E4uOS8gQDxkfndwk/xAvsP+4GZ0kS0OxZjW07UcM4UxLguPEdvZ3a6BzikFw u8V3ARw X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 4854 Cc: 4854@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.0 (--) On Fri, 01 Jul 2016 14:42:30 -0400 npostavs@users.sourceforge.net wrote: [...] > Stephen Berman writes: >> These two things seem very strange: (i) enabling show-paren-mode and >> getting the show-paren overlay somehow nullifies the unless test; (ii) >> this effect only happens when the command is invoked via a key >> sequence. > > It's because show-paren-mode uses a single (pair of) overlay(s) for all > buffers and moves it to right place during idle time. When you invoke a > command with M-x the overlay pair gets moved to the minibuffer. With a > direct keybinding the overlay pair stays in the current buffer. Thanks for the diagnosis, which is convincing. > So I think this is not a bug, it's just how show-paren-mode works. I guess you're right; yet this behavior seems to go against the spirit of the way Emacs is intended to work, as suggested by the Emacs manual, node `M-x': "Every Emacs command has a name that you can use to run it. For convenience, many commands also have key bindings. You can run those commands by typing the keys, or run them by name. Most Emacs commands have no key bindings, so the only way to run them is by name. [...] Note that =E2=80=98forward-char=E2=80=99 is the same command t= hat you invoke with the key =E2=80=98C-f=E2=80=99. The existence of a key binding = does not stop you from running the command by name." Are there any other Emacs commands that produce different behavior depending on whether they are invoked with a key binding or by name? Maybe it would be better to unify the behavior of show-paren-mode. (I briefly tried conditioning the calls to move-overlay on whether the current buffer is a minibuffer, but my attempt (which I didn't give much thought to) didn't work.) I guess this bug can be closed, unless leaving it open might spur someone to try and "improve" show-paren-mode. Steve Berman From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 03 11:36:00 2016 Received: (at 4854) by debbugs.gnu.org; 3 Jul 2016 15:36:00 +0000 Received: from localhost ([127.0.0.1]:36075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjRA-0005rN-Ex for submit@debbugs.gnu.org; Sun, 03 Jul 2016 11:36:00 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:33424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjR9-0005rC-1I for 4854@debbugs.gnu.org; Sun, 03 Jul 2016 11:35:59 -0400 Received: by mail-io0-f175.google.com with SMTP id t74so135965799ioi.0 for <4854@debbugs.gnu.org>; Sun, 03 Jul 2016 08:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=eXPrsK4J7xq1VshftUqcsU9dAGbmoaNrXxOtvP2uCzo=; b=BY6St78cY9G+70JjPKDjqrGKa4dkIk1Dp9nUj4fUSEL0CV2jll0/UdjnWcPiY+xpzA rmjqfX3CLpFgmBofNhb+x9JbS6qNW1G8NELMyhsceFmK+Ovdg0FAK88tkaPVLOd0wXC5 ONcarWeXg3HXclByXFe5lJLfoRLFdoT1M64CXOPgPPiAhLsImhTqvdsnAoac5S5fW/Yw mrTzfZQJ2Hs290xXxp1OR8FAZ1lTd7HJhKaSU2/cs34D1FvIbQTjFHd8z4nTi+Ju72OA 7xcx3F3DGobX4TXUE0iLGEKAAoOWqOXgcUvTEaoNmHR6sLTy90AvDl+WyzMbkc7uhmV6 6kKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=eXPrsK4J7xq1VshftUqcsU9dAGbmoaNrXxOtvP2uCzo=; b=Z5uT1Ksyn80THbSXdX2x7TSdHlywLPN8RpQZ9gxGGhwF8x7Jfg+k6rbH8qo+2LYDMx ielTGU5vee55FvtAH/fekcHPLas5OQ3/gUaLZnGq909Op+J3RmuLKjtio3Z9Nit8nLNw 7F2NFP65UAinOjjsPC8iLh/6uIuGSE1rPySK/vJkK6kosrGkOFNiSFXERNvW2vsUamRh 0MXDnB8By5NqQ62238dTJPifMwTm5qP5KigTcN3x7fdbVP1OuaZLLJx8W4bdcigec7EQ qCldGikB/1/dgs1/hGd/vvyFJ95/wTtiFzCymqdB/6xJ/JJ5j4jp4h1r3/LFiXPiVfnl TgnQ== X-Gm-Message-State: ALyK8tLVBUNnwCGH1bMMCqX1W20nJC6e26JXIQ5Fn4mTHZevZSGGoUidxcM9XW26kE7ZbA== X-Received: by 10.107.50.65 with SMTP id y62mr5496287ioy.46.1467560153516; Sun, 03 Jul 2016 08:35:53 -0700 (PDT) Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id p102sm10276604ioi.7.2016.07.03.08.35.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jul 2016 08:35:52 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stephen Berman Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> <877hu5zy5r.fsf@escher.local.home> <87k2h5gpyh.fsf@users.sourceforge.net> <87r3ban653.fsf@gmx.net> Date: Sun, 03 Jul 2016 11:36:01 -0400 In-Reply-To: <87r3ban653.fsf@gmx.net> (Stephen Berman's message of "Sun, 03 Jul 2016 16:33:12 +0200") Message-ID: <874m86g2e6.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 4854 Cc: 4854@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stephen Berman writes: > On Fri, 01 Jul 2016 14:42:30 -0400 npostavs@users.sourceforge.net wrote: > > [...] >> Stephen Berman writes: >>> These two things seem very strange: (i) enabling show-paren-mode and >>> getting the show-paren overlay somehow nullifies the unless test; (ii) >>> this effect only happens when the command is invoked via a key >>> sequence. >> >> It's because show-paren-mode uses a single (pair of) overlay(s) for all >> buffers and moves it to right place during idle time. When you invoke a >> command with M-x the overlay pair gets moved to the minibuffer. With a >> direct keybinding the overlay pair stays in the current buffer. > > Thanks for the diagnosis, which is convincing. > >> So I think this is not a bug, it's just how show-paren-mode works. > > I guess you're right; yet this behavior seems to go against the spirit > of the way Emacs is intended to work, as suggested by the Emacs manual, > node `M-x': "Every Emacs command has a name that you can use to run it. > For convenience, many commands also have key bindings. You can run > those commands by typing the keys, or run them by name. Most Emacs > commands have no key bindings, so the only way to run them is by > name. [...] Note that =E2=80=98forward-char=E2=80=99 is the same command= that you > invoke with the key =E2=80=98C-f=E2=80=99. The existence of a key bindin= g does not stop > you from running the command by name." Are there any other Emacs > commands that produce different behavior depending on whether they are > invoked with a key binding or by name? self-insert-command ;) You can fix your my-test command by changing the condition: (defun my-test () ... (unless (cl-some (lambda (o) (overlay-get o 'before-string)) (overlays-in (1- (point)) (1+ (point)))) ...)) >=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > Maybe it would be better to > unify the behavior of show-paren-mode. (I briefly tried conditioning > the calls to move-overlay on whether the current buffer is a minibuffer, > but my attempt (which I didn't give much thought to) didn't work.) Well, it's possible to avoid moving overlays to minibuffer, but then show-paren-mode stops working in the minibuffer, which I don't think is so great. diff --git i/lisp/paren.el w/lisp/paren.el index 53eb500..1e4942f 100644 --- i/lisp/paren.el +++ w/lisp/paren.el @@ -236,9 +236,10 @@ show-paren--default ;; Find the place to show, if there is one, ;; and show it until input arrives. (defun show-paren-function () - (let ((data (and show-paren-mode (funcall show-paren-data-function)))) + (let ((data (and show-paren-mode (not (minibufferp)) + (funcall show-paren-data-function)))) (if (not data) - (progn + (unless (minibufferp) ;; If show-paren-mode is nil in this buffer or if not at a paren= that ;; has a match, turn off any previous paren highlighting. (delete-overlay show-paren--overlay) With that patch, the original my-test keeps inserting more overlays whether it's called by keybinding or M-x. > > I guess this bug can be closed, unless leaving it open might spur > someone to try and "improve" show-paren-mode. Not sure if there's anything to do. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 03 11:43:00 2016 Received: (at 4854) by debbugs.gnu.org; 3 Jul 2016 15:43:01 +0000 Received: from localhost ([127.0.0.1]:36087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjXw-00062F-M9 for submit@debbugs.gnu.org; Sun, 03 Jul 2016 11:43:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjXv-000622-Cs for 4854@debbugs.gnu.org; Sun, 03 Jul 2016 11:42:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJjXn-0002PZ-8r for 4854@debbugs.gnu.org; Sun, 03 Jul 2016 11:42:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJjXn-0002PV-5g; Sun, 03 Jul 2016 11:42:51 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4728 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bJjXm-0001h2-6M; Sun, 03 Jul 2016 11:42:50 -0400 Date: Sun, 03 Jul 2016 18:42:46 +0300 Message-Id: <83d1muramh.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <874m86g2e6.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> <877hu5zy5r.fsf@escher.local.home> <87k2h5gpyh.fsf@users.sourceforge.net> <87r3ban653.fsf@gmx.net> <874m86g2e6.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 4854 Cc: 4854@debbugs.gnu.org, stephen.berman@gmx.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.3 (------) > From: npostavs@users.sourceforge.net > Date: Sun, 03 Jul 2016 11:36:01 -0400 > Cc: 4854@debbugs.gnu.org > > Well, it's possible to avoid moving overlays to minibuffer, but then > show-paren-mode stops working in the minibuffer, which I don't think is > so great. To say the least. Please don't, I edit expressions in the minibuffer quite a lot, and find show-paren invaluable in general and there in particular. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 03 11:58:15 2016 Received: (at 4854) by debbugs.gnu.org; 3 Jul 2016 15:58:15 +0000 Received: from localhost ([127.0.0.1]:36100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjmg-000812-UV for submit@debbugs.gnu.org; Sun, 03 Jul 2016 11:58:15 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:37634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjmf-00080r-OH for 4854@debbugs.gnu.org; Sun, 03 Jul 2016 11:58:14 -0400 Received: by mail-it0-f53.google.com with SMTP id f6so48953995ith.0 for <4854@debbugs.gnu.org>; Sun, 03 Jul 2016 08:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=m3gDdqfsnNjX4y8iPJNm/oDAAIL5JJagYBMRHR1R7aw=; b=NTzpuBfdBhdGLFuRYVc47zQmb3pp512ADHpgxtC2f6jspRPSGtD19MYyBG3FDP3G7f aozfzPRVNHE0c9yMd0yl3R8KnCtBZdzME3msp6GlLOhkh4z88XQYPiY3naQI//K+ABsZ Sg1dAtL4/v534UthnLBe2e7GBv7ofS9p2dvGeV7IRTdY8Ax26R5oMlsTu+Oc3/IzlN7S W+9Q7NiaNN8FqaDYVG2r6NHk07a+s2SCSPg1jq88MlfLz+HNGwasS5mJLwmhEOy2aptR PvUuyLN82+Xsb69LcEwM7vkf7GGyBKWzWO8B2NwJd/prWeHm31/vMa9UNy5IuFrECYmF VGGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=m3gDdqfsnNjX4y8iPJNm/oDAAIL5JJagYBMRHR1R7aw=; b=lHi2XATIbHEo4t9ueFdCD0mipRuBKM6eLm0G3WlVE1cok9nmW1LWVaB4KcAx+/1aCj XO5okpBVd+bpBODdeYXVVpGMxqDvp9KxzVSz/FniqwuqZOGwbtjEkrGQkEg+m8uRR9/e lubmoEw89WS7BaDV6ifk+ocXh4CU1TDM0GheG7VpOu0n75g4dcJ/cXD0BU4rdxccnbDG p+kqSSb8ltkXc2n5yo/CaI7O2flACLLdmkaWW1+k9InwrgqRhDYCTSZ4VuKkDvESvWsa WWfyQFlJ6ntUX6ej7aZWIfLP0hIwJ6XMZk24TbcDAZBnKgLvcLo0f80jqkbeZU124zL5 IpIg== X-Gm-Message-State: ALyK8tI6Dd8ZPihd5f90g+h6kXF8IOK6YPvKhEJm9UX0UVYq3NqQu02w4HlFLqHwlhG7uw== X-Received: by 10.36.104.17 with SMTP id v17mr5822509itb.52.1467561488207; Sun, 03 Jul 2016 08:58:08 -0700 (PDT) Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id 41sm3859824iod.43.2016.07.03.08.58.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jul 2016 08:58:07 -0700 (PDT) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> <877hu5zy5r.fsf@escher.local.home> <87k2h5gpyh.fsf@users.sourceforge.net> <87r3ban653.fsf@gmx.net> <874m86g2e6.fsf@users.sourceforge.net> <83d1muramh.fsf@gnu.org> Date: Sun, 03 Jul 2016 11:58:16 -0400 In-Reply-To: <83d1muramh.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 03 Jul 2016 18:42:46 +0300") Message-ID: <871t3ag1d3.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 4854 Cc: 4854@debbugs.gnu.org, stephen.berman@gmx.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Date: Sun, 03 Jul 2016 11:36:01 -0400 >> Cc: 4854@debbugs.gnu.org >> >> Well, it's possible to avoid moving overlays to minibuffer, but then >> show-paren-mode stops working in the minibuffer, which I don't think is >> so great. > > To say the least. Please don't, I edit expressions in the minibuffer > quite a lot, and find show-paren invaluable in general and there in > particular. Don't worry, I wasn't intending to. That patch was just for demonstration. I suppose it might be possible to have paren overlay per-buffer, so that the overlay doesn't disappear and reappear all the time, but I don't think it's worth the complication. I'm pretty sure it would remain possible to write a command that's able to observe some inconsistencies regardless: since show-paren-mode relies on idle-timers, the behaviour is affected by the timing of the user's keystrokes. It's best to write commands that are oblivious to what show-paren-mode does (e.g., the (cl-some ...) condition I posted in that same message). From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 03 18:23:42 2016 Received: (at 4854-done) by debbugs.gnu.org; 3 Jul 2016 22:23:42 +0000 Received: from localhost ([127.0.0.1]:36291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJpni-00081W-B5 for submit@debbugs.gnu.org; Sun, 03 Jul 2016 18:23:42 -0400 Received: from mout.gmx.net ([212.227.15.19]:51331) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJpng-00081J-RU for 4854-done@debbugs.gnu.org; Sun, 03 Jul 2016 18:23:41 -0400 Received: from rosalinde ([89.245.64.176]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MF4eJ-1b4juF2CGx-00GLuK; Mon, 04 Jul 2016 00:23:20 +0200 From: Stephen Berman To: npostavs@users.sourceforge.net Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode References: <87fx8x0yng.fsf@escher.local.home> <877hu5zy5r.fsf@escher.local.home> <87k2h5gpyh.fsf@users.sourceforge.net> <87r3ban653.fsf@gmx.net> <874m86g2e6.fsf@users.sourceforge.net> <83d1muramh.fsf@gnu.org> <871t3ag1d3.fsf@users.sourceforge.net> Date: Mon, 04 Jul 2016 00:23:18 +0200 In-Reply-To: <871t3ag1d3.fsf@users.sourceforge.net> (npostavs's message of "Sun, 03 Jul 2016 11:58:16 -0400") Message-ID: <87inwmmkdl.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:gqkwWYtA/WEbt6DINvhFF/pMPylgw/NdMEOYXNyEBprhd2TXJ1H h/dw0j2fMMrtfjRdPuvLGORq1iTB9uSkLdGsLQkDalImkOeKPWfb6ZmbcDIILe4sg3dW5LN xX/vaM3+pIpexvSBbaAMLa9gerdRQAtY7TMTE6N+mVGWRYqha01WybPBAkgG+xFjGfX4Zxx QoX4j3Cf3SmxqSCk9UMog== X-UI-Out-Filterresults: notjunk:1;V01:K0:BZ779ADamGU=:MXJE6IN0I4vxsazWhY/PeZ EfvPsZGNVWiQVpKybaNOBiWl7cpsaX0SM8gG1RpPpAKA7dzObmVtLzxoxkepGiVecN7krFPdB JRU4/mstlC/KGbMmDPrEfs5vXYQdOazeHxVvMJEQZGtsrY+g4JW49ieo9tjbvArk7IpBydLXo KyxG3MR37415ltKsguG28ePy0LJWp2q5q7iplOyzo2Lf5PBQHxAK7wQPczwaod9okgV3S2UTG yN0Qy2z/GjB/0JycPJuu1L5Bq4fjbxjscoUJ49rXkov5k1ZT6gw9RISnSQvN3ic7rHqUHGnhk WbNOas4ztXYpp85DgB6Da/Zi4SI0GyXV1InlJFMywEMUGsO33QAeZqjMylKdG0qFn+jM5dExG JB1nJljzGTp+0DeZxy1QhOA0GFsNVIi/O3AeEh6UZvpwh2rChncEQML+MJ+9+AsyVHMDSRgRL Lc0pa9rSub78OXCSkGnR3M6E3/4NMxCDhZFgLqLQLtbC9IU1Z3XsIjTZy582OKDD71CRuWtMH gLXlPAxoRb2a3SQdOOMByR6tMg1Lw5A84IOw/ugd0qxHUnzDtwMX4k0GT19U06yiXUg+RmUJ7 UF1KLMsRiweFAmfCzLDDrHI6sPNum56dpsr+RFj9NjWD2j3DPsrXX8kmr5SK/+FexopjjsVxq hv+gWnxvsFYJbsyTt5Foy/MSr9ioeSdxHcH3fJAleUt91hmwVfATIQVZHib2iwOGdrr9nex+U iZN9aMR+TjGNG80C4eaWaPpGuX+4iAhcTfvapnpNartsRP41f4xjpVUMOqKT7vOJk1H4AJqAx 1+N2oFN X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 4854-done Cc: Eli Zaretskii , 4854-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.0 (--) On Sun, 03 Jul 2016 11:58:16 -0400 npostavs@users.sourceforge.net wrote: > Eli Zaretskii writes: > >>> From: npostavs@users.sourceforge.net >>> Date: Sun, 03 Jul 2016 11:36:01 -0400 >>> Cc: 4854@debbugs.gnu.org >>> >>> Well, it's possible to avoid moving overlays to minibuffer, but then >>> show-paren-mode stops working in the minibuffer, which I don't think is >>> so great. >> >> To say the least. Please don't, I edit expressions in the minibuffer >> quite a lot, and find show-paren invaluable in general and there in >> particular. > > Don't worry, I wasn't intending to. That patch was just for > demonstration. I completely agree that preventing show-paren-mode from working in the minibuffer is out of the question. > I suppose it might be possible to have paren overlay > per-buffer, so that the overlay doesn't disappear and reappear all the > time, but I don't think it's worth the complication. I'm pretty sure it > would remain possible to write a command that's able to observe some > inconsistencies regardless: since show-paren-mode relies on idle-timers, > the behaviour is affected by the timing of the user's keystrokes. It's probably not worth putting much effort into trying to change it, though I still think it's surprising, and not unlikely an unintended consequence of the implementation of show-paren-mode, that the effect of invoking a command that interacts with it differs depending on how it's invoked (self-insert-command is really a special case, I think). > It's > best to write commands that are oblivious to what show-paren-mode does > (e.g., the (cl-some ...) condition I posted in that same message). This is certainly sound advice, and indeed I applied it long ago in dealing with the issue (in todo-mode.el) that prompted this bug report. Again, thanks for the feedback and clarifying the issue. I'm closing this bug now. Steve Berman From unknown Sat Aug 16 15:58:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 01 Aug 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator