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


Message #15 received at control <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 4854 <at> debbugs.gnu.org
Subject: Re: bug#4854: 23.1.50; before-string overlay and show-paren-mode
Date: Fri, 01 Jul 2016 14:42:30 -0400
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 ((#<overlay from 730 to 731 in *scratch*> face show-paren-match priority 1000))

M-x show-overlays gives

ovlist nil

Stephen Berman <stephen.berman <at> gmx.net> 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 #<buffer *scratch*> [4 times]
ovlist ((#<overlay from 506 to 507 in *scratch*> face show-paren-match priority 1000))

When using M-x show-overlays:

show-paren-function in buffer #<buffer  *Minibuf-1*> [5 times]
ovlist nil
You can run the command ‘show-overlays’ with C-c s

So I think this is not a bug, it's just how show-paren-mode works.




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.