Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
UNDO_LIMIT_NO and its documentation
- X-seq: zsh-workers 36214
 
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxx
 
- Subject: UNDO_LIMIT_NO and its documentation
 
- Date: Tue, 18 Aug 2015 00:09:16 -0700
 
- List-help: <mailto:zsh-workers-help@zsh.org>
 
- List-id: Zsh Workers List <zsh-workers.zsh.org>
 
- List-post: <mailto:zsh-workers@zsh.org>
 
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
 
The doc says:
     A typical use of this variable in a widget function is as follows:
          integer save_limit=$UNDO_LIMIT_NO
          UNDO_LIMIT_NO=$UNDO_CHANGE_NO
          {
            # Perform some form of recursive edit.
          } always {
            UNDO_LIMIT_NO=save_limit
          }
Firstly, why not just
	local UNDO_LIMIT_NO=$UNDO_CHANGE_NO
and allow function scoping to restore it?  It's not a special.
Secondly, declaring "integer save_limit" means that save_limit will have
a default of zero, but UNDO_LIMIT_NO has a default of unset.  So when the
assignment back to UNDO_LIMIT_NO is done, it'll change state from unset
to zero.  Does that matter?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author