emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] An org password manager


From: Ramon Diaz-Uriarte
Subject: Re: [O] An org password manager
Date: Mon, 12 May 2014 10:22:15 +0200
User-agent: mu4e 0.9.9.5; emacs 24.3.50.1

Hola Jorge,



On Sun, 11-05-2014, at 19:20, Jorge A. Alfaro-Murillo <address@hidden> wrote:
> address@hidden (Jorge A. Alfaro-Murillo) writes:
>
> I forgot to mention that what org-passwords.el does is to set a timer
> each time that the password file is opened (analogous to the second
> option in my previous message) rather than having just one timer with
> repeat.

You are right! (I've been using this for over 3 years and hadn't realized
the obvious). The timer is always running (even before any gpg file is
opened), so I can end up with the unlikely coincidence of it firing right
when I open a gpg file.


It won't if I do as you suggest. Thanks!!!

Best,


R.


>
> Jorge.
>
>> Thanks Ramon,
>>
>> Regarding your question, probably the bug is related to running a for
>> with all the buffers that are open. To get what you want you can try
>> something creating a minor mode for gpg files and adding a hook that
>> adds the buffer name of the gpg file that you open to a list of buffers
>> to kill:
>>
>>   #+BEGIN_SRC emacs-lisp
>>     (define-minor-mode gpg-killing-mode
>>       "A mode to kill gpg files"
>>       :after-hook 
>>       (add-to-list 'gpg-buffers (buffer-name)))
>>
>>     (add-to-list 'auto-mode-alist '("\\.gpg$" . gpg-killing-mode))
>>
>>     (setq gpg-buffers nil)
>>
>>     (run-at-time t 120 '(lambda () 
>>                          (mapcar 'kill-buffer gpg-buffers)
>>                          (setq gpg-buffers nil)))
>>       
>>   #+END_SRC
>>
>> Instead killing all at the same time, I would probably kill each one
>> after a certain time, to avoid opening a file and have it right away
>> killed it was close to the end of the 2 min cycle:
>>
>>   #+BEGIN_SRC emacs-lisp
>>     (define-minor-mode gpg-killing-mode
>>       "A mode to kill gpg files"
>>       :after-hook 
>>       (progn
>>         (setq gpg-buffers (append gpg-buffers (list (buffer-name))))
>>         (run-at-time 120 nil '(lambda () 
>>                                 (kill-buffer (car gpg-buffers))
>>                                 (setq gpg-buffers (cdr gpg-buffers))))))
>>
>>     (add-to-list 'auto-mode-alist '("\\.gpg$" . gpg-killing-mode))  
>>
>>     (setq gpg-buffers nil)
>>   #+END_SRC
>>
>> Best,
>>
>> Jorge.


-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: address@hidden
       address@hidden

http://ligarto.org/rdiaz





reply via email to

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