- Subject: Re: signal handler within jed?
- From: Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Mar 2009 00:06:40 +0100
On Wed 2009-03-04 (13:27), John E. Davis wrote:
> I also think that it is a bad idea for jed to simply save the buffers
> as if nothing is wrong when it receives SIGTERM/SIGHUP.
As the default action: yes, this is a bad idea.
But I have users which need more care :-)
> Perhaps the window manager can be configured to not kill xterm when
> the user presses the "close" button.
None of my window managers has such a feature.
But in the meantime I found another solution for my problem:
a perl wrapper for jed which restores the autosave file and prevents the
user to edit the backup file.
#!/usr/bin/perl -w
if (@ARGV and $ARGV[-1] !~ /^-/) {
$file = pop;
$file =~ s/~+$//;
$file =~ s:#([^/]+)#$:$1:;
$as = dirname($file).'#'.basename($file).'#';
if (-f $as and -f $file and (stat $as)[9] > (stat $file)[9]) {
unlink $file;
rename $as,$file;
}
push @ARGV,$file;
}
exec '/client/bin/jed',@ARGV;
sub dirname {
local $_ = shift;
if (/(.*\/)/) { return $1 }
else { return '' }
}
sub basename {
local $_ = shift;
s:.*/::;
return $_;
}
It should be better coded in slang in startup_hook(), but my slang
knowledge is a little bit rusty :-}
--
Ullrich Horlacher Server- und Arbeitsplatzsysteme
Rechenzentrum E-Mail: horlacher@xxxxxxxxxxxxxxxxxxxx
Universitaet Stuttgart Tel: ++49-711-685-65868
Allmandring 30 Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.rus.uni-stuttgart.de/
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2009 date index]
[2009 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]