From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: before-string overlay and show-paren-mode Date: Sat, 31 Oct 2009 01:32:19 +0100 Message-ID: <87k4ycpfn0.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256949182 26186 80.91.229.12 (31 Oct 2009 00:33:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Oct 2009 00:33:02 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 31 01:32:55 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N41tm-00067i-Dk for ged-emacs-devel@m.gmane.org; Sat, 31 Oct 2009 01:32:54 +0100 Original-Received: from localhost ([127.0.0.1]:52170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N41tl-000104-U3 for ged-emacs-devel@m.gmane.org; Fri, 30 Oct 2009 20:32:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N41th-0000zk-2z for emacs-devel@gnu.org; Fri, 30 Oct 2009 20:32:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N41tc-0000zE-Ea for emacs-devel@gnu.org; Fri, 30 Oct 2009 20:32:48 -0400 Original-Received: from [199.232.76.173] (port=34128 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N41tc-0000zB-B9 for emacs-devel@gnu.org; Fri, 30 Oct 2009 20:32:44 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:44934) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N41tb-0001g6-Ui for emacs-devel@gnu.org; Fri, 30 Oct 2009 20:32:44 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1N41tZ-00065Q-8J for emacs-devel@gnu.org; Sat, 31 Oct 2009 01:32:41 +0100 Original-Received: from i59f55ccb.versanet.de ([89.245.92.203]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 31 Oct 2009 01:32:41 +0100 Original-Received: from stephen.berman by i59f55ccb.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 31 Oct 2009 01:32:41 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 43 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: i59f55ccb.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116487 Archived-At: 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