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