[Cuis-dev] Bizarre (un-understood?) behavior of Transcript

Gerald Klix cuis.01 at klix.ch
Sat Aug 21 10:10:32 PDT 2021


Me knows, IHMO it's annoying.

The "faulty" code is in SmalltalkEditor>>#doItProfiling.

Please find attached a slightly changes method that
queries a preference value to determine whether it should print or not.

Use
`Preferences setPreference: #doitShowResultOnTranscript toValue: true`
to restore the old behavior.


HTH,

Gerald




On 8/21/21 6:52 PM, Nicola Mingotti via Cuis-dev wrote:
> Hi guys,
> 
> After i do `Trascript log: 'foobar'` my transcript writes 'foobar'
> but under it also adds a line with a lonely 'Transcript'.
> 
> Which in my opinion is an extreme waist of space.
> 
> I assume i am missing something  ... Please tell me what it the
> right way to use Transcript in Cuis ;)
> 
> For example, it is important for me to start the logging every
> time on a new line. There was a message 'ensureCr' once in Squeak
> (from my old notes). It was useful. Don't you ever need anything similar ?
> 
> 
> Bye
> Nicola
> 
> 
-------------- next part --------------
'From Haver 5.0 [latest update: #4782] on 21 August 2021 at 7:08:01 pm'!

!SmalltalkEditor methodsFor: 'do-its' stamp: 'KLG 8/21/2021 19:06:26'!
doItProfiling: aBoolean
	"Set the context to include pool vars of the model.  Then evaluate.
	Print the result on the Transcript"
	| answer |
	answer _ self
		evaluateSelectionAndDo: [ :result |
			Preferences doitShowResultOnTranscript ifTrue: [
				Transcript finishEntry.
				[ result print ]
					on: UnhandledError
					do: [ :ex | 'printing doIt result failed' print ] ] ]
		ifFail: nil
		profiled: aBoolean.
	morph formatAndStyleIfNeeded.		"Needed to re-shout workspaces, that might have new variables binded."
	^answer! !


More information about the Cuis-dev mailing list