diff -r e76206d071fc -r f7be8c7905c2 VDBDebuggerApplication.st --- a/VDBDebuggerApplication.st Mon Aug 20 11:00:23 2018 +0100 +++ b/VDBDebuggerApplication.st Mon Aug 20 22:19:23 2018 +0100 @@ -46,6 +46,47 @@ "Modified: / 11-06-2017 / 20:08:05 / Jan Vrany " ! ! +!VDBDebuggerApplication class methodsFor:'accessing - defaults'! + +defaultUserInit + "Return path to user-specific VDB initi file (as Filename). + Use this to customize VDB upon startup. + If it does not exist, try create one with some defaults." + + | gdbinit | + + gdbinit := Filename homeDirectory / '.vdbinit.st'. + gdbinit exists ifFalse:[ + [ + gdbinit + writingFileDo:[:s | + s + nextPutLine:'"/ VDB init script'; + nextPutLine:'"/ Current VDB instance can be accessed in via variable `vdb`'; + nextPutLine:'"/'; + nextPutLine:'"/ Set prompt'; + nextPutLine:'vdb debugger send: ''set prompt (vdb) ''.'; + cr; + nextPutLine:'"/ Set default font:'; + nextPutLine:'"/ VDBAbstractApplication defaultTextFont: (CodeView defaultFont asSize: 16).'; + yourself. + ]. + ] on:Error + do:[:ex | + gdbinit exists ifTrue:[ + gdbinit remove + ]. + ^ nil + ]. + ]. + ^ gdbinit + + " + VDBDebuggerApplication defaultUserInit" + + "Created: / 31-08-2018 / 07:03:54 / Jan Vrany " +! ! + !VDBDebuggerApplication class methodsFor:'interface opening'! open @@ -1069,6 +1110,30 @@ subscribe "Register for debugger events. To be overrided by subclasses" + | init | + + "/ Read init file + init := self class defaultUserInit. + (init notNil and:[ init exists ]) ifTrue:[ + [ + [ + Workspace workspaceVariableAt: 'vdb' put: self. + init fileIn. + ] ensure:[ + Workspace workspaceVariables removeKey: 'vdb'. + ]. + ] on: Error do:[:ex | + Transcript + showCR: ('Error while reading VGB init file (%1)' bindWith: init pathName); + showCR: ('Description: %1' bindWith: ex description); + showCR: ('Backtrace:'); + cr. + ex suspendedContext fullPrintAllOn: Transcript. + Transcript showCR:'------'. + ]. + + ]. + UserPreferences current vdbPrettyPrintingEnabled ifTrue:[ debugger enablePrettyPrinting ]. @@ -1085,7 +1150,7 @@ when: GDBLogOutputEvent send: #onLogOutputEvent: to: self. "Created: / 21-09-2014 / 22:43:21 / Jan Vrany " - "Modified: / 30-07-2018 / 07:32:59 / Jan Vrany " + "Modified: / 31-08-2018 / 07:24:28 / Jan Vrany " ! ! !VDBDebuggerApplication methodsFor:'menu actions'!