emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERT indentation testing


From: Ted Zlatanov
Subject: Re: ERT indentation testing
Date: Fri, 03 Jun 2011 06:33:27 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Thu, 02 Jun 2011 21:04:59 -0300 Stefan Monnier <address@hidden> wrote: 

>> Uses `find-file' to process the local variables correctly.

SM> Never call `find-file' from Elisp.  Always call
SM> find-file-noselect instead.

I was trying to copy your original test, which I think uses `find-file':

#+begin_src makefile
%.test: %
        -$(RM) $<.new
        $(EMACS) --batch $< \
            --eval '(indent-region (point-min) (point-max) nil)' \
            --eval '(write-region (point-min) (point-max) "$<.new")'
        diff -u -B $< $<.new

#+end_src

Using `find-file-noselect' will just make me select the buffer in ELisp
instead of expecting it to become current.  Is there any real reason to
avoid `find-file'?  Because of the prompts?  I ask because I'm curious;
I've already changed my patch to use (set-buffer (find-file-noselect...))
but can't commit because the Bazaar repo is down.

Also, if `find-file' should be avoided in ELisp generally, the docstring
should say so, like it does for many other functions.

Actually it might be nice if there was a standard way to tag such
extra-interactive functions that are not supposed to be called from an
ELisp context, only from `M-x' or through a key.  A symbol property
maybe?  Then the compiler could check it and print suitable errors...
Tell me it already exists :)

Thanks
Ted




reply via email to

[Prev in Thread] Current Thread [Next in Thread]