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