;; Keywords: crypto
;; Created: 2000-04-15
-;; $Id: gpg.el,v 1.19 2003/05/01 16:03:41 larsi Exp $
-
;; This file is NOT (yet?) part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
\f
;;; Code:
-(require 'timer)
+(if (featurep 'xemacs)
+ (require 'timer-funcs)
+ (require 'timer))
(eval-when-compile (require 'cl))
(eval-and-compile
'point-at-eol
'line-end-position)))
+;; itimer/timer compatibility
+(eval-and-compile
+ (if (featurep 'xemacs)
+ (progn
+ (defalias 'gpg-cancel-timer 'delete-itimer)
+ (defalias 'gpg-timer-activate 'activate-itimer)
+ (defalias 'gpg-timer-create 'make-itimer)
+ (defalias 'gpg-timer-set-function 'set-itimer-function)
+ (defalias 'gpg-timer-set-time 'set-itimer-value))
+ (defalias 'gpg-cancel-timer 'cancel-timer)
+ (defalias 'gpg-timer-activate 'timer-activate)
+ (defalias 'gpg-timer-create 'timer-create)
+ (defalias 'gpg-timer-set-function 'timer-set-function)
+ (defalias 'gpg-timer-set-time 'timer-set-time)))
+
;;;; Customization:
;;; Customization: Groups:
;;; Passphrase handling:
(defvar gpg-passphrase-timer
- (timer-create)
+ (gpg-timer-create)
"This timer will clear the passphrase cache periodically.")
(defvar gpg-passphrase
"Forget stored passphrase."
(interactive)
(when gpg-passphrase
- (cancel-timer gpg-passphrase-timer)
+ (gpg-cancel-timer gpg-passphrase-timer)
(setq gpg-passphrase-timer nil)
(gpg-passphrase-clear-string gpg-passphrase)
(setq gpg-passphrase nil)))
Updates the timeout for clearing the cache to `gpg-passphrase-timeout'."
(unless (equal gpg-passphrase-timeout 0)
(if (null gpg-passphrase-timer)
- (setq gpg-passphrase-timer (timer-create)))
- (timer-set-time gpg-passphrase-timer
- (timer-relative-time (current-time)
- gpg-passphrase-timeout))
- (timer-set-function gpg-passphrase-timer 'gpg-passphrase-forget)
+ (setq gpg-passphrase-timer (gpg-timer-create)))
+ (gpg-timer-set-time gpg-passphrase-timer
+ (timer-relative-time (current-time)
+ gpg-passphrase-timeout))
+ (gpg-timer-set-function gpg-passphrase-timer 'gpg-passphrase-forget)
(unless (and (fboundp 'itimer-live-p)
(itimer-live-p gpg-passphrase-timer))
- (timer-activate gpg-passphrase-timer))
+ (gpg-timer-activate gpg-passphrase-timer))
(setq gpg-passphrase passphrase))
passphrase)