[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vile] toggle boolean settings
From: |
Thomas Dickey |
Subject: |
Re: [vile] toggle boolean settings |
Date: |
Tue, 06 Mar 2012 20:48:29 -0500 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Wed, Feb 29, 2012 at 05:15:36PM -0500, Thomas Dickey wrote:
> On Wed, Feb 29, 2012 at 01:51:46PM -0500, address@hidden wrote:
> > Is there a way to simply negate boolean settings? If not it would be
> > nice to have a feature like this:
> >
> > setl !list
> > or
> > setl notlist
> >
> > If listing is enabled it would be disabled, else enabled.
>
> I do this with a macro ToggleList, for just the special case of the list
> mode. That, and ToggleTabs have been useful enough as is, that I hadn't
> considered making it more general.
>
> One way to make it more general would be to make something like this
> work (that is, gluing "$" onto the mode name and feeding that into
> the interpretation):
>
> store-procedure invert mode="Mode to invert"
> write-message &cat "Hello:" $*
> ~if &cat "$" $1
> write-message &cat "HI:" $*
> ~else
> ~if $list
> write-message &cat "OOPS:" $*
> ~else
> write-message &cat "BYE:" $*
> ~endif
> ~endif
> ~endm
>
> A quick check showed me it doesn't work, but that's the sort of thing
> that macros would be good for. (I also considered "eval" for the "~if"
> line, but the "~" and "&" stuff _is_ processed before that, so it
> wouldn't work).
Revisiting this, the solution is to use the "&ind" function, e.g.,
~if &ind $1
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature
- Re: [vile] toggle boolean settings,
Thomas Dickey <=