Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

UNDO_LIMIT_NO and its documentation



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