help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: elisp exercise: toggle-letter-case


From: Xah
Subject: Re: elisp exercise: toggle-letter-case
Date: Sun, 19 Oct 2008 10:46:22 -0700 (PDT)
User-agent: G2/1.0

On Oct 19, 8:26 am, Nikolaj Schumacher <m...@nschum.de> wrote:
> Xah<xah...@gmail.com> wrote:
> > it doesn't use (&optional beg end) with the associated
> > “(interactive ...)” code because i think when a command is designed
> > only for interactive use, then it makes sense to not support calling
> > it in elisp as much as possible.
>
> But it limits the code's re-usability.  Imagine someone wants a function
> that toggles the case for the current symbol or sentence (instead of
> word).

i think this function is not suitable for calling in elisp program
because its behavior is somewhat unpredictable.

When called interactively, user has visual feedback on what's the
current state, so she can decide whether to call again.

When used programmatically, it's rather unpredictable what's would be
the letter case after calling this function unless the programer put
more code to check what are the letter cases to begin with.

If the programer wants to, for example, downcase/upcase/initCap region/
word, it's much simpler by calling elisp's default functions on these,
at most 2 calls.

  Xah
∑ http://xahlee.org/

reply via email to

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