[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
before-string overlay and show-paren-mode
From: |
Stephen Berman |
Subject: |
before-string overlay and show-paren-mode |
Date: |
Sat, 31 Oct 2009 01:32:19 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
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.
Is the described behavior after enabling show-paren-mode expected? If
so, can anyone explain it?
Steve Berman
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- before-string overlay and show-paren-mode,
Stephen Berman <=