Re: [gedit-list] save current file

#Input=Current Document
#output=Display in Bottom Pane
cat > $GEDIT_CURRENT_DOCUMENT_NAME # cat reads stdin the output should be the same as a Save menu command to gedit. except that gedit will complain a bit about the modification.

And it sounds as though you could put current document into a temp file or a pipe

cat  | mpost  # If mpost defaults to reading from standard in.

mkfifo temp
cat > temp
mpose  temp

I'm not familiar with mpost. Can you do "mpost -" A lot of tools use - to indicate standard input. If that's possible you could drop the cat command and just let mpost read from stdin.

gedit tries to make a backup file with an ~ char appended whenever you save but it doesn't always work when the file in in the root of your home directory.

Merry Christmas!

At 19:31 -0500 12/24/08, John Kitzmiller wrote:
On Wed, 2008-12-24 at 16:30 -0700, Doug McNutt wrote:
 At 17:29 -0500 12/24/08, John Kitzmiller wrote:
 >For an External Tool, how to save/overwrite the current file with same
 >name before running command on it?
 >e.g. (You may have seen this before...):
 >---> what goes in here to save current file? <---
 >The result I seek is what happens with the LaTeX plugin: when a .tex
 >file is modified, it is saved prior to processing.

 It is possible to select  "current document" to be sent to the tool
 using the edit tools option at the bottom of the tools window but you
 can get the same result with appropriate comment lines in the tool
 itself right under the #! line.

 Have a look at a tool in $HOME/,genome2/gedit/tools/ to see the format.

 For a really big document that might be painful but you should be
 able to read standard in and just rewrite

 But using the path variable would remove the possibility that your
 tool is using the wrong directory - did it read a shell startup
 script for you?

Thanks for reply Doug.

I think the answer to your last question is yes. If I have a correct .mp
file and use the tool I have defined...


...a proper postscript file is created which I can view (evince or
gsview, etc). But if I make changes to the source file (in gedit) the
tab is starred (as expected) but not saved (obviously). The tool then
runs, as far as I can tell--and I can experiment more--on the last saved
version (which may be a ~filename somewhere?) and no changes are made to
the postscript file.

The output must be set to 'Display in Bottom Pane' as that output is the
metapost runtime message (error or otherwise), not the postscript file
for viewing.

I had tried the settings in the tool window before posting my query, but
none seem to save the current text code file before running it through
mpost. What I think I may need is a bash command to save the current
file, then run the saved file through mpost? I tried some, like cp, mv,
but I am floundering. Also went to trying regular expressions to pass a
ctr+s, but more floundering and that seems like the wrong approach

Methinks my immediate question boils down to this: how (best) to use
External Tool to save current file? I must be missing something obvious.


gedit-list mailing list
gedit-list gnome org


--> From the U S of A, the only socialist country that refuses to admit it. <--

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]