emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: jorge.a.alfaro@gmail.com (Jorge A. Alfaro-Murillo)
To: emacs-orgmode@gnu.org
Subject: Re: An org password manager
Date: Sun, 11 May 2014 13:13:39 -0400	[thread overview]
Message-ID: <871tw0kzlo.fsf@gmail.com> (raw)
In-Reply-To: 87iopcad7f.fsf@gmail.com

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.

  parent reply	other threads:[~2014-05-11 17:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-11  5:21 An org password manager Jorge A. Alfaro-Murillo
2014-05-11  5:47 ` Igor Sosa Mayor
2014-05-11  9:15 ` Ramon Diaz-Uriarte
2014-05-11 13:56   ` Colin Baxter
2014-05-12  8:20     ` Ramon Diaz-Uriarte
2014-05-12 14:35       ` Colin Baxter
2014-05-12 22:12         ` Ramon Diaz-Uriarte
2014-05-13 11:51           ` Colin Baxter
2014-05-13 12:40             ` Jorge A. Alfaro-Murillo
2014-05-14 10:01               ` Colin Baxter
2014-05-16 13:03               ` Ramon Diaz-Uriarte
2014-05-11 17:13   ` Jorge A. Alfaro-Murillo [this message]
2014-05-11 17:20     ` Jorge A. Alfaro-Murillo
2014-05-12  8:22       ` Ramon Diaz-Uriarte
2014-05-12 20:51 ` Cayetano Santos
2014-05-21  7:32 ` Bastien
2014-05-21 11:53   ` Michael Albinus
2014-06-05 14:36     ` Jorge A. Alfaro-Murillo
2014-06-06  9:39       ` Michael Albinus
2014-05-31 16:09   ` Jorge A. Alfaro-Murillo
2014-06-01 19:17     ` Bastien
2014-06-02 17:38     ` Bastien
2014-06-02 17:53       ` Jorge A. Alfaro-Murillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871tw0kzlo.fsf@gmail.com \
    --to=jorge.a.alfaro@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).