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: Jorge A. Alfaro-Murillo
Subject: Re: [O] An org password manager
Date: Sun, 11 May 2014 13:13:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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.




reply via email to

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