From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#10419: 23.3; byte-compile-file: Buffer is read-only: # Date: Sun, 01 Jan 2012 20:48:07 +0100 Message-ID: <871urjgq6g.fsf@web.de> Reply-To: michael_heerdegen@web.de NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1325447286 523 80.91.229.12 (1 Jan 2012 19:48:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 Jan 2012 19:48:06 +0000 (UTC) To: 10419@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 01 20:48:00 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RhRNv-00076C-Cn for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jan 2012 20:47:59 +0100 Original-Received: from localhost ([::1]:41803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhRNu-0007hP-Vc for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jan 2012 14:47:58 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:55110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhRNr-0007h8-5M for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:47:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhRNp-0002dH-VZ for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:47:55 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:32778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhRNp-0002dD-SW for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:47:53 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RhRQs-0003H2-5v for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2012 19:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10419 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.132544740912519 (code B ref -1); Sun, 01 Jan 2012 19:51:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jan 2012 19:50:09 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RhRQ0-0003Fr-KC for submit@debbugs.gnu.org; Sun, 01 Jan 2012 14:50:09 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RhRPu-0003Fg-Ht for submit@debbugs.gnu.org; Sun, 01 Jan 2012 14:50:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhRMq-0002au-CN for submit@debbugs.gnu.org; Sun, 01 Jan 2012 14:46:53 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:47128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhRMq-0002aq-Au for submit@debbugs.gnu.org; Sun, 01 Jan 2012 14:46:52 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:54997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhRMn-0007ae-Qn for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:46:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhRMm-0002aN-EW for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:46:49 -0500 Original-Received: from fmmailgate01.web.de ([217.72.192.221]:36335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhRMl-0002a9-U4 for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2012 14:46:48 -0500 Original-Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate01.web.de (Postfix) with ESMTP id 111881A7E8CE4 for ; Sun, 1 Jan 2012 20:46:46 +0100 (CET) Original-Received: from snow ([89.204.137.59]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0LoYFm-1SNcwo38ZO-00gW54; Sun, 01 Jan 2012 20:46:45 +0100 X-Provags-ID: V02:K0:H5dwr7oE+o46dXiMQL7Yx5tqnRSeIhl1XZyv/VL16Dn XqvFrZnVj6Jce9n9grTKbG8CLqZoSKde+y7PeLwJDyUoSGFwA3 mUTsizRNWJRKhsNaN71/mxrqmnJ3uRFiXiCxB5Zao9+JXQte+h 6r/Xou875Cys1A2FdjQpo5OxVdavDxGrioxKyAlP7sUItLlgXY jrJbwt7Iu1MAl6bzZP12q4w98mOtU/7TCjflV5hQbg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 01 Jan 2012 14:51:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55346 Archived-At: Hi, this is a simple issue, though some explanation is necessary. Background: I have a large Emacs init file. Because I often want to have a look at function definitions in this file, I added a file local variable binding of `buffer-read-only' to t. This way, e.g. links from *Help* always open it read only. I have to explicitly toggle the read-only flag if I want to modify the file. This works well. Now, imagine the following scenario: I open my init file and toggle the read-only flag. I make some changes. Then, I compile it with M-x emacs-lisp-byte-compile. While compilation is in progress, I recognize that I made an error while editing. I cancel compilation by hitting C-g. I correct my mistake, and try to compile again with `emacs-lisp-byte-compile'. Then I get the following error: byte-compile-file: Buffer is read-only: # This is the bug. Here is why that happens. This is the problematic piece of code in `byte-compile-file': (with-current-buffer (setq input-buffer (get-buffer-create " *Compiler Input*")) (erase-buffer) (setq buffer-file-coding-system nil) ;; Always compile an Emacs Lisp file as multibyte ;; unless the file itself forces unibyte with -*-coding: raw-text;-*- (set-buffer-multibyte t) (insert-file-contents bytecomp-filename) ;; Mimic the way after-insert-file-set-coding can make the ;; buffer unibyte when visiting this file. (when (or (eq last-coding-system-used 'no-conversion) (eq (coding-system-type last-coding-system-used) 5)) ;; For coding systems no-conversion and raw-text..., ;; edit the buffer as unibyte. (set-buffer-multibyte nil)) ;; Run hooks including the uncompression hook. ;; If they change the file name, then change it for the output also. (letf ((buffer-file-name bytecomp-filename) ((default-value 'major-mode) 'emacs-lisp-mode) ;; Ignore unsafe local variables. ;; We only care about a few of them for our purposes. (enable-local-variables :safe) (enable-local-eval nil)) ;; Arg of t means don't alter enable-local-variables. (normal-mode t) (setq bytecomp-filename buffer-file-name)) ;; Set the default directory, in case an eval-when-compile uses it. (setq default-directory (file-name-directory bytecomp-filename))) In the first compilation run, the buffer " *Compiler Input*" is made read-only (and left read-only after aborting with C-g) because `enable-local-variables' is bound to :safe and `normal-mode' is called and there is the binding of `buffer-read-only' to t. In the second compilation run, `erase-buffer' is called on the read-only buffer. This gives the error. Thanks, Michael. In GNU Emacs 23.3.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2011-10-26 on murphy, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11102902 configured using `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp' '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes' '--with-x-toolkit=lucid' '--with-toolkit-scroll-bars' '--without-gconf' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2'' Important settings: value of $LC_ALL: de_DE.utf8 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: C value of $LANG: de_DE.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Org-Agenda Week Ddl Grid Minor modes in effect: TeX-PDF-mode: t shell-dirtrack-mode: t ml-scale-mode: t which-function-mode: t display-time-mode: t show-paren-mode: t auto-image-file-mode: t global-undo-tree-mode: t Info-breadcrumbs-in-mode-line-mode: t icicle-mode: t minibuffer-depth-indicate-mode: t hl-line-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: (only . t)