merge trunk
[emacs.git] / lisp / mh-e / mh-buffers.el
blob3410d859c49a163a04fd8a7d1967f0b9879a83ee
1 ;;; mh-buffers.el --- MH-E buffer constants and utilities
3 ;; Copyright (C) 1993, 1995, 1997, 2000-2012 Free Software Foundation, Inc.
5 ;; Author: Bill Wohler <wohler@newt.com>
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
7 ;; Keywords: mail
8 ;; See: mh-e.el
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;;; Change Log:
29 ;;; Code:
31 ;; The names of ephemeral buffers have a " *mh-" prefix (so that they
32 ;; are hidden and can be programmatically removed in mh-quit), and the
33 ;; variable names have the form mh-temp-.*-buffer.
34 (defconst mh-temp-buffer " *mh-temp*") ;scratch
35 (defconst mh-temp-checksum-buffer " *mh-checksum*")
36 (defconst mh-temp-fetch-buffer " *mh-fetch*") ;wget/curl/fetch output
37 (defconst mh-temp-index-buffer " *mh-index*")
39 ;; The names of MH-E buffers that are not ephemeral and can be used by
40 ;; the user (and deleted by the user when no longer needed) have a
41 ;; "*MH-E " prefix (so they can be programmatically removed in
42 ;; mh-quit), and the variable names have the form mh-.*-buffer.
43 ;; Temporary buffers for search results
44 (defconst mh-aliases-buffer "*MH-E Aliases*") ;alias lookups
45 (defconst mh-folders-buffer "*MH-E Folders*") ;folder list
46 (defconst mh-help-buffer "*MH-E Help*") ;quick help
47 (defconst mh-info-buffer "*MH-E Info*") ;version information buffer
48 (defconst mh-log-buffer "*MH-E Log*") ;output of MH commands and so on
49 (defconst mh-mail-delivery-buffer "*MH-E Mail Delivery*") ;mail delivery log
50 (defconst mh-recipients-buffer "*MH-E Recipients*") ;killed when draft sent
51 (defconst mh-sequences-buffer "*MH-E Sequences*") ;sequences list
53 (defvar mh-log-buffer-lines 100
54 "Number of lines to keep in `mh-log-buffer'.")
58 (defun mh-truncate-log-buffer ()
59 "If `mh-log-buffer' is too big then truncate it.
60 If the number of lines in `mh-log-buffer' exceeds
61 `mh-log-buffer-lines' then keep only the last
62 `mh-log-buffer-lines'. As a side effect the point is set to the
63 end of the log buffer.
65 The function returns the size of the final size of the log buffer."
66 (with-current-buffer (get-buffer-create mh-log-buffer)
67 (goto-char (point-max))
68 (save-excursion
69 (when (equal (forward-line (- mh-log-buffer-lines)) 0)
70 (delete-region (point-min) (point))))
71 (unless (or (bobp)
72 (save-excursion
73 (and (equal (forward-line -1) 0) (equal (char-after) ?\f))))
74 (insert "\n\f\n"))
75 (buffer-size)))
77 (provide 'mh-buffers)
79 ;; Local Variables:
80 ;; indent-tabs-mode: nil
81 ;; sentence-end-double-space: nil
82 ;; End:
84 ;;; mh-buffers.el ends here