From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ramon Diaz-Uriarte Subject: Re: An org password manager Date: Mon, 12 May 2014 10:22:15 +0200 Message-ID: <87fvkf9zk8.fsf@gmail.com> References: <87d2fklwkv.fsf@gmail.com> <87iopcad7f.fsf@gmail.com> <871tw0kzlo.fsf@gmail.com> <87siogjkp2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjlVA-0004kf-PD for emacs-orgmode@gnu.org; Mon, 12 May 2014 04:22:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjlV5-0004Pn-8h for emacs-orgmode@gnu.org; Mon, 12 May 2014 04:22:24 -0400 Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:49823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjlV5-0004Om-1N for emacs-orgmode@gnu.org; Mon, 12 May 2014 04:22:19 -0400 Received: by mail-wg0-f45.google.com with SMTP id m15so6597983wgh.16 for ; Mon, 12 May 2014 01:22:18 -0700 (PDT) In-reply-to: <87siogjkp2.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Jorge A. Alfaro-Murillo" Cc: emacs-orgmode@gnu.org Hola Jorge, On Sun, 11-05-2014, at 19:20, Jorge A. Alfaro-Murillo wrote: > jorge.a.alfaro@gmail.com (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: rdiaz02@gmail.com ramon.diaz@iib.uam.es http://ligarto.org/rdiaz