GNU bug report logs - #4854
23.1.50; before-string overlay and show-paren-mode

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Mon, 2 Nov 2009 15:35:04 UTC

Severity: minor

Tags: notabug

Done: Stephen Berman <stephen.berman <at> gmx.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#4854: closed (23.1.50; before-string overlay and show-paren-mode)
Date: Sun, 03 Jul 2016 22:24:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 04 Jul 2016 00:23:18 +0200
with message-id <87inwmmkdl.fsf <at> gmx.net>
and subject line Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode
has caused the debbugs.gnu.org bug report #4854,
regarding 23.1.50; before-string overlay and show-paren-mode
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
4854: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4854
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stephen Berman <stephen.berman <at> gmx.net>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; before-string overlay and show-paren-mode
Date: Mon, 02 Nov 2009 15:49:55 +0100
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

[Message part 3 (message/rfc822, inline)]
From: Stephen Berman <stephen.berman <at> gmx.net>
To: npostavs <at> users.sourceforge.net
Cc: Eli Zaretskii <eliz <at> gnu.org>, 4854-done <at> debbugs.gnu.org
Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode
Date: Mon, 04 Jul 2016 00:23:18 +0200
On Sun, 03 Jul 2016 11:58:16 -0400 npostavs <at> users.sourceforge.net wrote:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: npostavs <at> users.sourceforge.net
>>> Date: Sun, 03 Jul 2016 11:36:01 -0400
>>> Cc: 4854 <at> 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


This bug report was last modified 9 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.