comparison lisp/mail/rmailsum.el @ 88146:a64fe1ff909a

(rmail-make-summary-line): Function deleted. (rmail-new-summary): Make it work once again as in old version. (rmail-summary-get-summary): Call rmail-summary-line-decoder.
author Richard M. Stallman <rms@gnu.org>
date Mon, 27 Sep 2004 07:41:10 +0000
parents 31edc813b710
children d7ddb3e565de
comparison
equal deleted inserted replaced
88145:26571a11e57f 88146:a64fe1ff909a
201 (message "Computing summary lines...") 201 (message "Computing summary lines...")
202 (let ((summary-msgs ()) 202 (let ((summary-msgs ())
203 (new-summary-line-count 0) 203 (new-summary-line-count 0)
204 (msgnum 1) 204 (msgnum 1)
205 current-message sumbuf was-in-summary) 205 current-message sumbuf was-in-summary)
206
207 ;; Go to the Rmail buffer.
208 (if (eq major-mode 'rmail-summary-mode)
209 (progn
210 (setq was-in-summary t)
211 (set-buffer rmail-buffer)))
212
213 ;; Find its summary buffer, or make one.
214 (setq current-message rmail-current-message
215 sumbuf
216 (if (and rmail-summary-buffer
217 (buffer-name rmail-summary-buffer))
218 rmail-summary-buffer
219 (generate-new-buffer (concat (buffer-name) "-summary"))))
220
221 ;; Collect the message summaries based on the filtering
222 ;; argument (FUNCTION).
223 (while (>= rmail-total-messages msgnum)
224 (if (or (null function)
225 (apply function (cons msgnum args)))
226 (setq summary-msgs
227 (cons (cons msgnum (rmail-summary-get-summary msgnum))
228 summary-msgs)))
229 (setq msgnum (1+ msgnum)))
230 (setq summary-msgs (nreverse summary-msgs))
231
232 ;; Place the collected summaries into the summary buffer.
233 (setq rmail-summary-buffer nil)
234 (save-excursion 206 (save-excursion
235 (let ((rbuf (current-buffer)) 207
236 (vbuf rmail-view-buffer) 208 ;; Go to the Rmail buffer.
237 (total rmail-total-messages)) 209 (if (eq major-mode 'rmail-summary-mode)
238 (set-buffer sumbuf) 210 (setq was-in-summary t))
239 ;; Set up the summary buffer's contents. 211 (set-buffer rmail-buffer)
240 (let ((buffer-read-only nil)) 212
241 (erase-buffer) 213 ;; Find its summary buffer, or make one.
242 (while summary-msgs 214 (setq current-message rmail-current-message
243 (princ (cdr (car summary-msgs)) sumbuf) 215 sumbuf
244 (setq summary-msgs (cdr summary-msgs))) 216 (if (and rmail-summary-buffer
245 (goto-char (point-min))) 217 (buffer-name rmail-summary-buffer))
246 ;; Set up the rest of its state and local variables. 218 rmail-summary-buffer
247 (setq buffer-read-only t) 219 (generate-new-buffer (concat (buffer-name) "-summary"))))
248 (rmail-summary-mode) 220
249 (make-local-variable 'minor-mode-alist) 221 ;; Collect the message summaries based on the filtering
250 (setq minor-mode-alist (list (list t (concat ": " description)))) 222 ;; argument (FUNCTION).
251 (setq rmail-buffer rbuf 223 (while (>= rmail-total-messages msgnum)
252 rmail-view-buffer vbuf 224 (if (or (null function)
253 rmail-summary-redo redo-form 225 (apply function (cons msgnum args)))
254 rmail-total-messages total 226 (setq summary-msgs
255 rmail-current-message current-message))) 227 (cons (cons msgnum (rmail-summary-get-summary msgnum))
256 (setq rmail-summary-buffer sumbuf) 228 summary-msgs)))
257 229 (setq msgnum (1+ msgnum)))
258 (set-buffer rmail-summary-buffer) 230 (setq summary-msgs (nreverse summary-msgs))
231
232 ;; Place the collected summaries into the summary buffer.
233 (setq rmail-summary-buffer nil)
234 (save-excursion
235 (let ((rbuf (current-buffer))
236 (vbuf rmail-view-buffer)
237 (total rmail-total-messages))
238 (set-buffer sumbuf)
239 ;; Set up the summary buffer's contents.
240 (let ((buffer-read-only nil))
241 (erase-buffer)
242 (while summary-msgs
243 (princ (cdr (car summary-msgs)) sumbuf)
244 (setq summary-msgs (cdr summary-msgs)))
245 (goto-char (point-min)))
246 ;; Set up the rest of its state and local variables.
247 (setq buffer-read-only t)
248 (rmail-summary-mode)
249 (make-local-variable 'minor-mode-alist)
250 (setq minor-mode-alist (list (list t (concat ": " description))))
251 (setq rmail-buffer rbuf
252 rmail-view-buffer vbuf
253 rmail-summary-redo redo-form
254 rmail-total-messages total
255 rmail-current-message current-message)))
256 (setq rmail-summary-buffer sumbuf))
257
258 ;; Now display the summary buffer and go to the right place in it.
259 (or was-in-summary
260 (progn
261 (if (and (one-window-p)
262 pop-up-windows (not pop-up-frames))
263 ;; If there is just one window, put the summary on the top.
264 (progn
265 (split-window (selected-window) rmail-summary-window-size)
266 (select-window (next-window (frame-first-window)))
267 (pop-to-buffer sumbuf)
268 ;; If pop-to-buffer did not use that window, delete that
269 ;; window. (This can happen if it uses another frame.)
270 (if (not (eq sumbuf (window-buffer (frame-first-window))))
271 (delete-other-windows)))
272 (pop-to-buffer sumbuf))
273 (set-buffer rmail-buffer)
274 ;; This is how rmail makes the summary buffer reappear.
275 ;; We do this here to make the window the proper size.
276 (rmail-select-summary nil)))
277
259 (rmail-summary-goto-msg current-message nil t) 278 (rmail-summary-goto-msg current-message nil t)
260 (rmail-summary-construct-io-menu) 279 (rmail-summary-construct-io-menu)
261
262 ;; Now display the summary buffer and go to the right place in it.
263 (or was-in-summary
264 (progn
265 (if (and (one-window-p)
266 pop-up-windows (not pop-up-frames))
267 ;; If there is just one window, put the summary on the top.
268 (progn
269 (split-window (selected-window) rmail-summary-window-size)
270 (select-window (next-window (frame-first-window)))
271 (pop-to-buffer sumbuf)
272 ;; If pop-to-buffer did not use that window, delete that
273 ;; window. (This can happen if it uses another frame.)
274 (if (not (eq sumbuf (window-buffer (frame-first-window))))
275 (delete-other-windows))))
276 ;;(pop-to-buffer sumbuf))
277 (set-buffer rmail-buffer)
278 ;; This is how rmail makes the summary buffer reappear.
279 ;; We do this here to make the window the proper size.
280 (rmail-select-summary nil)))
281 (message "Computing summary lines...done"))) 280 (message "Computing summary lines...done")))
282 281
283 ;;;; Low levels of generating a summary. 282 ;;;; Low levels of generating a summary.
284
285 ;;; mbox: deprecated
286 (defun rmail-make-summary-line (msg)
287 (let* ((new-summary-line-count 0)
288 (line (or (aref rmail-summary-vector (1- msg))
289 (progn
290 (setq new-summary-line-count
291 (1+ new-summary-line-count))
292 (if (zerop (% new-summary-line-count 10))
293 (message "Computing summary lines...%d"
294 new-summary-line-count))
295 (rmail-make-summary-line-1 msg)))))
296 ;; Fix up the part of the summary that says "deleted" or "unseen".
297 (aset line 5
298 (if (rmail-message-deleted-p msg) ?\D
299 (if (= ?0 (char-after (+ 3 (rmail-msgbeg msg))))
300 ?\- ?\ )))
301 line))
302 283
303 ;;;###autoload 284 ;;;###autoload
304 (defcustom rmail-summary-line-decoder (function identity) 285 (defcustom rmail-summary-line-decoder (function identity)
305 "*Function to decode summary-line. 286 "*Function to decode summary-line.
306 287
1670 (or (rmail-desc-get-attr-code rmail-desc-edited-index n) " ") 1651 (or (rmail-desc-get-attr-code rmail-desc-edited-index n) " ")
1671 (or (rmail-desc-get-attr-code rmail-desc-stored-index n) " "))) 1652 (or (rmail-desc-get-attr-code rmail-desc-stored-index n) " ")))
1672 1653
1673 (defun rmail-summary-get-summary (n) 1654 (defun rmail-summary-get-summary (n)
1674 "Return a summary line for message N." 1655 "Return a summary line for message N."
1675 (format "%4s%s%6s %25s %s %s\n" 1656 (funcall rmail-summary-line-decoder
1676 n 1657 (format "%4s%s%6s %25s %s %s\n"
1677 (rmail-summary-get-summary-attributes n) 1658 n
1678 (concat (rmail-desc-get-day-number n) "-" 1659 (rmail-summary-get-summary-attributes n)
1679 (rmail-desc-get-month n)) 1660 (concat (rmail-desc-get-day-number n) "-"
1680 (rmail-desc-get-sender n) 1661 (rmail-desc-get-month n))
1681 (rmail-summary-get-line-count n) 1662 (rmail-desc-get-sender n)
1682 (rmail-desc-get-subject n))) 1663 (rmail-summary-get-line-count n)
1664 (rmail-desc-get-subject n))))
1683 1665
1684 (defun rmail-summary-update-attribute (attr-index n) 1666 (defun rmail-summary-update-attribute (attr-index n)
1685 "Update the attribute denoted by ATTR-INDEX in message N." 1667 "Update the attribute denoted by ATTR-INDEX in message N."
1686 (save-excursion 1668 (save-excursion
1687 (let (offset) 1669 (let (offset)