jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Read only files.


Hello Misha,

Misha Gorodnitzky <misaka@xxxxxxxxx> wrote:
> Hello all,
>
> Apologies if this is covered already somewhere, I was unable to find  
> it if so.
>
> I noticed that when editing a file owned by root that has read-only  
> permissions only, mode 0444, jed doesn't seem to emit a warning or  
> any kind of signal to indicate this. Is there a way to get jed to  
> signal when I'm editing a file like this?
>
> If not, I propose that this would be useful addition.

You can use the _jed_save_buffer_before_hooks to raise a question if
saving the file should really take place.

#v+
define ask_before_save(file)
{
    variable stat = stat_file( file );
    if ( andelse {stat != NULL} {stat.st_mode & 0222 == 0} 
           {system("test $(id --user) -eq 0") == 0} )
       error("You try to save a readonly file as root");
}
#v-

Regards, Jörg.
-- 
Als deutscher Tourist im Ausland steht man vor der Frage, ob man sich
anständig benehmen muss oder ob schon deutsche Touristen dagewesen sind.
	  	   	     	      	        (Kurt Tucholsky)

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]