gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

timer+.el - extensions to GNU `timer.el'


From: Drew Adams
Subject: timer+.el - extensions to GNU `timer.el'
Date: Tue, 16 Jan 2001 21:35:20 -0500

;;; timer+.el --- Extensions to `timer.el'.
;; 
;; Filename: timer+.el
;; Description: Extensions to `timer.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1996-2001, Drew Adams, all rights reserved.
;; Created: Mon Jul 15 08:45:19 1996
;; Version: $Id: timer+.el,v 1.5 2001/01/09 22:32:26 dadams Exp $
;; Last-Updated: Tue Jan  9 14:32:21 2001
;;           By: dadams
;;     Update #: 51
;; Keywords: processes, calendar, local
;; Compatibility: GNU Emacs 20.x
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Commentary: 
;; 
;;    Extensions to `timer.el'.
;; 
;; 
;;  ***** NOTE: The following function defined in `timer.el' has
;;              been REDEFINED HERE:
;;
;;  `cancel-function-timers' - 
;;     This now uses `completing-read' in the interactive spec, with,
;;     as default, `symbol-nearest-point'.
;;
;;
;;  This file should be loaded after loading the standard GNU file
;;  `timer.el'.  So, in your `~/.emacs' file, do this:
;;  (eval-after-load "timer" '(require 'timer+))
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Change log:
;; 
;; RCS $Log: timer+.el,v $
;; RCS Revision 1.5  2001/01/09 22:32:26  dadams
;; RCS Adapted file header for Emacs Lisp Archive.
;; RCS
;; RCS Revision 1.4  2001/01/03 17:48:34  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.3  2001/01/03 17:02:54  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.2  2000/11/28 20:42:05  dadams
;; RCS Optional require's via 3rd arg=t now.
;; RCS
;; RCS Revision 1.1  2000/09/14 17:24:29  dadams
;; RCS Initial revision
;; RCS
; Revision 1.2  1999/03/17  16:47:00  dadams
; 1. Protect with fboundp.
; 2. Updated to correspond to Emacs 34.1 version.
;
; Revision 1.1  1997/03/21  11:11:00  dadams
; Initial revision
;
; Revision 1.1  1996/07/15  08:45:40  dadams
; Initial revision
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Code:

(require 'timer)
(require 'cl) ;; when, pop

(require 'thingatpt nil t) ;; (no error if not found): symbol-at-point
(require 'thingatpt+ nil t) ;; (no error if not found): symbol-nearest-point
(require 'elect-mbuf nil t) ;; (no error if not found): completing-read


(provide 'timer+)

;;;;;;;;;;;;;;;;;;;;;;;


;; REPLACES ORIGINAL in `timer.el':
;; Uses `completing-read' in interactive spec, with `symbol-nearest-point'.
;; `symbol-nearest-point' is defined in `thingatpt+.el'.
;; `symbol-at-point' is defined in `thingatpt.el'.
;; `function-called-at-point' is defined in `help.el'.
;;;###autoload
(defun cancel-function-timers (function)
  "Cancel all timers set by `run-at-time' that would run FUNCTION."
  (interactive
   (let ((fn (cond ((fboundp 'symbol-nearest-point) (symbol-nearest-point))
                   ((fboundp 'symbol-at-point) (symbol-at-point))
                   ((fboundp 'function-called-at-point)
                    (function-called-at-point)) ; Defined in `help.el'.
                   (t nil)))
         (enable-recursive-minibuffers t))
     (list (intern (completing-read "Cancel timers of function: "
                                    obarray 'fboundp t
                                    (and fn (symbol-name fn)) nil
                                    (and fn (symbol-name fn)) t)))))
  (let ((tail timer-list))
    (while tail
      (when (eq (aref (car tail) 5) function)
        (setq timer-list (delq (car tail) timer-list)))
      (pop tail)))
  (let ((tail timer-idle-list))
    (while tail
      (when (eq (aref (car tail) 5) function)
        (setq timer-idle-list (delq (car tail) timer-idle-list)))
      (pop tail))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; `timer+.el' ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]