vile
[Top][All Lists]
Advanced

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

Re: [vile] Detecting if vile is idle


From: Paul Fox
Subject: Re: [vile] Detecting if vile is idle
Date: Fri, 01 Apr 2016 06:50:17 -0400

thanks for posting the full solution.  i could see using that
someday.

paul

chris wrote:
 > > 
 > > buffer-hook does what I need, it gets run when entering the first
 > > buffer so I can do something in a procedure called by buffer-hook that
 > > sets the modified flag.
 > > 
 > Just as a final follow-up to this I now have what I want working
 > perfectly thanks to the various bits of help here.
 > 
 > The whole point of the exercise was to feed the output of decrypting a
 > gpg encrypted file into vile by stdin and then, on exit from vile to
 > re-encrypt it from stdout back into gpg.  Thus no temporary files with
 > decrypted data hanging around.
 > 
 > Then, having done the above I wanted to auto-close the vile window
 > after a timeout as I was always finding vile open on the decrypted
 > data that I had left there hours or days before.
 > 
 > The whole of my extra .vilerc for this is appended below:-
 > 
 > ;
 > ;
 > ; .nnvilerc: special vilerc file for nn encrypted file editing
 > ;
 > ;
 > ;
 > ; get my standard vile configuration
 > ;
 > source ~/.vilerc
 > ;
 > ;
 > ; map ZZ to write-stdout-exit procedure
 > ;
 > map ZZ :write-stdout-exit^M
 > ;
 > ;
 > ; procedure to run on ZZ exit, inserts the pass phrase at the beginning
 > ; of the file and then runs it through gpg to encrypt it.
 > ;
 > store-procedure write-stdout-exit
 >     setv %gpg "gpg --symmetric --passphrase-fd 0 >temp.gpg"
 >     ;
 >     ;
 >     ; Only do this if we're editing stdin (which is fed in from gpg)
 >     ; and the buffer has been changed
 >     ;
 >     ~if &sequal $cbufname "[Standard Input]"
 >         ~if $modified
 >             goto-beginning-of-file
 >             insert-string &env "pwd"
 >             insert-string "\n"
 >             goto-beginning-of-file
 >             filter-til end-of-file %gpg
 >             quit-without-save
 >         ~else
 >             quit
 >         ~endif
 >     ~else
 >         write-changed-buffers-and-quit
 >     ~endif
 > ~endm
 > ;
 > ;
 > ; procedure run by buffer-hook on entry to set the modified flag
 > ;
 > store-procedure modify-it 'Set buffer modified flag'
 >     insert-string "XXXXX"
 >     undo-change
 > ~endm
 > 
 > setv buffer-hook modify-it
 > ;
 > ;
 > ; use the autocolor hook to time out if idle
 > ;
 > store-procedure idleExit 'Exit after period of idleness'
 >     write-stdout-exit
 > ~endm
 > 
 > setv $autocolor-hook idleExit
 > ;
 > ;
 > ; timeout in mS
 > ;
 > setv $autocolor 60000
 > 
 > 
 > -- 
 > Chris Green
 > 
 > _______________________________________________
 > vile mailing list
 > address@hidden
 > https://lists.nongnu.org/mailman/listinfo/vile
 > 


=----------------------
 paul fox, address@hidden (arlington, ma, where it's 56.5 degrees)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]