From: marian <marian@mail.jozep.com.au>
To: "sourcenav@sources.redhat.com" <sourcenav@sources.redhat.com>
Subject: Editor startup HELP!!!!!!!!!!!!!
Date: Mon, 07 May 2001 07:15:00 -0000 [thread overview]
Message-ID: <3AF6ACF0.1C474C82@mail.jozep.com.au> (raw)
The manual says that if I want to override behaviour in the editor I
need to put code in .sn/rc.tcl.
I have done this and find I have odd behaviour in all versions of
sourcenav 4.2, 99r1, and 5.0.
If I exit from sn with an editor window open, when I restart the same
project in sn the previous editor window opens, but the behaviour I have
placed in the rc.tcl does not work for this window. If I open a new
editor window then the behaviour is there. The code will complete
braces, type for{ and it will put
for ( ; ; ) {
}
I like this style.
But it only does this in newly opened editor windows.
Desperately need help!!!!!!!!!!!!!!!!!!!!!!!
This is the source put it in .sn/rc.tcl
proc sn_rc_editor {view text} {
global auto_brace
global sn_text_highlight_group
puts stdout $view
puts stdout $text
puts stdout $sn_text_highlight_group($text)
set cpp "c++"
set auto_brace(${cpp},for) {" \( ; ; \) \{\n\t" "\n\}"}
set auto_brace(${cpp},if) {" \( FALSE \) \{\n\t" "\n\}"}
set auto_brace(${cpp},else) {" \{\n\t" "\n\}"}
set auto_brace(${cpp},switch) {" \( \) \{\n\tcase "
":\n\tdefault:\n\}"}
set auto_brace(${cpp},while) {" \( \) \{\n\t" "\n\}"}
set auto_brace(${cpp},do) {" \{\n\t" "\n\} while \( FALSE \);"}
bind $text <braceleft> {
auto_brace %W
break
}
proc auto_brace {w} {
global auto_brace
global sn_text_highlight_group
set word $sn_text_highlight_group($w)
set word ${word},[$w get "insert -1 chars wordstart" insert]
if { [info exists auto_brace($word)] == 1 } {
$w insert insert [lindex $auto_brace($word) 0]
set index [$w index insert]
$w insert insert [lindex $auto_brace($word) 1]
# Crunch out any trailing elements to make it all a bit
tidier
set tlist [lrange $auto_brace($word) 2 end]
foreach element $tlist {
$w insert insert $element
}
$w mark set insert $index
}
}
}
reply other threads:[~2001-05-07 7:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3AF6ACF0.1C474C82@mail.jozep.com.au \
--to=marian@mail.jozep.com.au \
--cc=sourcenav@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).