home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume40
/
plod
/
part01
/
plod.el.v1
< prev
next >
Wrap
Lisp/Scheme
|
1993-11-02
|
4KB
|
130 lines
Newsgroups: comp.lang.perl
From: paul@ascent.com (Paul Foley)
Subject: Emacs interface to PLOD
Message-ID: <PAUL.93Jan21125701@MountRushmore.ascent.com>
Date: 21 Jan 93 12:57:01
Organization: Ascent Technology, Inc., Cambridge Massachusetts
Lines: 119
Here is an emacs-lisp interface to PLOD --- the Personal LOgging
Device posted to comp.lang.perl a few days ago.
Simplest way to use is M-x plod.
There is also an "alarm" interface that will switch you to a PLOD
buffer every so often, in case you forget to invoke it yourself.
Enjoy.
------------------------------------------------------------------
;;;;
;;;; plod.el
;;;;
;;;; Emacs interface to PLOD --- A (Perl) tool to keep track of the work you do
;;;; PLOD was written by pomeranz@aqm.com (Hal R. Pomeranz).
;;;;
;;;; This software is FREE to all and may be used for any purpose as long as this
;;;; notice remains intact. The author does not assume responsibility for anything.
;;;;
;;;; Suggested addition to .emacs:
;;;; (load-library "plod")
;;;; (plod-alarm-on 60) ; once an hour
;;;;
;;;; When you are tired of PLODding use "M-x plod-alarm-off"
;;;;
;;;; Alternately, use "M-x plod" whenever you want to log something.
;;;;
;;;; paul@ascent.com (Paul Foley) Wednesday January 20, 1993
(require 'shell)
;;;
;;; Variables
;;;
;; Name of executable --- should be in your $PATH
(defvar plod-program-name "plod")
(defvar plod-buffer-name "*PLOD*")
;;;
;;; Manual Interface
;;;
(defvar plod-buffer-process nil)
;; Interactive command to invoke PLOD in a shell-mode buffer.
;;
(defun plod ()
"Invoke PLOD."
(interactive)
; restart PLOD if necessary
(if (not (get-buffer-process plod-buffer-name))
(setq plod-buffer-process (start-process "plod-process" plod-buffer-name plod-program-name)))
(switch-to-buffer plod-buffer-name t)
(if (not (eq major-mode 'shell-mode)) (shell-mode)))
;;;
;;; Alarm interface
;;;
(defvar plod-alarm-on-p nil) ; t if alarm is on
(defvar plod-alarm-process nil)
;; run when plod-alarm-process is killed
(defun plod-alarm-sentinel (proc reason)
(or (eq (process-status proc) 'run)
(setq plod-alarm-on-p nil)
(ding)
(message "PLOD alarm off")))
;; run every interval & at initial call to plod-alarm-on
(defun plod-alarm-filter (proc string)
(if plod-alarm-on-p
(plod)
(setq plod-alarm-on-p t)))
;; Set alarm to call PLOD every so often
;;
(defun plod-alarm-on (interval)
"Turn the Emacs PLOD alarm on. The alarm goes off every INTERVAL minutes
and you will be switched to the PLOD buffer automatically.
Use plod-alarm-off to stop this behaviour."
(interactive "nEnter PLOD alarm interval (in minutes): ")
(let ((live (and plod-alarm-process
(eq (process-status plod-alarm-process) 'run))))
(if (not live)
(progn
(setq plod-alarm-on-p nil)
(if plod-alarm-process
(delete-process plod-alarm-process))
(let ((process-connection-type nil))
(setq plod-alarm-process
(start-process "plod-alarm" nil
(concat exec-directory "wakeup")
; convert minutes -> seconds for wakeup
(int-to-string (* 60 interval)))))
(process-kill-without-query plod-alarm-process)
(set-process-sentinel plod-alarm-process 'plod-alarm-sentinel)
(set-process-filter plod-alarm-process 'plod-alarm-filter)))))
;; Turn PLOD alarm off
;;
(defun plod-alarm-off ()
"Turn the Emacs PLOD alarm off."
(interactive)
(if plod-alarm-on-p (kill-process plod-alarm-process)))
;;; End
--
paul@ascent.com
...!uunet!ascent!paul