From mboxrd@z Thu Jan 1 00:00:00 1970 From: jorge.a.alfaro@gmail.com (Jorge A. Alfaro-Murillo) Subject: Re: An org password manager Date: Sun, 11 May 2014 13:20:57 -0400 Message-ID: <87siogjkp2.fsf@gmail.com> References: <87d2fklwkv.fsf@gmail.com> <87iopcad7f.fsf@gmail.com> <871tw0kzlo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXRE-0005aj-Ev for emacs-orgmode@gnu.org; Sun, 11 May 2014 13:21:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjXR4-0007hN-VM for emacs-orgmode@gnu.org; Sun, 11 May 2014 13:21:24 -0400 Received: from plane.gmane.org ([80.91.229.3]:43495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXR4-0007h3-OW for emacs-orgmode@gnu.org; Sun, 11 May 2014 13:21:14 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WjXQz-0000uG-Th for emacs-orgmode@gnu.org; Sun, 11 May 2014 19:21:09 +0200 Received: from 66.87.125.201 ([66.87.125.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 May 2014 19:21:09 +0200 Received: from jorge.a.alfaro by 66.87.125.201 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 May 2014 19:21:09 +0200 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: emacs-orgmode@gnu.org 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. 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.