1 ;;; pgg.el --- glue for the various PGP implementations.
3 ;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: Daiki Ueno <ueno@unixuser.org>
7 ;; Symmetric encryption added by: Sascha Wilde <wilde@sha-bang.de>
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; This file is on its way to obsolescence, waiting for allout.el to
35 (autoload 'run-at-time "timer")
37 ;; Don't merge these two `eval-when-compile's.
39 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
42 ;;; @ utility functions
46 (when (featurep 'xemacs)
47 (defmacro pgg-run-at-time-1 (time repeat function args)
48 (if (condition-case nil
49 (let ((delete-itimer 'delete-itimer)
50 (itimer-driver-start 'itimer-driver-start)
51 (itimer-value 'itimer-value)
52 (start-itimer 'start-itimer))
53 (unless (or (symbol-value 'itimer-process)
54 (symbol-value 'itimer-timer))
55 (funcall itimer-driver-start))
56 ;; Check whether there is a bug to which the difference of
57 ;; the present time and the time when the itimer driver was
58 ;; woken up is subtracted from the initial itimer value.
59 (let* ((inhibit-quit t)
60 (ctime (current-time))
61 (itimer-timer-last-wakeup
64 (setcar ctime (1- (car ctime)))))
66 (itimer (funcall start-itimer "pgg-run-at-time"
68 (sleep-for 0.1) ;; Accept the timeout interrupt.
70 (> (funcall itimer-value itimer) 0)
71 (funcall delete-itimer itimer))))
74 (apply #'start-itimer "pgg-run-at-time"
75 ,function (if time (max time 1e-9) 1e-9)
81 (apply #'start-itimer "pgg-run-at-time"