[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extra-interactive functions
From: |
martin rudalics |
Subject: |
Re: extra-interactive functions |
Date: |
Fri, 03 Jun 2011 17:27:45 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (Windows/20090302) |
> mr> `find-file' uses `switch-to-buffer' and `switch-to-buffer' should be
> mr> avoided in Elisp code.
>
> The docstring for `switch-to-buffer' says not to use it to avoid
> "messing with the window-buffer correspondences" which is good enough
> for me (though I'm still curious what that really means).
A user might want to display that file visting buffer in a certain way
and has customized options like `special-display-buffer-names' or
`special-display-regexps' for that purpose. If you call
`switch-to-buffer', the user cannot control the placement of the buffer
in the window or frame of her choice.
>>> Also, if `find-file' should be avoided in ELisp generally, the docstring
>>> should say so, like it does for many other functions.
>
> mr> Indeed.
>
> But that's tedious to do by hand. If we tag the function symbol
> (e.g. `switch-to-buffer') with some extra-interactive property, we can
> tag all the functions that call it as well at compile time. Wouldn't
> that be nicer? The docstring can then automatically say "unsafe to call
> because it calls `switch-to-buffer'" which is nice and more helpful.
There are only very few interactive functions that should be allowed to
call `switch-to-buffer'. `find-file' may fit into this category because
that's what users traditionally expect it to do (although I plan to have
it call a function `pop-to-buffer-same-window' sooner or later). In the
distant future there should be no function calling `switch-to-buffer' at
all.
martin
- Re: ERT indentation testing, Ted Zlatanov, 2011/06/01
- Re: ERT indentation testing, Ted Zlatanov, 2011/06/02
- Re: ERT indentation testing, Stefan Monnier, 2011/06/02
- Re: ERT indentation testing, Ted Zlatanov, 2011/06/03
- Re: ERT indentation testing, martin rudalics, 2011/06/03
- extra-interactive functions (was: ERT indentation testing), Ted Zlatanov, 2011/06/03
- Re: extra-interactive functions,
martin rudalics <=
- Re: extra-interactive functions, Ted Zlatanov, 2011/06/03
- Re: extra-interactive functions, martin rudalics, 2011/06/03
- Re: extra-interactive functions, Ted Zlatanov, 2011/06/03
- Re: extra-interactive functions, martin rudalics, 2011/06/03
Re: ERT indentation testing, Ted Zlatanov, 2011/06/08