diff options
| author | Stefan Monnier | 2004-03-09 15:28:27 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-03-09 15:28:27 +0000 |
| commit | 2c8155f78401809603640becd4f25e6858e35b5c (patch) | |
| tree | dc87a3cdd7cda1e7bed440d9adccba23c7885ac6 | |
| parent | 6eced09c3d950ee9cfa90b9ce04a998647197b3b (diff) | |
| download | emacs-2c8155f78401809603640becd4f25e6858e35b5c.tar.gz emacs-2c8155f78401809603640becd4f25e6858e35b5c.zip | |
(type-break-emacs-variant): Remove.
(type-break-run-at-time, type-break-cancel-function-timers):
Use fboundp rather than version name and number.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/type-break.el | 66 |
2 files changed, 23 insertions, 51 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index af42e158cd7..7d12a911b31 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,12 @@ | |||
| 1 | 2004-03-09 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * type-break.el (type-break-emacs-variant): Remove. | ||
| 4 | (type-break-run-at-time, type-break-cancel-function-timers): | ||
| 5 | Use fboundp rather than version name and number. | ||
| 6 | |||
| 1 | 2004-03-09 Masatake YAMATO <jet@gyve.org> | 7 | 2004-03-09 Masatake YAMATO <jet@gyve.org> |
| 2 | 8 | ||
| 3 | * hexl.el (hexl-mode): Use `make-local-variable' instead of | 9 | * hexl.el (hexl-mode): Use `make-local-variable' instead of |
| 4 | `make-variable-buffer-local'. | 10 | `make-variable-buffer-local'. |
| 5 | 11 | ||
| 6 | 2004-03-08 Michael Albinus <Michael.Albinus@alcatel.de> | 12 | 2004-03-08 Michael Albinus <Michael.Albinus@alcatel.de> |
diff --git a/lisp/type-break.el b/lisp/type-break.el index 86e5199e730..b03cb680022 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; type-break.el --- encourage rests from typing at appropriate intervals | 1 | ;;; type-break.el --- encourage rests from typing at appropriate intervals |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 95, 97, 2000 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 97, 2000, 2004 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Noah Friedman | 5 | ;; Author: Noah Friedman |
| 6 | ;; Maintainer: Noah Friedman <friedman@splode.com> | 6 | ;; Maintainer: Noah Friedman <friedman@splode.com> |
| @@ -8,7 +8,7 @@ | |||
| 8 | ;; Status: Works in GNU Emacs 19.25 or later, some versions of XEmacs | 8 | ;; Status: Works in GNU Emacs 19.25 or later, some versions of XEmacs |
| 9 | ;; Created: 1994-07-13 | 9 | ;; Created: 1994-07-13 |
| 10 | 10 | ||
| 11 | ;; $Id: type-break.el,v 1.28 2003/05/28 11:25:44 rms Exp $ | 11 | ;; $Id: type-break.el,v 1.29 2003/09/01 15:45:17 miles Exp $ |
| 12 | 12 | ||
| 13 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| 14 | 14 | ||
| @@ -277,39 +277,6 @@ It will be either \"seconds\" or \"keystrokes\".") | |||
| 277 | (defvar type-break-current-keystroke-warning-interval nil) | 277 | (defvar type-break-current-keystroke-warning-interval nil) |
| 278 | (defvar type-break-time-warning-count 0) | 278 | (defvar type-break-time-warning-count 0) |
| 279 | (defvar type-break-keystroke-warning-count 0) | 279 | (defvar type-break-keystroke-warning-count 0) |
| 280 | |||
| 281 | ;; Constant indicating emacs variant. | ||
| 282 | ;; This can be one of `xemacs', `lucid', `epoch', `mule', etc. | ||
| 283 | (defconst type-break-emacs-variant | ||
| 284 | (let ((data (match-data)) | ||
| 285 | (version (cond | ||
| 286 | ((fboundp 'nemacs-version) | ||
| 287 | (nemacs-version)) | ||
| 288 | (t | ||
| 289 | (emacs-version)))) | ||
| 290 | (alist '(("\\bXEmacs\\b" . xemacs) | ||
| 291 | ("\\bLucid\\b" . lucid) | ||
| 292 | ("^Nemacs\\b" . nemacs) | ||
| 293 | ("^GNU Emacs 19" . standard19) | ||
| 294 | ("^GNU Emacs 20" . standard19) | ||
| 295 | ("^GNU Emacs 18" . emacs18))) | ||
| 296 | result) | ||
| 297 | (while alist | ||
| 298 | (cond | ||
| 299 | ((string-match (car (car alist)) version) | ||
| 300 | (setq result (cdr (car alist))) | ||
| 301 | (setq alist nil)) | ||
| 302 | (t | ||
| 303 | (setq alist (cdr alist))))) | ||
| 304 | (set-match-data data) | ||
| 305 | (cond ((eq result 'lucid) | ||
| 306 | (and (string= emacs-version "19.8 Lucid") | ||
| 307 | (setq result 'lucid-19-8))) | ||
| 308 | ((memq result '(nemacs emacs18)) | ||
| 309 | (signal 'error | ||
| 310 | "type-break not supported in this version of emacs."))) | ||
| 311 | result)) | ||
| 312 | |||
| 313 | 280 | ||
| 314 | ;;;###autoload | 281 | ;;;###autoload |
| 315 | (defun type-break-mode (&optional prefix) | 282 | (defun type-break-mode (&optional prefix) |
| @@ -954,38 +921,37 @@ With optional non-nil ALL, force redisplay of all mode-lines." | |||
| 954 | ;;; for different versions of emacs. | 921 | ;;; for different versions of emacs. |
| 955 | 922 | ||
| 956 | (defun type-break-run-at-time (time repeat function) | 923 | (defun type-break-run-at-time (time repeat function) |
| 957 | (cond ((eq type-break-emacs-variant 'standard19) | 924 | (condition-case nil (or (require 'timer) (require 'itimer)) (error nil)) |
| 958 | (require 'timer) | 925 | (cond ((fboundp 'run-at-time) |
| 959 | (funcall 'run-at-time time repeat function)) | 926 | (run-at-time time repeat function)) |
| 960 | ((eq type-break-emacs-variant 'lucid-19-8) | 927 | ((fboundp 'start-timer) |
| 961 | (let ((name (if (symbolp function) | 928 | (let ((name (if (symbolp function) |
| 962 | (symbol-name function) | 929 | (symbol-name function) |
| 963 | "type-break"))) | 930 | "type-break"))) |
| 964 | (require 'timer) | 931 | (start-timer name function time repeat))) |
| 965 | (funcall 'start-timer name function time repeat))) | 932 | ((fboundp 'start-itimer) |
| 966 | ((memq type-break-emacs-variant '(xemacs lucid)) | ||
| 967 | (let ((name (if (symbolp function) | 933 | (let ((name (if (symbolp function) |
| 968 | (symbol-name function) | 934 | (symbol-name function) |
| 969 | "type-break"))) | 935 | "type-break"))) |
| 970 | (require 'itimer) | 936 | (start-itimer name function time repeat))))) |
| 971 | (funcall 'start-itimer name function time repeat))))) | ||
| 972 | 937 | ||
| 938 | (defvar timer-dont-exit) | ||
| 973 | (defun type-break-cancel-function-timers (function) | 939 | (defun type-break-cancel-function-timers (function) |
| 974 | (cond ((eq type-break-emacs-variant 'standard19) | 940 | (cond ((fboundp 'cancel-function-timers) |
| 975 | (let ((timer-dont-exit t)) | 941 | (let ((timer-dont-exit t)) |
| 976 | (funcall 'cancel-function-timers function))) | 942 | (cancel-function-timers function))) |
| 977 | ((eq type-break-emacs-variant 'lucid-19-8) | 943 | ((fboundp 'delete-timer) |
| 978 | (let ((list timer-list)) | 944 | (let ((list timer-list)) |
| 979 | (while list | 945 | (while list |
| 980 | (and (eq (funcall 'timer-function (car list)) function) | 946 | (and (eq (funcall 'timer-function (car list)) function) |
| 981 | (funcall 'delete-timer (car list))) | 947 | (delete-timer (car list))) |
| 982 | (setq list (cdr list))))) | 948 | (setq list (cdr list))))) |
| 983 | ((memq type-break-emacs-variant '(xemacs lucid)) | 949 | ((fboundp 'delete-itimer) |
| 984 | (with-no-warnings | 950 | (with-no-warnings |
| 985 | (let ((list itimer-list)) | 951 | (let ((list itimer-list)) |
| 986 | (while list | 952 | (while list |
| 987 | (and (eq (funcall 'itimer-function (car list)) function) | 953 | (and (eq (funcall 'itimer-function (car list)) function) |
| 988 | (funcall 'delete-itimer (car list))) | 954 | (delete-itimer (car list))) |
| 989 | (setq list (cdr list)))))))) | 955 | (setq list (cdr list)))))))) |
| 990 | 956 | ||
| 991 | 957 | ||