From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: timers and match-data Date: Mon, 30 May 2005 20:40:42 -0500 (CDT) Message-ID: <200505310140.j4V1egr16148@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1117504089 25350 80.91.229.2 (31 May 2005 01:48:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 May 2005 01:48:09 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 31 03:48:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dcvqk-0005l8-Ux for ged-emacs-devel@m.gmane.org; Tue, 31 May 2005 03:47:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dcvtj-0001LF-S6 for ged-emacs-devel@m.gmane.org; Mon, 30 May 2005 21:50:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dcvt3-00016J-8J for emacs-devel@gnu.org; Mon, 30 May 2005 21:49:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dcvsy-00014V-Rw for emacs-devel@gnu.org; Mon, 30 May 2005 21:49:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dcvsy-0000zm-Go for emacs-devel@gnu.org; Mon, 30 May 2005 21:49:40 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DcvmT-0005cY-OS for emacs-devel@gnu.org; Mon, 30 May 2005 21:42:58 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j4V1fECK026902 for ; Mon, 30 May 2005 20:41:14 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j4V1egr16148; Mon, 30 May 2005 20:40:42 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org 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:37914 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37914 (elisp)Saving Match Data contains: Emacs automatically saves and restores the match data when it runs process filter functions (*note Filter Functions::) and process sentinels (*note Sentinels::). But this apparently does not apply to timers. This leads to very concrete problems. If one autoreverts the Buffer Menu, if Buffer-menu-use-header-line is t, enable-local-variables is 'ask and one does `C-h n' and waits too long before answering `y' to the y-or-n-p question,, the NEWS does not get put in Outline Mode, because of a Local Variables error, due to the fact that autoreverting the Buffer Menu changed the match data. To avoid such problems, either: 1. Every function that waits for input or otherwise allows for timers to run should save and restore the match data. 2. We should make timers automatically save and restore match data. 3. Any individual timer function that potentially could alter the match data should save and restore the match data. Which one? If (3), I could make autorevert use save-match-data. If (1), the patch below to files.el solves the `C-h n' problem. ===File ~/files-diff======================================== *** files.el 20 May 2005 21:47:22 -0500 1.772 --- files.el 30 May 2005 19:26:40 -0500 *************** *** 2172,2181 **** (save-excursion (beginning-of-line) (set-window-start (selected-window) (point))) ! (y-or-n-p (format string ! (if buffer-file-name ! (file-name-nondirectory buffer-file-name) ! (concat "buffer " (buffer-name))))))))) (defun hack-local-variables-prop-line (&optional mode-only) "Set local variables specified in the -*- line. --- 2172,2182 ---- (save-excursion (beginning-of-line) (set-window-start (selected-window) (point))) ! (save-match-data ! (y-or-n-p (format string ! (if buffer-file-name ! (file-name-nondirectory buffer-file-name) ! (concat "buffer " (buffer-name)))))))))) (defun hack-local-variables-prop-line (&optional mode-only) "Set local variables specified in the -*- line. ============================================================