From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: steinab@ifi.uio.no (Steinar =?iso-8859-1?Q?B=F8rmer?=) Newsgroups: gmane.emacs.help Subject: Re: compile-command customisation Date: Sat, 26 Feb 2005 23:13:56 +0100 Organization: :noitazinagrO Message-ID: <86ll9bklzv.fsf@pallotta.studby.uio.no> References: <87zmxvz5y9.fsf-monnier+gnu.emacs.help@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109456213 14077 80.91.229.2 (26 Feb 2005 22:16:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Feb 2005 22:16:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 26 23:16:53 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5AEy-000515-5r for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Feb 2005 23:16:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5AX0-0001OY-63 for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Feb 2005 17:35:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!irazu.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feed.news.tiscali.de!newsfeed.tiscali.ch!npeer.de.kpn-eurorings.net!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: ti400720a081-9876.bb.online.no Original-X-Trace: quimby.gnus.org 1109455920 974 85.164.230.148 (26 Feb 2005 22:12:00 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Sat, 26 Feb 2005 22:12:00 +0000 (UTC) User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (berkeley-unix) Cancel-Lock: sha1:0Bh2/cpPeHZXWedzmA2bYHvvytU= Original-Xref: shelby.stanford.edu gnu.emacs.help:128848 Original-To: help-gnu-emacs@gnu.org 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 X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24388 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24388 Stefan Monnier wrote: | > (if (file-exists-p "Makefile") | > (progn | > (find-file "Makefile") | | Never call `find-file' from elisp. | Instead, use (with-current-buffer (find-file-noselect "Makefile") ...). I assume the reason is because find-file is meant to be used interactively? I use find-file in my .emacs.el, and realized that I need a generic defun if find-file is not "good". This is what I've been using: (global-set-key (kbd "C-") #'(lambda () (interactive) (find-file "~/.emacs.el"))) Is this "wrong", and why? I assume something like the following is a good way to avoid find-file, but it seems overly elaborate: (defun quick-find (file) "Find the file FILE." (let ((buffer (with-current-buffer (find-file-noselect file)))) (switch-to-buffer buffer))) It also appears to do pretty much the same as find-file itself. Comments? -- SB