public inbox for sourcenav@sourceware.org
 help / color / mirror / Atom feed
* RE: What's wrong with this ?...
@ 2000-09-27  2:36 Ian Gilmour
  2000-09-27  3:56 ` Bruce Stephens
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Gilmour @ 2000-09-27  2:36 UTC (permalink / raw)
  To: Ian Gilmour; +Cc: sourcenav

> -----Original Message-----
> From: Bruce Stephens [ mailto:bruce@cenderis.demon.co.uk ]
> Sent: 26 September 2000 20:12
> To: Ian Gilmour
> Cc: sourcenav@sources.redhat.com
> Subject: Re: What's wrong with this ?...
> 
> 
> Ian Gilmour <ian.gilmour@ffei.co.uk> writes:
> 
> [...]
> 
> > Basically all I'm trying to do is add an "Extras" menu to 
> the editor window
> > with an option to run XEmacs, vi, or indent on the 
> currently edited file. I
> > know I probably need some more checks in all of this but 
> I'm just trying to
> > get the basics working for now.
> > 
> > So I've got the following in my rc.tcl file...
> > 
> > It basically works, except that if I edit the file in 
> snavigator I need to
> > explicitely save it (via "File"->"Save" menu option or ^S) for it to
> > autoupdate the editor window when I run the indent option. 
> i.e. It saves the
> > file correctly for indent to work on it, but doesn't reload 
> the indented
> > file and refresh the display.
> > 
> > What am I doing wrong ? What do I need to do to remove the 
> need to perform
> > an explicit Save file ?
> >
> > How do it I tell it I've already performed the save and 
> force the editor
> > window to be updated ?
> 
> Have a look at the existing Emacs stuff (emacs.tcl and sn.el).  That
> should help.  By the looks of it, calling sn_parse_uptodate with the
> name of the file that's just been saved is what you need to do.
> 

Thanks for replying.

I probably didn't explain it very well.

I know the Xemacs and vi menu options don't refresh (that what I want at
present).
But, looking at only the "Indent" menu option code in the following rc.tcl.
I think I am already calling sn_parse_uptodate with the file name after
invoking indent.
The problem is it doesn't work unless I've previously saved the file
explicitely (^S) first.

I feel I must be missing something that's obvious to someone more
experienced in this tcl and tk stuff.
- but I can't see what it is from the samples of code I've looked at (I've
checked out the emacs.tcl, sn.el and multiedit.tcl, etc).


cheers,


Ian

-------- snippet from rc.tcl --------------------------------

proc editor_extras {symboltype view} {
    global sn_options

    set e [$view editor]
    set f [$view getfilename]
    
    # Select local option
    switch -- $symboltype {
	"Xemacs" {
	    if {[sn_save_file $e $f] == 1} {
		exec xemacs $f +1 &
	    }
	}
	"vi" {
	    if {[sn_save_file $e $f] == 1} {
		exec xterm -T $f -e vi $f &
	    }
	}
	"Reload" {
	    sn_parse_uptodate $f
	}
	"Indent" {
	    if {[sn_save_file $e $f] == 1} {
		exec indent -npro -ts0 -l120 -lc120 -c40 -bli0 -ncs -bl
-npsl -nhnl -ncs -i2 $f
 	    }
	    sn_parse_uptodate $f
	}
	default {
	    sn_error_dialog \
		"$symboltype on $f not implemented yet."
	}
    }
}



proc sn_rc_editor {view text} {
    global tcl_platform

    set topw [winfo toplevel $view]
    set tool_frame $topw.exp
    set menu_frame $topw.menu
    set extras $menu_frame.extras

    # Create a new menu called "Extras".
    menu $extras -tearoff 0
    # Add a menu item to the menu. The second character is
    # the designated hot key. Place this menu fourth in
    # the menu bar.
    $menu_frame insert 3 cascade -label Extras -underline 1 \
	-menu $extras
    # Add items to the menu.
    $extras add command -label "Xemacs" -command \
	"editor_extras Xemacs $view" -underline 0
    $extras add command -label "vi"  -command \
	"editor_extras vi $view" -underline 0
    $extras add command -label "C-Indent" -command \
	"editor_extras Indent $view" -underline 0
    $extras add command -label "Reload file"  -command \
	"editor_extras Reload $view" -underline 0
}


 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's wrong with this ?...
  2000-09-27  2:36 What's wrong with this ? Ian Gilmour
@ 2000-09-27  3:56 ` Bruce Stephens
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Stephens @ 2000-09-27  3:56 UTC (permalink / raw)
  To: sourcenav

Ian Gilmour <ian.gilmour@ffei.co.uk> writes:

[...]

> I probably didn't explain it very well.
> 
> I know the Xemacs and vi menu options don't refresh (that what I
> want at present).  But, looking at only the "Indent" menu option
> code in the following rc.tcl.  I think I am already calling
> sn_parse_uptodate with the file name after invoking indent.  The
> problem is it doesn't work unless I've previously saved the file
> explicitely (^S) first.
> 
> I feel I must be missing something that's obvious to someone more
> experienced in this tcl and tk stuff.
> - but I can't see what it is from the samples of code I've looked at (I've
> checked out the emacs.tcl, sn.el and multiedit.tcl, etc).

