Mercurial > hg > xemacs-beta
comparison lisp/itimer.el @ 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 | 9eeed79aee25 |
comparison
equal
deleted
inserted
replaced
2284:17dfe8e3aead | 2285:914c5afaac33 |
---|---|
23 (require 'lisp-float-type) | 23 (require 'lisp-float-type) |
24 | 24 |
25 ;; `itimer' feature means Emacs-Lisp programmers get: | 25 ;; `itimer' feature means Emacs-Lisp programmers get: |
26 ;; itimerp | 26 ;; itimerp |
27 ;; itimer-live-p | 27 ;; itimer-live-p |
28 ;; itimer-name | |
28 ;; itimer-value | 29 ;; itimer-value |
29 ;; itimer-restart | 30 ;; itimer-restart |
30 ;; itimer-function | 31 ;; itimer-function |
31 ;; itimer-uses-arguments | 32 ;; itimer-uses-arguments |
32 ;; itimer-function-arguments | 33 ;; itimer-function-arguments |
34 ;; set-itimer-name | |
33 ;; set-itimer-value | 35 ;; set-itimer-value |
34 ;; set-itimer-restart | 36 ;; set-itimer-restart |
35 ;; set-itimer-function | 37 ;; set-itimer-function |
36 ;; set-itimer-uses-arguments | 38 ;; set-itimer-uses-arguments |
37 ;; set-itimer-function-arguments | 39 ;; set-itimer-function-arguments |
215 (nth 6 itimer)) | 217 (nth 6 itimer)) |
216 | 218 |
217 (defun itimer-recorded-run-time (itimer) | 219 (defun itimer-recorded-run-time (itimer) |
218 (check-itimer itimer) | 220 (check-itimer itimer) |
219 (nth 7 itimer)) | 221 (nth 7 itimer)) |
222 | |
223 (defun set-itimer-name (itimer name) | |
224 "Set the name of ITIMER to be NAME. | |
225 NAME is an identifier for the itimer. It must be a string. If an itimer | |
226 already exists with this name, NAME will be modified slightly to make it | |
227 unique." | |
228 (check-string name) | |
229 (let ((oname name) | |
230 (num 2)) | |
231 (while (get-itimer name) | |
232 (setq name (format "%s<%d>" oname num)) | |
233 (itimer-increment num))) | |
234 (setcar itimer name)) | |
220 | 235 |
221 (defun set-itimer-value (itimer value) | 236 (defun set-itimer-value (itimer value) |
222 "Set the timeout value of ITIMER to be VALUE. | 237 "Set the timeout value of ITIMER to be VALUE. |
223 Itimer will expire in this many seconds. | 238 Itimer will expire in this many seconds. |
224 If your version of Emacs supports floating point numbers then | 239 If your version of Emacs supports floating point numbers then |
350 nil nil t))) | 365 nil nil t))) |
351 restart) | 366 restart) |
352 ;; hard to imagine the user specifying these interactively | 367 ;; hard to imagine the user specifying these interactively |
353 nil | 368 nil |
354 nil )) | 369 nil )) |
355 (check-string name) | |
356 (check-nonnegative-number value) | 370 (check-nonnegative-number value) |
357 (if restart (check-nonnegative-number restart)) | 371 (if restart (check-nonnegative-number restart)) |
358 ;; Make proposed itimer name unique if it's not already. | 372 ;; Make proposed itimer name unique if it's not already. |
359 (let ((oname name) | 373 (set-itimer-name name) |
360 (num 2)) | |
361 (while (get-itimer name) | |
362 (setq name (format "%s<%d>" oname num)) | |
363 (itimer-increment num))) | |
364 (activate-itimer (list name value restart function is-idle | 374 (activate-itimer (list name value restart function is-idle |
365 with-args function-arguments (list 0 0 0))) | 375 with-args function-arguments (list 0 0 0))) |
366 (car itimer-list)) | 376 (car itimer-list)) |
367 | 377 |
368 (defun make-itimer () | 378 (defun make-itimer () |