[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compile-command customisation
From: |
Steinar Børmer |
Subject: |
Re: compile-command customisation |
Date: |
Sat, 26 Feb 2005 23:13:56 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (berkeley-unix) |
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-<f6>") #'(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
- compile-command customisation, Daniel Wright, 2005/02/23
- Re: compile-command customisation, Stefan Monnier, 2005/02/23
- Re: compile-command customisation, Kevin Rodgers, 2005/02/23
- Re: compile-command customisation, Thien-Thi Nguyen, 2005/02/23
- Re: compile-command customisation, Daniel Wright, 2005/02/24
- Re: compile-command customisation, Daniel Wright, 2005/02/24
- Re: compile-command customisation, Daniel Wright, 2005/02/24
- Re: compile-command customisation, Stefan Monnier, 2005/02/25