Mercurial > hg > xemacs-beta
changeset 2285:914c5afaac33
[xemacs-hg @ 2004-09-20 19:11:29 by james]
Martin's patch to add a set-itimer-name function.
author | james |
---|---|
date | Mon, 20 Sep 2004 19:11:29 +0000 |
parents | 17dfe8e3aead |
children | 04bc9d2f42c7 |
files | lisp/ChangeLog lisp/itimer.el |
diffstat | 2 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Mon Sep 20 18:11:33 2004 +0000 +++ b/lisp/ChangeLog Mon Sep 20 19:11:29 2004 +0000 @@ -1,3 +1,8 @@ +2004-09-20 Martin Buchholz <martin@xemacs.org> + + * itimer.el (set-itimer-name): New function. + (start-itimer): Use it. + 2003-12-12 Katsumi Yamaoka <yamaoka@jpl.org> * itimer.el (activate-itimer): Modify the itimer timeout value as
--- a/lisp/itimer.el Mon Sep 20 18:11:33 2004 +0000 +++ b/lisp/itimer.el Mon Sep 20 19:11:29 2004 +0000 @@ -25,11 +25,13 @@ ;; `itimer' feature means Emacs-Lisp programmers get: ;; itimerp ;; itimer-live-p +;; itimer-name ;; itimer-value ;; itimer-restart ;; itimer-function ;; itimer-uses-arguments ;; itimer-function-arguments +;; set-itimer-name ;; set-itimer-value ;; set-itimer-restart ;; set-itimer-function @@ -218,6 +220,19 @@ (check-itimer itimer) (nth 7 itimer)) +(defun set-itimer-name (itimer name) + "Set the name of ITIMER to be NAME. +NAME is an identifier for the itimer. It must be a string. If an itimer +already exists with this name, NAME will be modified slightly to make it +unique." + (check-string name) + (let ((oname name) + (num 2)) + (while (get-itimer name) + (setq name (format "%s<%d>" oname num)) + (itimer-increment num))) + (setcar itimer name)) + (defun set-itimer-value (itimer value) "Set the timeout value of ITIMER to be VALUE. Itimer will expire in this many seconds. @@ -352,15 +367,10 @@ ;; hard to imagine the user specifying these interactively nil nil )) - (check-string name) (check-nonnegative-number value) (if restart (check-nonnegative-number restart)) ;; Make proposed itimer name unique if it's not already. - (let ((oname name) - (num 2)) - (while (get-itimer name) - (setq name (format "%s<%d>" oname num)) - (itimer-increment num))) + (set-itimer-name name) (activate-itimer (list name value restart function is-idle with-args function-arguments (list 0 0 0))) (car itimer-list))