From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: compile-command customisation Date: Sat, 26 Feb 2005 21:43:50 -0500 Organization: Bell Sympatico Message-ID: <87r7j2endh.fsf-monnier+gnu.emacs.help@gnu.org> References: <87zmxvz5y9.fsf-monnier+gnu.emacs.help@gnu.org> <86is4fkljt.fsf@pallotta.studby.uio.no> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109473023 28469 80.91.229.2 (27 Feb 2005 02:57:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 27 Feb 2005 02:57:03 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 27 03:57:03 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5Ebm-0000kB-2Z for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Feb 2005 03:56:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5Etq-0007AK-MX for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Feb 2005 22:15:18 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!cyclone.bc.net!snoopy.risq.qc.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:4NFB2tq9JhU6xKO2TOD0PjTHJho= Original-Lines: 31 Original-NNTP-Posting-Host: 67.68.218.40 Original-X-Complaints-To: abuse@sympatico.ca Original-X-Trace: news20.bellglobal.com 1109472230 67.68.218.40 (Sat, 26 Feb 2005 21:43:50 EST) Original-NNTP-Posting-Date: Sat, 26 Feb 2005 21:43:50 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:128853 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:24393 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24393 > This is what I've been using: > (global-set-key (kbd "C-") #'(lambda () > (interactive) > (find-file "~/.emacs.el"))) > Is this "wrong", and why? No, it's not wrong. while strictly speaking it's calling find-file from elisp, it's not what I meant by "calling find-file from elisp". The difference is that the purpose of your elisp function is to call find-file, so of course it should do that. > 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. Indeed, it's no better. Because `switch-to-buffer' should also usually be avoided (unless it's indeed exactly what you want to do). See C-h f switch-to-buffer RET for example (or the fact that switch-to-buffer signals an error if you try to use it in a dedicated window or in a minibuffer window). Stefan