# HG changeset patch # User james # Date 1095707489 0 # Node ID 914c5afaac3318b1937929926e6da4a3bf8703c3 # Parent 17dfe8e3aeadec64ce2b30e02db024a779aeeb3b [xemacs-hg @ 2004-09-20 19:11:29 by james] Martin's patch to add a set-itimer-name function. diff -r 17dfe8e3aead -r 914c5afaac33 lisp/ChangeLog --- 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 + + * itimer.el (set-itimer-name): New function. + (start-itimer): Use it. + 2003-12-12 Katsumi Yamaoka * itimer.el (activate-itimer): Modify the itimer timeout value as diff -r 17dfe8e3aead -r 914c5afaac33 lisp/itimer.el --- 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))