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 Supersedes: <86ll9bklzv.fsf@pallotta.studby.uio.no> Date: Sat, 26 Feb 2005 23:23:34 +0100 Organization: :noitazinagrO Message-ID: <86is4fkljt.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 1109456811 26555 80.91.229.2 (26 Feb 2005 22:26:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Feb 2005 22:26:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 26 23:26:51 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5AOd-0005ok-AF for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Feb 2005 23:26:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5Agf-0003x0-9W for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Feb 2005 17:45:25 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.uchicago.edu!nntp-server.caltech.edu!hammer.uoregon.edu!arclight.uoregon.edu!newsfeed-00.mathworks.com!irazu.switch.ch!switch.ch!news.belwue.de!LF.net!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 1109456498 974 85.164.230.148 (26 Feb 2005 22:21:38 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Sat, 26 Feb 2005 22:21:38 +0000 (UTC) User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (berkeley-unix) Cancel-Key: sha1:k8Xn4mX28yxzJOTIIF5OhUSKRyQ= Cancel-Lock: sha1:vdSkT8S9p89WFp2v+PyNtRcxk3U= Original-Xref: shelby.stanford.edu gnu.emacs.help:128849 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:24389 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24389 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 (find-file-noselect file))) (switch-to-buffer buffer))) It also appears to do pretty much the same as find-file itself. Comments? -- SB