These two commands allows you to push/pop the state of certain members in g_exec_flags to an internal stack (lastused with the power of a stack)
It also fixes bug #2969695 (If this patch is not accepted/wanted, that bug can be fixed by just adding some magic code detection to EW_SETFLAG)
Code used during bug fix:
Setdetailsprint both
DetailPrint "Hey yo"
Setdetailsprint none
System::Free 0
DetailPrint "You can't see me"
Setdetailsprint lastused
DetailPrint "Say hello to the bad guy"
diff to 31-Mar-2010.cvs
In my humble opinion the proposed script commands PushFlags and PopFlags are rather specialized. I have got doubts that many developers would actually need it.
The offending code (internal NSIS function [un.]Initialize_____Plugins) for bug #2969695 intends to hide the output of the extract operation of a plug-in DLL. My suggestion would be to implement a "silent extract" for that case.
PushFlags and PopFlags could be implemented with the existing script commands such as:
!include "StrFunc.nsh"
; Declare string functions
${StrTok}
!macro pushflags param
Push ${param}
call pushflags
!macroend
!define pushflags `!insertmacro pushflags`
!define popflags `call popflags`
Var LastSavedFlags
; Save flags
; Flags could be:
; SetShellVarContext *current*|all
; SetRegView *32*|64|lastused
; SetDetailsPrint none|listonly|textonly|*both*|lastused
Function pushflags
Exch $0 Exch $0
StrCpy $LastSavedFlags $0
Pop $0
FunctionEnd
; Restore last saved flags
Function popflags
Push $0
Push $1
Push $2
StrCpy $1 $LastSavedFlags
StrCpy $2 0
${Do}
${StrTok} $0 $1 "|" $2 "0"
${If} $0 == ""
${ExitDo}
${EndIf}
${Switch} $0
${Case} "all"
SetShellVarContext all
${Break}
${Case} "current"
SetShellVarContext current
${Break}
${Case} "32"
SetRegView 32
${Break}
${Case} "64"
SetRegView 64
${Break}
${Case} "none"
SetDetailsPrint none
${Break}
${Case} "listonly"
SetDetailsPrint listonly
${Break}
${Case} "textonly"
SetDetailsPrint textonly
${Break}
${Case} "both"
SetDetailsPrint both
${Break}
${Default}
${EndSwitch}
IntOp $2 $2 + 1
${Loop} Pop $1
Pop $0
FunctionEnd
${pushflags} "current|32|both"
...
${popflags}
PushFlags/PopFlags would be very handy for people writing general helper functions that go in include files.
As far as your example goes, it does not work at all (And implementing it in NSIS script is not possible since you cannot access the current state at all)