|
From: | Douglas Lewan |
Subject: | Re: wrong type error in local variables |
Date: | Thu, 2 Jul 2020 21:40:16 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 7/2/20 9:19 PM, Emanuel Berg via Users list for the GNU Emacs text editor wrote:
Stefan Monnier wrote:`find-file` should not be called from Elisp. Use `find-file-noselect` instead.Oups, if so I have 15 changes to make. Why doesn't the byte compiler say this?Because noone has added the annotation for it yet (tho there are various comments in the code that say so).Okay, but what exactly is the problem with it, from Lisp?
The problem is that it changes the buffer.If a (find-file) fails and you were depending on the change of the current buffer all kinds of other things might go wrong.
If you use (find-file-noselect), then the current buffer doesn't change and any attempt to use that buffer would fail. In particular, you should be verifying that the (find-file-noselect) succeeded.
-- ,Doug d.lewan2000@gmail.com (908) 720 7908 If this is what winning looks like, I'd hate to see what losing is.
[Prev in Thread] | Current Thread | [Next in Thread] |