source: trunk/athena/bin/discuss/edsc/discuss-ls.el @ 4974

Revision 4974, 1.8 KB checked in by bjaspan, 33 years ago (diff)
Initial revision
Line 
1(defvar discuss-ls-filename nil)
2
3(defun discuss-ls (arg)
4  "Display txn headers of the meeting.  If no ARG, lists from current trn to
5last trn.
6If ARG is positive, list last ARG transactions.
7If ARG is negative, prompt for range to display."
8  (interactive "P")
9  (let ((start discuss-current-transaction) ;lower limit
10        (finish (nth 4 discuss-current-meeting-info))) ;upper limit
11    (if (and discuss-ls-filename
12             (file-exists-p discuss-ls-filename))
13        (delete-file discuss-ls-filename))
14    ;;  (setq discuss-ls-filename (make-temp-name (format "/tmp/discuss-ls-%s"
15    ;;                                               discuss-current-meeting)))
16    (setq discuss-ls-filename (make-temp-name (format "/tmp/discuss-ls-%s"
17                                                      (user-login-name))))
18    (if arg
19        (progn
20          ;; this listp/setq is needed since negative args are not passed
21          ;; as the head of a list.
22          (if (listp arg)
23              (setq arg (car arg)))
24          (if (< arg 0)
25              (let ((range (discuss-ls-get-params)))
26                (setq start (car range)
27                      finish (car (cdr range))))
28            (setq start (1+ (- finish arg))))))
29         
30    (discuss-send-cmd (format "(ls %s %d %d %d %s)\n"
31                              discuss-ls-filename
32                              start
33                              finish
34                              0         ; filter flags
35                              discuss-current-meeting)
36                      'discuss-end-list-mtg 'discuss-read-form)))
37
38(defun discuss-ls-get-params ()
39  (list (string-to-int (read-string "Beginning of range: "))
40        (string-to-int (read-string "End of range: "))))
41
42(defun discuss-end-list-mtg ()
43  (message "done list mtg")
44  (let ((retwin (selected-window)))
45    (if (get-buffer "*discuss-ls*") (kill-buffer "*discuss-ls*"))
46    (setq discuss-ls-buf
47          (get-buffer-create "*discuss-ls*"))
48    (let ((pop-up-windows t))
49      (pop-to-buffer discuss-ls-buf))
50    ;; (discuss-ls-mode)
51    (let ((buffer-read-only nil))
52      (insert-file-contents discuss-ls-filename))
53    (select-window retwin))
54  )
Note: See TracBrowser for help on using the repository browser.