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

Revision 8278, 2.1 KB checked in by ghudson, 28 years ago (diff)
From raeburn: friendlier messages and better handling of discuss-end-list-mtg.
RevLine 
[4974]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")
[8278]9  (message "Listing meeting %s..." discuss-current-meeting)
[4974]10  (let ((start discuss-current-transaction) ;lower limit
11        (finish (nth 4 discuss-current-meeting-info))) ;upper limit
12    (if (and discuss-ls-filename
13             (file-exists-p discuss-ls-filename))
14        (delete-file discuss-ls-filename))
15    ;;  (setq discuss-ls-filename (make-temp-name (format "/tmp/discuss-ls-%s"
16    ;;                                               discuss-current-meeting)))
17    (setq discuss-ls-filename (make-temp-name (format "/tmp/discuss-ls-%s"
18                                                      (user-login-name))))
19    (if arg
20        (progn
21          ;; this listp/setq is needed since negative args are not passed
22          ;; as the head of a list.
23          (if (listp arg)
24              (setq arg (car arg)))
25          (if (< arg 0)
26              (let ((range (discuss-ls-get-params)))
27                (setq start (car range)
28                      finish (car (cdr range))))
29            (setq start (1+ (- finish arg))))))
[8278]30
[4974]31    (discuss-send-cmd (format "(ls %s %d %d %d %s)\n"
32                              discuss-ls-filename
33                              start
34                              finish
35                              0         ; filter flags
36                              discuss-current-meeting)
37                      'discuss-end-list-mtg 'discuss-read-form)))
38
39(defun discuss-ls-get-params ()
40  (list (string-to-int (read-string "Beginning of range: "))
41        (string-to-int (read-string "End of range: "))))
42
43(defun discuss-end-list-mtg ()
[8278]44  (message "Listing meeting %s... done." discuss-current-meeting)
45  (let ((win (selected-window))
46        (buf (current-buffer)))
47    (unwind-protect
48        (let ((buf (get-buffer "*discuss-ls*"))
49              (pop-up-windows t)
50              )
51          (if buf
52              (pop-to-buffer buf)
53            (setq buf (get-buffer-create "*discuss-ls*"))
54            (pop-to-buffer buf)
55            (setq buffer-read-only t)
56            (setq truncate-lines t)
57            )
58          (setq discuss-ls-buf buf)
59          (let ((buffer-read-only nil))
60            (erase-buffer)
61            ;; (discuss-ls-mode)
62            (insert-file-contents discuss-ls-filename)))
63      (select-window win)
64      (set-buffer buf))))
Note: See TracBrowser for help on using the repository browser.