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