From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philippe Waroquiers Newsgroups: gmane.emacs.bugs Subject: ada-mode ada-initialize-properties has an error with read-only files Date: Fri, 10 Aug 2007 13:17:28 +0200 (METDST) Message-ID: <200708101117.NAA25787@gull.cfmu.corp.eurocontrol.int> Reply-To: philippe.waroquiers@eurocontrol.int NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1186744678 29137 80.91.229.12 (10 Aug 2007 11:17:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2007 11:17:58 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 10 13:17:56 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IJSV9-0007UP-Hh for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Aug 2007 13:17:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJSV8-0008Uj-JJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Aug 2007 07:17:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IJSV5-0008UG-R6 for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2007 07:17:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IJSV4-0008U0-75 for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2007 07:17:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJSV4-0008Tx-4V for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2007 07:17:50 -0400 Original-Received: from exprod8og52.obsmtp.com ([64.18.3.86]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IJSV3-0002wU-JO for bug-gnu-emacs@gnu.org; Fri, 10 Aug 2007 07:17:49 -0400 Original-Received: from source ([193.221.170.179]) by exprod8ob52.obsmtp.com ([64.18.7.12]) with SMTP; Fri, 10 Aug 2007 04:17:37 PDT Original-Received: from HHBRUE006.hq.corp.eurocontrol.int (hhbrue006.hq.corp.eurocontrol.int [193.221.160.195]) by biscuit.eurocontrol.int (8.12.10/8.12.7) with ESMTP id l7ABHL5t027640 for ; Fri, 10 Aug 2007 13:17:33 +0200 (MEST) Original-Received: from FFBRUE001.cfmu.corp.eurocontrol.int ([193.58.25.51]) by HHBRUE006.hq.corp.eurocontrol.int with Microsoft SMTPSVC(6.0.3790.1830); Fri, 10 Aug 2007 13:17:32 +0200 Original-Received: from gull.cfmu.corp.eurocontrol.int ([193.221.186.140]) by FFBRUE001.cfmu.corp.eurocontrol.int with Microsoft SMTPSVC(6.0.3790.1830); Fri, 10 Aug 2007 13:17:32 +0200 Original-Received: (from wao@localhost) by gull.cfmu.corp.eurocontrol.int (8.9.3 (PHNE_34936)/8.9.3) id NAA25787; Fri, 10 Aug 2007 13:17:28 +0200 (METDST) X-OriginalArrivalTime: 10 Aug 2007 11:17:32.0490 (UTC) FILETIME=[0BC072A0:01C7DB40] X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16313 Archived-At: We have encountered a small problem with the ada-mode and emacs 22. When an Ada file is visited in emacs (in this case, I find this file with M-x find-tag) and this Ada file is a read-only file, we see an error message appearing in the mini-buffer/*Messages*: File mode specification error: (buffer-read-only #) After investigation, we see that this error message is produced by ada-initialize-properties. To see what is going wrong, I have added various calls to (message) inside ada-initialize-properties (see modified code below). We get the messages "1", "2", "2.1" but not "3" .. "6" => so this looks to be the indication of a real problem as ada-initialize-properties does not finish its work. (NB: I tested with emacs 21 the same "message" modifications. With emacs 21, ada-initialize-properties properly does the loops. E.g. it gives multiple messages "2.1", and then gives the messages "3" .. "6". The consequences of this problem are not clear to me. I suspect I see not much consequences because font-lock-mode is also enabled, and this may "repair" the properties. I however highly suspect that in case font-lock-mode is not active, that ada-mode has a bug. I suspect that one way or another, in emacs 21, ada-initialize-properties was called in a context where the buffer could be temporarily modified, while with emacs 22, this is not the case anymore. I see that ada-initialize-properties is doing things similar to font-lock. font-lock has defined a macro save-buffer-state to save/set/restore buffer state when setting properties. A.o., it sets and then restores inhibit-read-only and other things. Maybe ada-mode should use this macro or a similar logic ? (defun ada-initialize-properties () "Initialize some special text properties in the whole buffer. In particular, character constants are said to be strings, #...# are treated as numbers instead of gnatprep comments." (message "1") (save-excursion (save-restriction (widen) (goto-char (point-min)) (message "2") (while (re-search-forward "'.'" nil t) (progn (message "2.1") (add-text-properties (match-beginning 0) (match-end 0) '(syntax-table ("'" . ?\"))))) (goto-char (point-min)) (message "3") (while (re-search-forward "^[ \t]*#" nil t) (add-text-properties (match-beginning 0) (match-end 0) '(syntax-table (11 . 10)))) (message "4") (set-buffer-modified-p nil) (message "5") ;; Setting this only if font-lock is not set won't work ;; if the user activates or deactivates font-lock-mode, ;; but will make things faster most of the time (add-hook 'after-change-functions 'ada-after-change-function nil t) (message "6") ))) In GNU Emacs 22.1.1 (hppa1.1-hp-hpux11.11, Motif Version 2.1.0) of 2007-08-04 on bobcat Windowing system distributor `Hewlett-Packard Company', version 11.0.600000 configured using `configure 'hppa1.1-hp-hpux11.11' '--prefix=/cm/ot/TOOL/GNU!12.43/build_G!67.IP.11/generated' '--exec-prefix=/cm/ot/TOOL/GNU!12.43/build_G!67.IP.11/generated/libexec/emacs-22.1' '--mandir=/cm/ot/TOOL/GNU!12.43/build_G!67.IP.11/generated/man' '--with-gcc=no' '--with-xpm' '--with-x11r6' '--with-x-toolkit=motif' '--x-libraries=/usr/lib/X11R6:/usr/contrib/X11R6/lib' 'build_alias=hppa1.1-hp-hpux11.11' 'host_alias=hppa1.1-hp-hpux11.11' 'target_alias=hppa1.1-hp-hpux11.11' 'CFLAGS=-g -Ae +O0 +DA1.1' 'LDFLAGS= -L/cm/ot/TOOL/GNU!12.43/build_G!67.IP.11/generated/work/emacs-22.1/xpm-3.4k/lib' 'CPPFLAGS=-I/cm/ot/TOOL/GNU!12.43/build_G!67.IP.11/generated/work/emacs-22.1/xpm-3.4k '' 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: C locale-coding-system: nil default-enable-multibyte-characters: nil -- Philippe WAROQUIERS Eurocontrol - Central Flow Management Unit philippe.waroquiers@eurocontrol.int Rue de la fusee, 96 Tel: +32 2 729 97 35 1130 Brussels Fax: +32 2 729 90 22 Belgium ____ This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful. Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy. Any views expressed in this message are those of the sender.