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 (find-file-noselect file))) (switch-to-buffer buffer))) It also appears to do pretty much the same as find-file itself. Comments? -- SB _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs