From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sven Joachim Newsgroups: gmane.emacs.help Subject: Re: Bug when compiling elc code? Date: Wed, 08 Aug 2007 16:59:41 +0200 Message-ID: <87lkcmqdgi.fsf@gmx.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1186585026 15561 80.91.229.12 (8 Aug 2007 14:57:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Aug 2007 14:57:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 08 16:57:03 2007 Return-path: Envelope-to: geh-help-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 1IImy6-0005rw-4l for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Aug 2007 16:57:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IImy5-0000ps-PB for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Aug 2007 10:57:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IImxq-0000nm-9n for help-gnu-emacs@gnu.org; Wed, 08 Aug 2007 10:56:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IImxp-0000mR-9f for help-gnu-emacs@gnu.org; Wed, 08 Aug 2007 10:56:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IImxp-0000mC-2e for help-gnu-emacs@gnu.org; Wed, 08 Aug 2007 10:56:45 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IImxo-0000p8-FB for help-gnu-emacs@gnu.org; Wed, 08 Aug 2007 10:56:44 -0400 Original-Received: (qmail invoked by alias); 08 Aug 2007 14:56:43 -0000 Original-Received: from p54864F17.dip.t-dialin.net (EHLO debian) [84.134.79.23] by mail.gmx.net (mp004) with SMTP; 08 Aug 2007 16:56:43 +0200 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX1/D9FwrxqHD7BI5s1ZLwkmTXRzAU/2s2B5Yfhwmn/ rHFajVjbLtYa1u In-Reply-To: ("Johan =?iso-8859-1?Q?Bockg=E5rd=22's?= message of "Wed\, 08 Aug 2007 15\:18\:03 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:46407 Archived-At: bojohan+news@dd.chalmers.se (Johan Bockgård) writes: > Sven Joachim writes: > >> (let ((old-mode (default-file-modes))) >> (set-default-file-modes (file-modes buffer-file-name)) >> (byte-compile-file buffer-file-name) >> (set-default-file-modes old-mode))) > > You should use `unwind-protect' here. Right, thanks. Is the following okay? (add-hook 'emacs-lisp-mode-hook '(lambda () (make-local-hook 'after-save-hook) (add-hook 'after-save-hook '(lambda () (let ((old-mode (default-file-modes))) (unwind-protect (progn (set-default-file-modes (file-modes buffer-file-name)) (byte-compile-file buffer-file-name)) (set-default-file-modes old-mode)))) nil t)))