The code looks OK to me.  I suggest you stick some logging in.  My
guess is that the wrong filename is being passed to either indent or
sn_parse_uptodate.  Using sn_parse_uptodate by hand seems to work
fine: I just touched a source file, and ran sn_parse_uptodate on it,
and the file was rescanned.

(I used Jeff Hobbes tkcon for this---a very useful tool.  Get it from
<URL: http://sourceforge.net/projects/tkcon/ >.)

[...]

-- 
Bruce Stephens			Bruce.Stephens@MessagingDirect.com
MessagingDirect(UK) Ltd		<URL: http://www.MessagingDirect.com/ >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's wrong with this ?...
  2000-09-26  9:36 Ian Gilmour
@ 2000-09-27 21:28 ` Ben Elliston
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Elliston @ 2000-09-27 21:28 UTC (permalink / raw)
  To: Ian Gilmour; +Cc: sourcenav

Hi Ian,

   Anyone interfaced PVCS and willing to share there
   sn_add_version_control_system() config ?

I can answer specific questions on this list, but I know nothing about PVCS
(well, I barely used it about five years ago).  Once we get support for
PVCS working, it'd be great to get it contributed.

Cheers, Ben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* What's wrong with this ?...
@ 2000-09-26  9:36 Ian Gilmour
  2000-09-27 21:28 ` Ben Elliston
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Gilmour @ 2000-09-26  9:36 UTC (permalink / raw)
  To: sourcenav

OK - first off I admit I'm no tcl or tk expert. So apologies if this is
obvious to some of you.

Basically all I'm trying to do is add an "Extras" menu to the editor window
with an option to run XEmacs, vi, or indent on the currently edited file. I
know I probably need some more checks in all of this but I'm just trying to
get the basics working for now.

So I've got the following in my rc.tcl file...

It basically works, except that if I edit the file in snavigator I need to
explicitely save it (via "File"->"Save" menu option or ^S) for it to
autoupdate the editor window when I run the indent option. i.e. It saves the
file correctly for indent to work on it, but doesn't reload the indented
file and refresh the display.

What am I doing wrong ? What do I need to do to remove the need to perform
an explicit Save file ?

How do it I tell it I've already performed the save and force the editor
window to be updated ?

Is there more detailed documentation than the programmer''s ref. for all of
this?

Is there a library of typical rc.tcl, etc. config files anywhere ?

Anyone interfaced PVCS and willing to share there
sn_add_version_control_system() config ?

Any help much appreciated. 

(PS. I'm running snavigator 4.5.1 under solaris)


cheers,


Ian

-------- snippet from rc.tcl --------------------------------

proc editor_extras {symboltype view} {
    global sn_options

    set e [$view editor]
    set f [$view getfilename]
    
    # Select local option
    switch -- $symboltype {
	"Xemacs" {
	    if {[sn_save_file $e $f] == 1} {
		exec xemacs $f +1 &
	    }
	}
	"vi" {
	    if {[sn_save_file $e $f] == 1} {
		exec xterm -T $f -e vi $f &
	    }
	}
	"Reload" {
	    sn_parse_uptodate $f
	}
	"Indent" {
	    if {[sn_save_file $e $f] == 1} {
		exec indent -npro -ts0 -l120 -lc120 -c40 -bli0 -ncs -bl
-npsl -nhnl -ncs -i2 $f
 	    }
	    sn_parse_uptodate $f
	}
	default {
	    sn_error_dialog \
		"$symboltype on $f not implemented yet."
	}
    }
}



proc sn_rc_editor {view text} {
    global tcl_platform

    set topw [winfo toplevel $view]
    set tool_frame $topw.exp
    set menu_frame $topw.menu
    set extras $menu_frame.extras

    # Create a new menu called "Extras".
    menu $extras -tearoff 0
    # Add a menu item to the menu. The second character is
    # the designated hot key. Place this menu fourth in
    # the menu bar.
    $menu_frame insert 3 cascade -label Extras -underline 1 \
	-menu $extras
    # Add items to the menu.
    $extras add command -label "Xemacs" -command \
	"editor_extras Xemacs $view" -underline 0
    $extras add command -label "vi"  -command \
	"editor_extras vi $view" -underline 0
    $extras add command -label "C-Indent" -command \
	"editor_extras Indent $view" -underline 0
    $extras add command -label "Reload file"  -command \
	"editor_extras Reload $view" -underline 0
}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-09-27 21:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-27  2:36 What's wrong with this ? Ian Gilmour
2000-09-27  3:56 ` Bruce Stephens
  -- strict thread matches above, loose matches on Subject: below --
2000-09-26  9:36 Ian Gilmour
2000-09-27 21:28 ` Ben Elliston

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).