Mercurial > emacs
annotate lisp/mh-e/mh-utils.el @ 80793:7aad137aaf4e
Copy in some minor bug fixes from the trunk.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Wed, 03 Sep 2008 21:01:12 +0000 |
parents | 3c2488d0ebd9 |
children | 107ccd98fa12 |
rev | line source |
---|---|
68465 | 1 ;;; mh-utils.el --- MH-E general utilities |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
2 |
62847
aa8c2e12ee24
Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents:
62767
diff
changeset
|
3 ;; Copyright (C) 1993, 1995, 1997, |
79713 | 4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
5 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
6 ;; Author: Bill Wohler <wohler@newt.com> |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
7 ;; Maintainer: Bill Wohler <wohler@newt.com> |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
8 ;; Keywords: mail |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
9 ;; See: mh-e.el |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
10 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
12 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
78231
800dd75c042b
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
16 ;; any later version. |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
17 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
21 ;; GNU General Public License for more details. |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
22 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
27 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
28 ;;; Commentary: |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
29 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
30 ;;; Change Log: |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
31 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
32 ;;; Code: |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
33 |
68465 | 34 (require 'mh-e) |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
35 (mh-require-cl) |
68096
57c4e7929f99
* mh-alias.el (mh-alias-gecos-name): Use replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68013
diff
changeset
|
36 |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
37 (require 'font-lock) |
67681 | 38 |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
39 ;;; CL Replacements |
67681 | 40 |
68465 | 41 ;;;###mh-autoload |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
42 (defun mh-search-from-end (char string) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
43 "Return the position of last occurrence of CHAR in STRING. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
44 If CHAR is not present in STRING then return nil. The function is |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
45 used in lieu of `search' in the CL package." |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
46 (loop for index from (1- (length string)) downto 0 |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
47 when (equal (aref string index) char) return index |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
48 finally return nil)) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
49 |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
50 |
67681 | 51 |
68465 | 52 ;;; General Utilities |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
53 |
68465 | 54 ;;;###mh-autoload |
55 (defun mh-beginning-of-word (&optional n) | |
56 "Return position of the N th word backwards." | |
57 (unless n (setq n 1)) | |
58 (let ((syntax-table (syntax-table))) | |
59 (unwind-protect | |
60 (save-excursion | |
68520
6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents:
68477
diff
changeset
|
61 (mh-mail-abbrev-make-syntax-table) |
68465 | 62 (set-syntax-table mail-abbrev-syntax-table) |
63 (backward-word n) | |
64 (point)) | |
65 (set-syntax-table syntax-table)))) | |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
66 |
68465 | 67 ;;;###mh-autoload |
68 (defun mh-colors-available-p () | |
69 "Check if colors are available in the Emacs being used." | |
70 (or mh-xemacs-flag | |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
71 (let ((color-cells (mh-display-color-cells))) |
68465 | 72 (and (numberp color-cells) (>= color-cells 8))))) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
73 |
68465 | 74 ;;;###mh-autoload |
75 (defun mh-colors-in-use-p () | |
76 "Check if colors are being used in the folder buffer." | |
77 (and mh-colors-available-flag font-lock-mode)) | |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
78 |
68465 | 79 ;;;###mh-autoload |
80 (defun mh-delete-line (lines) | |
81 "Delete the next LINES lines." | |
82 (delete-region (point) (progn (forward-line lines) (point)))) | |
83 | |
84 ;;;###mh-autoload | |
85 (defun mh-make-local-vars (&rest pairs) | |
86 "Initialize local variables according to the variable-value PAIRS." | |
87 (while pairs | |
88 (set (make-local-variable (car pairs)) (car (cdr pairs))) | |
89 (setq pairs (cdr (cdr pairs))))) | |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
90 |
68465 | 91 ;;;###mh-autoload |
92 (defun mh-mapc (function list) | |
93 "Apply FUNCTION to each element of LIST for side effects only." | |
94 (while list | |
95 (funcall function (car list)) | |
96 (setq list (cdr list)))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
97 |
69221
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
98 (defvar mh-pick-regexp-chars ".*$[" |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
99 "List of special characters in pick regular expressions.") |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
100 |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
101 ;;;###mh-autoload |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
102 (defun mh-quote-pick-expr (pick-expr) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
103 "Quote `mh-pick-regexp-chars' in PICK-EXPR. |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
104 PICK-EXPR is a list of strings. Return nil if PICK-EXPR is nil." |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
105 (let ((quoted-pick-expr)) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
106 (dolist (string pick-expr) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
107 (when (and string |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
108 (not (string-equal string ""))) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
109 (loop for i from 0 to (1- (length mh-pick-regexp-chars)) do |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
110 (let ((s (string ?\\ (aref mh-pick-regexp-chars i)))) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
111 (setq string (mh-replace-regexp-in-string s s string t t)))) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
112 (setq quoted-pick-expr (append quoted-pick-expr (list string))))) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
113 quoted-pick-expr)) |
7db1bc48b98c
* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
Bill Wohler <wohler@newt.com>
parents:
69215
diff
changeset
|
114 |
68465 | 115 ;;;###mh-autoload |
116 (defun mh-replace-string (old new) | |
117 "Replace all occurrences of OLD with NEW in the current buffer. | |
118 Ignores case when searching for OLD." | |
119 (goto-char (point-min)) | |
120 (let ((case-fold-search t)) | |
121 (while (search-forward old nil t) | |
122 (replace-match new t t)))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
123 |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
124 |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
125 |
68465 | 126 ;;; Logo Display |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
127 |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
128 (defvar mh-logo-cache nil) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
129 |
69492
6afc0d1f682b
* mh-compat.el (mh-image-load-path-for-library): Fix example by not
Bill Wohler <wohler@newt.com>
parents:
69472
diff
changeset
|
130 ;; Shush compiler. |
6afc0d1f682b
* mh-compat.el (mh-image-load-path-for-library): Fix example by not
Bill Wohler <wohler@newt.com>
parents:
69472
diff
changeset
|
131 (defvar image-load-path) |
6afc0d1f682b
* mh-compat.el (mh-image-load-path-for-library): Fix example by not
Bill Wohler <wohler@newt.com>
parents:
69472
diff
changeset
|
132 |
68465 | 133 ;;;###mh-autoload |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
134 (defun mh-logo-display () |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
135 "Modify mode line to display MH-E logo." |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
136 (mh-do-in-gnu-emacs |
69472
5259cc742763
* mh-compat.el (mh-image-load-path-for-library): Incorporate changes
Bill Wohler <wohler@newt.com>
parents:
69451
diff
changeset
|
137 (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm")) |
69492
6afc0d1f682b
* mh-compat.el (mh-image-load-path-for-library): Fix example by not
Bill Wohler <wohler@newt.com>
parents:
69472
diff
changeset
|
138 (image-load-path (cons (car load-path) |
6afc0d1f682b
* mh-compat.el (mh-image-load-path-for-library): Fix example by not
Bill Wohler <wohler@newt.com>
parents:
69472
diff
changeset
|
139 (when (boundp 'image-load-path) |
6afc0d1f682b
* mh-compat.el (mh-image-load-path-for-library): Fix example by not
Bill Wohler <wohler@newt.com>
parents:
69472
diff
changeset
|
140 image-load-path)))) |
69245
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
141 (add-text-properties |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
142 0 2 |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
143 `(display ,(or mh-logo-cache |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
144 (setq mh-logo-cache |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
145 (mh-funcall-if-exists |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
146 find-image '((:type xpm :ascent center |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
147 :file "mh-logo.xpm")))))) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
148 (car mode-line-buffer-identification)))) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
149 (mh-do-in-xemacs |
69245
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
150 (setq modeline-buffer-identification |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
151 (list |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
152 (if mh-modeline-glyph |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
153 (cons modeline-buffer-id-left-extent mh-modeline-glyph) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
154 (cons modeline-buffer-id-left-extent "XEmacs%N:")) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
69221
diff
changeset
|
155 (cons modeline-buffer-id-right-extent " %17b"))))) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
156 |
68465 | 157 |
158 | |
159 ;;; Read MH Profile | |
160 | |
161 (defvar mh-find-path-run nil | |
162 "Non-nil if `mh-find-path' has been run already. | |
163 Do not access this variable; `mh-find-path' already uses it to | |
164 avoid running more than once.") | |
67756
7ff92ad99326
* mh-alias.el (mh-alias-reload): Sync docstrings with manual.
Bill Wohler <wohler@newt.com>
parents:
67681
diff
changeset
|
165 |
68465 | 166 ;;;###mh-autoload |
167 (defun mh-find-path () | |
168 "Set variables from user's MH profile. | |
169 | |
170 This function sets `mh-user-path' from your \"Path:\" MH profile | |
171 component (but defaults to \"Mail\" if one isn't present), | |
172 `mh-draft-folder' from \"Draft-Folder:\", `mh-unseen-seq' from | |
173 \"Unseen-Sequence:\", `mh-previous-seq' from | |
174 \"Previous-Sequence:\", and `mh-inbox' from \"Inbox:\" (defaults | |
175 to \"+inbox\"). | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
176 |
68465 | 177 The hook `mh-find-path-hook' is run after these variables have |
178 been set. This hook can be used the change the value of these | |
179 variables if you need to run with different values between MH and | |
180 MH-E." | |
181 (unless mh-find-path-run | |
182 ;; Sanity checks. | |
183 (if (and (getenv "MH") | |
184 (not (file-readable-p (getenv "MH")))) | |
185 (error "MH environment variable contains unreadable file %s" | |
186 (getenv "MH"))) | |
187 (if (null (mh-variants)) | |
188 (error "Install MH and run install-mh before running MH-E")) | |
189 (let ((profile "~/.mh_profile")) | |
190 (if (not (file-readable-p profile)) | |
191 (error "Run install-mh before running MH-E"))) | |
192 ;; Read MH profile. | |
193 (setq mh-user-path (mh-profile-component "Path")) | |
194 (if (not mh-user-path) | |
195 (setq mh-user-path "Mail")) | |
196 (setq mh-user-path | |
197 (file-name-as-directory | |
198 (expand-file-name mh-user-path (expand-file-name "~")))) | |
199 (mh-set-x-image-cache-directory (expand-file-name ".mhe-x-image-cache" | |
200 mh-user-path)) | |
201 (setq mh-draft-folder (mh-profile-component "Draft-Folder")) | |
202 (if mh-draft-folder | |
203 (progn | |
204 (if (not (mh-folder-name-p mh-draft-folder)) | |
205 (setq mh-draft-folder (format "+%s" mh-draft-folder))) | |
206 (if (not (file-exists-p (mh-expand-file-name mh-draft-folder))) | |
207 (error | |
208 "Draft folder \"%s\" not found; create it and try again" | |
209 (mh-expand-file-name mh-draft-folder))))) | |
210 (setq mh-inbox (mh-profile-component "Inbox")) | |
211 (cond ((not mh-inbox) | |
212 (setq mh-inbox "+inbox")) | |
213 ((not (mh-folder-name-p mh-inbox)) | |
214 (setq mh-inbox (format "+%s" mh-inbox)))) | |
215 (setq mh-unseen-seq (mh-profile-component "Unseen-Sequence")) | |
216 (if mh-unseen-seq | |
217 (setq mh-unseen-seq (intern mh-unseen-seq)) | |
218 (setq mh-unseen-seq 'unseen)) ;old MH default? | |
219 (setq mh-previous-seq (mh-profile-component "Previous-Sequence")) | |
220 (if mh-previous-seq | |
221 (setq mh-previous-seq (intern mh-previous-seq))) | |
222 (run-hooks 'mh-find-path-hook) | |
223 (mh-collect-folder-names) | |
224 (setq mh-find-path-run t))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
225 |
67681 | 226 |
227 | |
68465 | 228 ;;; Help Functions |
229 | |
230 ;;;###mh-autoload | |
231 (defun mh-ephem-message (string) | |
232 "Display STRING in the minibuffer momentarily." | |
233 (message "%s" string) | |
234 (sit-for 5) | |
235 (message "")) | |
236 | |
237 (defvar mh-help-default nil | |
238 "Mode to use if messages are not present for the current mode.") | |
239 | |
240 (defvar mh-help-messages nil | |
241 "Help messages for all modes. | |
242 This is an alist of alists. The primary key is a symbol | |
243 representing the mode; the value is described in `mh-set-help'.") | |
244 | |
245 ;;;###mh-autoload | |
246 (defun mh-set-help (messages &optional default) | |
247 "Set help messages. | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
248 |
68465 | 249 The MESSAGES are assumed to be an associative array. It is used |
250 to show help for the most common commands in the current mode. | |
251 The key is a prefix char. The value is one or more strings which | |
252 are concatenated together and displayed in a help buffer if ? is | |
253 pressed after the prefix character. The special key nil is used | |
254 to display the non-prefixed commands. | |
255 | |
256 The substitutions described in `substitute-command-keys' are performed as | |
257 well. | |
258 | |
259 If optional argument DEFAULT is non-nil, then these messages will | |
260 be used if help is asked for an unknown mode." | |
261 (add-to-list 'mh-help-messages (cons major-mode messages)) | |
262 (if default | |
263 (setq mh-help-default major-mode))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
264 |
68465 | 265 ;;;###mh-autoload |
266 (defun mh-help (&optional help-messages) | |
267 "Display cheat sheet for the MH-E commands. | |
268 See `mh-set-help' for setting the help messages. | |
269 HELP-MESSAGES are used instead if given. | |
270 This is a list of one or more strings which are concatenated together | |
271 and displayed in a help buffer." | |
272 (interactive) | |
273 (let* ((help (or help-messages | |
274 (cdr (assoc nil (assoc major-mode mh-help-messages))))) | |
275 (text (substitute-command-keys (mapconcat 'identity help "")))) | |
276 (with-electric-help | |
277 (function | |
278 (lambda () | |
279 (insert text))) | |
280 mh-help-buffer))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
281 |
68465 | 282 ;;;###mh-autoload |
283 (defun mh-prefix-help () | |
284 "Display cheat sheet for the commands of the current prefix in minibuffer." | |
285 (interactive) | |
286 ;; We got here because the user pressed a "?", but he pressed a prefix key | |
287 ;; before that. Since the the key vector starts at index 0, the index of the | |
288 ;; last keystroke is length-1 and thus the second to last keystroke is at | |
289 ;; length-2. We use that information to obtain a suitable prefix character | |
290 ;; from the recent keys. | |
291 (let* ((keys (recent-keys)) | |
292 (prefix-char (elt keys (- (length keys) 2))) | |
293 (help (cdr (assoc prefix-char (assoc major-mode mh-help-messages))))) | |
294 (mh-help help))) | |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
295 |
68465 | 296 |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
297 |
68465 | 298 ;;; Message Number Utilities |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
299 |
68465 | 300 ;;;###mh-autoload |
301 (defun mh-coalesce-msg-list (messages) | |
302 "Given a list of MESSAGES, return a list of message number ranges. | |
303 This is the inverse of `mh-read-msg-list', which expands ranges. | |
304 Message lists passed to MH programs should be processed by this | |
305 function to avoid exceeding system command line argument limits." | |
306 (let ((msgs (sort (copy-sequence messages) 'mh-greaterp)) | |
307 (range-high nil) | |
308 (prev -1) | |
309 (ranges nil)) | |
310 (while prev | |
311 (if range-high | |
312 (if (or (not (numberp prev)) | |
313 (not (equal (car msgs) (1- prev)))) | |
314 (progn ;non-sequential, flush old range | |
315 (if (eq prev range-high) | |
316 (setq ranges (cons range-high ranges)) | |
317 (setq ranges (cons (format "%s-%s" prev range-high) ranges))) | |
318 (setq range-high nil)))) | |
319 (or range-high | |
320 (setq range-high (car msgs))) ;start new or first range | |
321 (setq prev (car msgs)) | |
322 (setq msgs (cdr msgs))) | |
323 ranges)) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
324 |
68465 | 325 (defun mh-greaterp (msg1 msg2) |
326 "Return the greater of two message indicators MSG1 and MSG2. | |
327 Strings are \"smaller\" than numbers. | |
328 Valid values are things like \"cur\", \"last\", 1, and 1820." | |
329 (if (numberp msg1) | |
330 (if (numberp msg2) | |
331 (> msg1 msg2) | |
332 t) | |
333 (if (numberp msg2) | |
334 nil | |
335 (string-lessp msg2 msg1)))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
336 |
68465 | 337 ;;;###mh-autoload |
338 (defun mh-lessp (msg1 msg2) | |
339 "Return the lesser of two message indicators MSG1 and MSG2. | |
340 Strings are \"smaller\" than numbers. | |
341 Valid values are things like \"cur\", \"last\", 1, and 1820." | |
342 (not (mh-greaterp msg1 msg2))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
343 |
68465 | 344 ;;;###mh-autoload |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
345 (defun mh-get-msg-num (error-if-no-message) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
346 "Return the message number of the displayed message. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
347 If the argument ERROR-IF-NO-MESSAGE is non-nil, then complain if |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
348 the cursor is not pointing to a message." |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
349 (save-excursion |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
350 (beginning-of-line) |
68465 | 351 (cond ((looking-at (mh-scan-msg-number-regexp)) |
62847
aa8c2e12ee24
Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents:
62767
diff
changeset
|
352 (string-to-number (buffer-substring (match-beginning 1) |
aa8c2e12ee24
Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents:
62767
diff
changeset
|
353 (match-end 1)))) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
354 (error-if-no-message |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
355 (error "Cursor not pointing to message")) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
356 (t nil)))) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
357 |
68465 | 358 (add-to-list 'debug-ignored-errors "^Cursor not pointing to message$") |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
359 |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
360 |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
361 |
68465 | 362 ;;; Folder Cache and Access |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
363 |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
364 (defvar mh-sub-folders-cache (make-hash-table :test #'equal)) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
365 (defvar mh-current-folder-name nil) |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
366 (defvar mh-flists-partial-line "") |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
367 (defvar mh-flists-process nil) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
368 |
68465 | 369 ;;;###mh-autoload |
370 (defun mh-clear-sub-folders-cache () | |
371 "Clear `mh-sub-folders-cache'." | |
372 (clrhash mh-sub-folders-cache)) | |
373 | |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
374 ;; Initialize mh-sub-folders-cache... |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
375 (defun mh-collect-folder-names () |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
376 "Collect folder names by running \"folders\"." |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
377 (unless mh-flists-process |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
378 (setq mh-flists-process |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
379 (mh-exec-cmd-daemon "folders" 'mh-collect-folder-names-filter |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
380 "-recurse" "-fast")))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
381 |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
382 (defun mh-collect-folder-names-filter (process output) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
383 "Read folder names. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
384 PROCESS is the flists process that was run to collect folder |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
385 names and the function is called when OUTPUT is available." |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
386 (let ((position 0) |
68465 | 387 (prevailing-match-data (match-data)) |
388 line-end folder) | |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
389 (unwind-protect |
68465 | 390 (while (setq line-end (string-match "\n" output position)) |
391 (setq folder (format "+%s%s" | |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
392 mh-flists-partial-line |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
393 (substring output position line-end))) |
68465 | 394 (setq mh-flists-partial-line "") |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
395 (unless (equal (aref folder 1) ?.) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
396 (mh-populate-sub-folders-cache folder)) |
68465 | 397 (setq position (1+ line-end))) |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
398 (set-match-data prevailing-match-data)) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
399 (setq mh-flists-partial-line (substring output position)))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
400 |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
401 (defun mh-populate-sub-folders-cache (folder) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
402 "Tell `mh-sub-folders-cache' about FOLDER." |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
403 (let* ((last-slash (mh-search-from-end ?/ folder)) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
404 (child1 (substring folder (1+ (or last-slash 0)))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
405 (parent (and last-slash (substring folder 0 last-slash))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
406 (parent-slash (and parent (mh-search-from-end ?/ parent))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
407 (child2 (and parent (substring parent (1+ (or parent-slash 0))))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
408 (grand-parent (and parent-slash (substring parent 0 parent-slash))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
409 (cache-entry (gethash parent mh-sub-folders-cache))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
410 (unless (loop for x in cache-entry when (equal (car x) child1) return t |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
411 finally return nil) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
412 (push (list child1) cache-entry) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
413 (setf (gethash parent mh-sub-folders-cache) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
414 (sort cache-entry (lambda (x y) (string< (car x) (car y))))) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
415 (when parent |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
416 (loop for x in (gethash grand-parent mh-sub-folders-cache) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
417 when (equal (car x) child2) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
418 do (progn (setf (cdr x) t) (return))))))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
419 |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
420 (defun mh-normalize-folder-name (folder &optional empty-string-okay |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
421 dont-remove-trailing-slash |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
422 return-nil-if-folder-empty) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
423 "Normalizes FOLDER name. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
424 |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
425 Makes sure that two '/' characters never occur next to each |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
426 other. Also all occurrences of \"..\" and \".\" are suitably |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
427 processed. So \"+inbox/../news\" will be normalized to \"+news\". |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
428 |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
429 If optional argument EMPTY-STRING-OKAY is nil then a '+' is added |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
430 at the front if FOLDER lacks one. If non-nil and FOLDER is the |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
431 empty string then nothing is added. |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
432 |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
433 If optional argument DONT-REMOVE-TRAILING-SLASH is non-nil then a |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
434 trailing '/' if present is retained (if present), otherwise it is |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
435 removed. |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
436 |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
437 If optional argument RETURN-NIL-IF-FOLDER-EMPTY is non-nil, then |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
438 return nil if FOLDER is \"\" or \"+\". This is useful when |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
439 normalizing the folder for the \"folders\" command which displays |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
440 the directories in / if passed \"+\". This is usually not |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
441 desired. If this argument is non-nil, then EMPTY-STRING-OKAY has |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
442 no effect." |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
443 (cond |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
444 ((if (and (or (equal folder "+") (equal folder "")) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
445 return-nil-if-folder-empty) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
446 (setq folder nil))) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
447 ((stringp folder) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
448 ;; Replace two or more consecutive '/' characters with a single '/' |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
449 (while (string-match "//" folder) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
450 (setq folder (replace-match "/" nil t folder))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
451 (let* ((length (length folder)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
452 (trailing-slash-present (and (> length 0) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
453 (equal (aref folder (1- length)) ?/))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
454 (leading-slash-present (and (> length 0) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
455 (equal (aref folder 0) ?/)))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
456 (when (and (> length 0) (equal (aref folder 0) ?@) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
457 (stringp mh-current-folder-name)) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
458 (setq folder (format "%s/%s/" mh-current-folder-name |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
459 (substring folder 1)))) |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
460 ;; XXX: Purge empty strings from the list that split-string |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
461 ;; returns. In XEmacs, (split-string "+foo/" "/") returns |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
462 ;; ("+foo" "") while in GNU Emacs it returns ("+foo"). In the |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
463 ;; code it is assumed that the components list has no empty |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
464 ;; strings. |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
465 (let ((components (delete "" (split-string folder "/"))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
466 (result ())) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
467 ;; Remove .. and . from the pathname. |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
468 (dolist (component components) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
469 (cond ((and (equal component "..") result) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
470 (pop result)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
471 ((equal component "..")) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
472 ((equal component ".")) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
473 (t (push component result)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
474 (setq folder "") |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
475 (dolist (component result) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
476 (setq folder (concat component "/" folder))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
477 ;; Remove trailing '/' if needed. |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
478 (unless (and trailing-slash-present dont-remove-trailing-slash) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
479 (when (not (equal folder "")) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
480 (setq folder (substring folder 0 (1- (length folder)))))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
481 (when leading-slash-present |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
482 (setq folder (concat "/" folder))))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
483 (cond ((and empty-string-okay (equal folder ""))) |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
484 ((equal folder "") |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
485 (setq folder "+")) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
486 ((not (equal (aref folder 0) ?+)) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
487 (setq folder (concat "+" folder)))))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
488 folder) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
489 |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
490 (defmacro mh-children-p (folder) |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
491 "Return t if FOLDER from sub-folders cache has children. |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
492 The car of folder is the name, and the cdr is either t or some |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
493 sort of count that I do not understand. It's too small to be the |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
494 number of messages in the sub-folders and too large to be the |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
495 number of sub-folders. XXX" |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
496 `(if (cdr ,folder) |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
497 t |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
498 nil)) |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
499 |
68465 | 500 ;;;###mh-autoload |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
501 (defun mh-folder-list (folder) |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
502 "Return FOLDER and its descendents. |
69215
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
503 FOLDER may have a + prefix. Returns a list of strings without the |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
504 + prefix. If FOLDER is nil, then all folders are considered. For |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
505 example, if your Mail directory only contains the folders +inbox, |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
506 +outbox, +lists, and +lists/mh-e, then |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
507 |
69215
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
508 (mh-folder-list nil) |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
509 => (\"inbox\" \"lists\" \"lists/mh-e\" \"outbox\") |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
510 (mh-folder-list \"+lists\") |
69451
6c89c044a798
(mh-folder-list): Fix docstring (closes SF #1448498).
Bill Wohler <wohler@newt.com>
parents:
69286
diff
changeset
|
511 => (\"lists\" \"lists/mh-e\") |
69215
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
512 |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
513 Respects the value of `mh-recursive-folders-flag'. If this flag |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
514 is nil, and the sub-folders have not been explicitly viewed, then |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
515 they will not be returned." |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
516 (let ((folder-list)) |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
517 ;; Normalize folder. Strip leading + and trailing slash(es). If no |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
518 ;; folder is specified, ensure it is nil to avoid adding the |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
519 ;; folder to the folder-list and adding a slash to it. |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
520 (when folder |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
521 (setq folder (mh-replace-regexp-in-string "^\+" "" folder)) |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
522 (setq folder (mh-replace-regexp-in-string "/+$" "" folder)) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
523 (if (equal folder "") |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
524 (setq folder nil))) |
69215
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
525 ;; Add provided folder to list, unless all folders are asked for. |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
526 ;; Then append slash to separate sub-folders. |
69215
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
527 (unless (null folder) |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
528 (setq folder-list (list folder)) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
529 (setq folder (concat folder "/"))) |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
530 (loop for f in (mh-sub-folders folder) do |
69215
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
531 (setq folder-list |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
532 (append folder-list |
ef5cd9601f14
(mh-folder-list): Fix problem with passing in a folder and getting
Bill Wohler <wohler@newt.com>
parents:
69212
diff
changeset
|
533 (if (mh-children-p f) |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
534 (mh-folder-list (concat folder (car f))) |
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
535 (list (concat folder (car f))))))) |
68188
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
536 folder-list)) |
dcf226991252
* mh-search.el (mh-index-next-result-function): Add format to
Bill Wohler <wohler@newt.com>
parents:
68163
diff
changeset
|
537 |
68465 | 538 ;;;###mh-autoload |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
539 (defun mh-sub-folders (folder &optional add-trailing-slash-flag) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
540 "Find the subfolders of FOLDER. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
541 The function avoids running folders unnecessarily by caching the |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
542 results of the actual folders call. |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
543 |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
544 If optional argument ADD-TRAILING-SLASH-FLAG is non-nil then a |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
545 slash is added to each of the sub-folder names that may have |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
546 nested folders within them." |
69278
ade4a047af1b
* mh-compat.el (mh-image-load-path-for-library): Move here from
Bill Wohler <wohler@newt.com>
parents:
69273
diff
changeset
|
547 (let* ((folder (mh-normalize-folder-name folder nil nil t)) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
548 (match (gethash folder mh-sub-folders-cache 'no-result)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
549 (sub-folders (cond ((eq match 'no-result) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
550 (setf (gethash folder mh-sub-folders-cache) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
551 (mh-sub-folders-actual folder))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
552 (t match)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
553 (if add-trailing-slash-flag |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
554 (mapcar #'(lambda (x) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
555 (if (cdr x) (cons (concat (car x) "/") (cdr x)) x)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
556 sub-folders) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
557 sub-folders))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
558 |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
559 ;; FIXME: This function does not do well if FOLDER does not exist. It |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
560 ;; then changes the context to that folder which causes problems down |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
561 ;; the line. Since a folder in the cache could later be deleted, it |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
562 ;; would be good for mh-sub-folders-actual to return nil in this case |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
563 ;; so that mh-sub-folders could delete it from the cache. This |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
564 ;; function could protect itself by using a temporary context. |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
565 (defun mh-sub-folders-actual (folder) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
566 "Execute the command folders to return the sub-folders of FOLDER. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
567 Filters out the folder names that start with \".\" so that |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
568 directories that aren't usually mail folders are hidden. |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
569 Expects FOLDER to have already been normalized with |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
570 (mh-normalize-folder-name folder nil nil t)" |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
571 (let ((arg-list `(,(expand-file-name "folders" mh-progs) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
572 nil (t nil) nil "-noheader" "-norecurse" "-nototal" |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
573 ,@(if (stringp folder) (list folder) ()))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
574 (results ()) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
575 (current-folder (concat |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
576 (with-temp-buffer |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
577 (call-process (expand-file-name "folder" mh-progs) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
578 nil '(t nil) nil "-fast") |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
579 (buffer-substring (point-min) (1- (point-max)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
580 "+"))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
581 (with-temp-buffer |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
582 (apply #'call-process arg-list) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
583 (goto-char (point-min)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
584 (while (not (and (eolp) (bolp))) |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
585 (goto-char (mh-line-end-position)) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
586 (let ((start-pos (mh-line-beginning-position)) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
587 (has-pos (search-backward " has " |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
588 (mh-line-beginning-position) t))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
589 (when (integerp has-pos) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
590 (while (equal (char-after has-pos) ? ) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
591 (decf has-pos)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
592 (incf has-pos) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
593 (while (equal (char-after start-pos) ? ) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
594 (incf start-pos)) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
595 (let* ((name (buffer-substring start-pos has-pos)) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
596 (first-char (aref name 0)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
597 (last-char (aref name (1- (length name))))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
598 (unless (member first-char '(?. ?# ?,)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
599 (when (and (equal last-char ?+) (equal name current-folder)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
600 (setq name (substring name 0 (1- (length name))))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
601 (push |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
602 (cons name |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
603 (search-forward "(others)" (mh-line-end-position) t)) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
604 results)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
605 (forward-line 1)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
606 (setq results (nreverse results)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
607 (when (stringp folder) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
608 (setq results (cdr results)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
609 (let ((folder-name-len (length (format "%s/" (substring folder 1))))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
610 (setq results (mapcar (lambda (f) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
611 (cons (substring (car f) folder-name-len) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
612 (cdr f))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
613 results)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
614 results)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
615 |
68465 | 616 ;;;###mh-autoload |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
617 (defun mh-remove-from-sub-folders-cache (folder) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
618 "Remove FOLDER and its parent from `mh-sub-folders-cache'. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
619 FOLDER should be unconditionally removed from the cache. Also the |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
620 last ancestor of FOLDER present in the cache must be removed as |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
621 well. |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
622 |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
623 To see why this is needed assume we have a folder +foo which has |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
624 a single sub-folder qux. Now we create the folder +foo/bar/baz. |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
625 Here we will need to invalidate the cached sub-folders of +foo, |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
626 otherwise completion on +foo won't tell us about the option |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
627 +foo/bar!" |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
628 (remhash folder mh-sub-folders-cache) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
629 (block ancestor-found |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
630 (let ((parent folder) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
631 (one-ancestor-found nil) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
632 last-slash) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
633 (while (setq last-slash (mh-search-from-end ?/ parent)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
634 (setq parent (substring parent 0 last-slash)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
635 (unless (eq (gethash parent mh-sub-folders-cache 'none) 'none) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
636 (remhash parent mh-sub-folders-cache) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
637 (if one-ancestor-found |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
638 (return-from ancestor-found) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
639 (setq one-ancestor-found t)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
640 (remhash nil mh-sub-folders-cache)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
641 |
68465 | 642 |
643 | |
644 ;;; Folder Utilities | |
645 | |
646 ;;;###mh-autoload | |
647 (defun mh-folder-name-p (name) | |
648 "Return non-nil if NAME is the name of a folder. | |
649 A name (a string or symbol) can be a folder name if it begins | |
650 with \"+\"." | |
651 (if (symbolp name) | |
652 (eq (aref (symbol-name name) 0) ?+) | |
653 (and (> (length name) 0) | |
654 (eq (aref name 0) ?+)))) | |
655 | |
656 ;;;###mh-autoload | |
657 (defun mh-expand-file-name (filename &optional default) | |
658 "Expand FILENAME like `expand-file-name', but also handle MH folder names. | |
659 Any filename that starts with '+' is treated as a folder name. | |
660 See `expand-file-name' for description of DEFAULT." | |
661 (if (mh-folder-name-p filename) | |
662 (expand-file-name (substring filename 1) mh-user-path) | |
663 (expand-file-name filename default))) | |
664 | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
665 (defvar mh-folder-hist nil) |
68096
57c4e7929f99
* mh-alias.el (mh-alias-gecos-name): Use replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68013
diff
changeset
|
666 |
57c4e7929f99
* mh-alias.el (mh-alias-gecos-name): Use replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68013
diff
changeset
|
667 ;; Shush compiler. |
70027
0e0916499a15
* mh-funcs.el (view-exit-action): No need to wrap defvar with
Bill Wohler <wohler@newt.com>
parents:
69492
diff
changeset
|
668 (defvar mh-speed-flists-cache) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
669 |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
670 (defvar mh-allow-root-folder-flag nil |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
671 "Non-nil means \"+\" is an acceptable folder name. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
672 This variable is used to communicate with |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
673 `mh-folder-completion-function'. That function can have exactly |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
674 three arguments so we bind this variable to t or nil. |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
675 |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
676 This variable should never be set.") |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
677 |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
678 (defvar mh-folder-completion-map (copy-keymap minibuffer-local-completion-map)) |
67852
5b7ceef33307
(mh-process-daemon): Don't change buffer in proc-filter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67760
diff
changeset
|
679 (define-key mh-folder-completion-map " " 'minibuffer-complete) ;Why??? |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
680 |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
681 (defvar mh-speed-flists-inhibit-flag nil) |
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
682 |
68465 | 683 ;;;###mh-autoload |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
684 (defun mh-speed-flists-active-p () |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
685 "Check if speedbar is running with message counts enabled." |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
686 (and (featurep 'mh-speed) |
56406
d36b00b98db0
Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
687 (not mh-speed-flists-inhibit-flag) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
688 (> (hash-table-count mh-speed-flists-cache) 0))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
689 |
68465 | 690 ;;;###mh-autoload |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
691 (defun mh-folder-completion-function (name predicate flag) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
692 "Programmable completion for folder names. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
693 NAME is the partial folder name that has been input. PREDICATE if |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
694 non-nil is a function that is used to filter the possible |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
695 choices. FLAG is nil to indicate `try-completion', t for |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
696 `all-completions', or the symbol lambda for `test-completion'. |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
697 See Info node `(elisp) Programmed Completion' for details." |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
698 (let* ((orig-name name) |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
699 ;; After normalization, name is nil, +, or +something. If a |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
700 ;; trailing slash is present, it is preserved. |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
701 (name (mh-normalize-folder-name name nil t)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
702 (last-slash (mh-search-from-end ?/ name)) |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
703 ;; nil if + or +folder; +folder/ if slash present. |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
704 (last-complete (if last-slash (substring name 0 (1+ last-slash)) nil)) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
705 ;; Either +folder/remainder, +remainder, or "". |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
706 (remainder (cond (last-complete (substring name (1+ last-slash))) |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
707 (name (substring name 1)) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
708 (t "")))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
709 (cond ((eq flag nil) |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
710 (let ((try-res |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
711 (try-completion |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
712 name |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
713 (mapcar (lambda (x) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
714 (cons (concat (or last-complete "+") (car x)) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
715 (cdr x))) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
716 (mh-sub-folders last-complete t)) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
717 predicate))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
718 (cond ((eq try-res nil) nil) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
719 ((and (eq try-res t) (equal name orig-name)) t) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
720 ((eq try-res t) name) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
721 (t try-res)))) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
722 ((eq flag t) |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
723 (mapcar (lambda (x) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
724 (concat (or last-complete "+") x)) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
725 (all-completions |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
726 remainder (mh-sub-folders last-complete t) predicate))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
727 ((eq flag 'lambda) |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
728 (let ((path (concat (unless (and (> (length name) 1) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
729 (eq (aref name 1) ?/)) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
730 mh-user-path) |
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
731 (substring name 1)))) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
732 (cond (mh-allow-root-folder-flag (file-exists-p path)) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
733 ((equal path mh-user-path) nil) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
734 (t (file-exists-p path)))))))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
735 |
68465 | 736 ;; Shush compiler. |
70028
d81780942bb8
* mh-acros.el (struct, x, y): No need to wrap defvar with
Bill Wohler <wohler@newt.com>
parents:
70027
diff
changeset
|
737 (defvar completion-root-regexp) ; XEmacs |
d81780942bb8
* mh-acros.el (struct, x, y): No need to wrap defvar with
Bill Wohler <wohler@newt.com>
parents:
70027
diff
changeset
|
738 (defvar minibuffer-completing-file-name) ; XEmacs |
68465 | 739 |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
740 (defun mh-folder-completing-read (prompt default allow-root-folder-flag) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
741 "Read folder name with PROMPT and default result DEFAULT. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
742 If ALLOW-ROOT-FOLDER-FLAG is non-nil then \"+\" is allowed to be |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
743 a folder name corresponding to `mh-user-path'." |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
744 (mh-normalize-folder-name |
70059
9028ccec5e38
(mh-sub-folders-actual): Mention that folder must have been processed
Bill Wohler <wohler@newt.com>
parents:
70028
diff
changeset
|
745 (let ((completion-root-regexp "^[+/]") |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
746 (minibuffer-local-completion-map mh-folder-completion-map) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
747 (mh-allow-root-folder-flag allow-root-folder-flag)) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
748 (completing-read prompt 'mh-folder-completion-function nil nil nil |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
749 'mh-folder-hist default)) |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
750 t)) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
751 |
68465 | 752 ;;;###mh-autoload |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
753 (defun mh-prompt-for-folder (prompt default can-create |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
754 &optional default-string allow-root-folder-flag) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
755 "Prompt for a folder name with PROMPT. |
67758
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
756 Returns the folder's name as a string. DEFAULT is used if the |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
757 folder exists and the user types return. If the CAN-CREATE flag |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
758 is t, then a folder is created if it doesn't already exist. If |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
759 optional argument DEFAULT-STRING is non-nil, use it in the prompt |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
760 instead of DEFAULT. If ALLOW-ROOT-FOLDER-FLAG is non-nil then the |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
761 function will accept the folder +, which means all folders when |
6b063593fdad
Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents:
67756
diff
changeset
|
762 used in searching." |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
763 (if (null default) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
764 (setq default "")) |
65681
4312387e37c8
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
64085
diff
changeset
|
765 (let* ((default-string (cond (default-string (format " (default %s)" default-string)) |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
766 ((equal "" default) "") |
65681
4312387e37c8
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
64085
diff
changeset
|
767 (t (format " (default %s)" default)))) |
4312387e37c8
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
64085
diff
changeset
|
768 (prompt (format "%s folder%s: " prompt default-string)) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
769 (mh-current-folder-name mh-current-folder) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
770 read-name folder-name) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
771 (while (and (setq read-name (mh-folder-completing-read |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
772 prompt default allow-root-folder-flag)) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
773 (equal read-name "") |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
774 (equal default ""))) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
775 (cond ((or (equal read-name "") |
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
776 (and (equal read-name "+") (not allow-root-folder-flag))) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
777 (setq read-name default)) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
778 ((not (mh-folder-name-p read-name)) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
779 (setq read-name (format "+%s" read-name)))) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
780 (if (or (not read-name) (equal "" read-name)) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
781 (error "No folder specified")) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
782 (setq folder-name read-name) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
783 (cond ((and (> (length folder-name) 0) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
784 (eq (aref folder-name (1- (length folder-name))) ?/)) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
785 (setq folder-name (substring folder-name 0 -1)))) |
50702
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
786 (let* ((last-slash (mh-search-from-end ?/ folder-name)) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
787 (parent (and last-slash (substring folder-name 0 last-slash))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
788 (child (if last-slash |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
789 (substring folder-name (1+ last-slash)) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
790 (substring folder-name 1)))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
791 (unless (member child |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
792 (mapcar #'car (gethash parent mh-sub-folders-cache))) |
7dd3d5eae9c7
Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
49598
diff
changeset
|
793 (mh-remove-from-sub-folders-cache folder-name))) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
794 (let ((new-file-flag |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
795 (not (file-exists-p (mh-expand-file-name folder-name))))) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
796 (cond ((and new-file-flag |
67857
226904e7d40b
(mh-prompt-for-folder): Use can-create argument to suppress creation
Bill Wohler <wohler@newt.com>
parents:
67852
diff
changeset
|
797 can-create |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
798 (y-or-n-p |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
799 (format "Folder %s does not exist. Create it? " |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
800 folder-name))) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
801 (message "Creating %s" folder-name) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
802 (mh-exec-cmd-error nil "folder" folder-name) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
803 (mh-remove-from-sub-folders-cache folder-name) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
804 (when (boundp 'mh-speed-folder-map) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
805 (mh-speed-add-folder folder-name)) |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
806 (message "Creating %s...done" folder-name)) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
807 (new-file-flag |
67857
226904e7d40b
(mh-prompt-for-folder): Use can-create argument to suppress creation
Bill Wohler <wohler@newt.com>
parents:
67852
diff
changeset
|
808 (error "Folder %s does not exist" folder-name)) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
809 ((not (file-directory-p (mh-expand-file-name folder-name))) |
68013
bbc0e52abce5
* mh-alias.el (mh-alias-add-alias): Grand message and error string
Bill Wohler <wohler@newt.com>
parents:
67988
diff
changeset
|
810 (error "%s is not a directory" |
49578
b35587af8747
Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents:
49459
diff
changeset
|
811 (mh-expand-file-name folder-name))))) |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
812 folder-name)) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
813 |
67681 | 814 |
815 | |
68465 | 816 ;;; Message Utilities |
817 | |
818 ;; Functions that would ordinarily be in mh-letter.el that are needed | |
819 ;; by mh-show.el are found here in order to prevent the loading of | |
820 ;; mh-letter.el until a message is actually composed. | |
821 | |
822 ;;;###mh-autoload | |
823 (defun mh-in-header-p () | |
824 "Return non-nil if the point is in the header of a draft message." | |
825 (< (point) (mh-mail-header-end))) | |
68163
3b7532a82079
* mh-search.el: New file containing contents of mh-index.el and
Bill Wohler <wohler@newt.com>
parents:
68137
diff
changeset
|
826 |
68465 | 827 ;;;###mh-autoload |
828 (defun mh-extract-from-header-value () | |
829 "Extract From: string from header." | |
830 (save-excursion | |
831 (if (not (mh-goto-header-field "From:")) | |
832 nil | |
833 (skip-chars-forward " \t") | |
834 (buffer-substring-no-properties | |
835 (point) (progn (mh-header-field-end)(point)))))) | |
836 | |
837 ;;;###mh-autoload | |
68477
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
838 (defun mh-get-header-field (field) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
839 "Find and return the body of FIELD in the mail header. |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
840 Returns the empty string if the field is not in the header of the |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
841 current buffer." |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
842 (if (mh-goto-header-field field) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
843 (progn |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
844 (skip-chars-forward " \t") ;strip leading white space in body |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
845 (let ((start (point))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
846 (mh-header-field-end) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
847 (buffer-substring-no-properties start (point)))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
848 "")) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
849 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
850 ;;;###mh-autoload |
68465 | 851 (defun mh-goto-header-field (field) |
852 "Move to FIELD in the message header. | |
853 Move to the end of the FIELD name, which should end in a colon. | |
854 Returns t if found, nil if not." | |
855 (goto-char (point-min)) | |
856 (let ((case-fold-search t) | |
857 (headers-end (save-excursion | |
858 (mh-goto-header-end 0) | |
859 (point)))) | |
860 (re-search-forward (format "^%s" field) headers-end t))) | |
861 | |
862 ;;;###mh-autoload | |
863 (defun mh-goto-header-end (arg) | |
864 "Move the cursor ARG lines after the header." | |
865 (if (re-search-forward "^-*$" nil nil) | |
866 (forward-line arg))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
867 |
68465 | 868 ;;;###mh-autoload |
869 (defun mh-mail-header-end () | |
870 "Substitute for `mail-header-end' that doesn't widen the buffer. | |
871 | |
872 In MH-E we frequently need to find the end of headers in nested | |
873 messages, where the buffer has been narrowed. This function works | |
874 in this situation." | |
875 (save-excursion | |
876 ;; XXX: The following replaces a call to rfc822-goto-eoh. Occasionally, | |
877 ;; mail headers that MH-E has to read contains lines of the form: | |
878 ;; From xxx@yyy Mon May 10 11:48:07 2004 | |
879 ;; In this situation, rfc822-goto-eoh doesn't go to the end of the | |
880 ;; header. The replacement allows From_ lines in the mail header. | |
881 (goto-char (point-min)) | |
882 (loop for p = (re-search-forward | |
883 "^\\([:\n]\\|[^: \t\n]+[ \t\n]\\)" nil 'move) | |
884 do (cond ((null p) (return)) | |
885 (t (goto-char (match-beginning 0)) | |
886 (unless (looking-at "From ") (return)) | |
887 (goto-char p)))) | |
888 (point))) | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
889 |
68465 | 890 ;;;###mh-autoload |
891 (defun mh-header-field-beginning () | |
892 "Move to the beginning of the current header field. | |
893 Handles RFC 822 continuation lines." | |
894 (beginning-of-line) | |
895 (while (looking-at "^[ \t]") | |
896 (forward-line -1))) | |
897 | |
898 ;;;###mh-autoload | |
899 (defun mh-header-field-end () | |
900 "Move to the end of the current header field. | |
901 Handles RFC 822 continuation lines." | |
902 (forward-line 1) | |
903 (while (looking-at "^[ \t]") | |
904 (forward-line 1)) | |
905 (backward-char 1)) ;to end of previous line | |
906 | |
907 ;;;###mh-autoload | |
68477
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
908 (defun mh-letter-hide-all-skipped-fields () |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
909 "Hide all skipped fields." |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
910 (save-excursion |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
911 (goto-char (point-min)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
912 (save-restriction |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
913 (narrow-to-region (point) (mh-mail-header-end)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
914 (while (re-search-forward mh-letter-header-field-regexp nil t) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
915 (if (mh-letter-skipped-header-field-p (match-string 1)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
916 (mh-letter-toggle-header-field-display -1) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
917 (mh-letter-toggle-header-field-display 'long)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
918 (beginning-of-line 2))))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
919 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
920 ;;;###mh-autoload |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
921 (defun mh-letter-skipped-header-field-p (field) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
922 "Check if FIELD is to be skipped." |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
923 (let ((field (downcase field))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
924 (loop for x in mh-compose-skipped-header-fields |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
925 when (equal (downcase x) field) return t |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
926 finally return nil))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
927 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
928 (defvar mh-hidden-header-keymap |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
929 (let ((map (make-sparse-keymap))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
930 (mh-do-in-gnu-emacs |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
931 (define-key map [mouse-2] 'mh-letter-toggle-header-field-display-button)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
932 (mh-do-in-xemacs |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
933 (define-key map '(button2) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
934 'mh-letter-toggle-header-field-display-button)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
935 map)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
936 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
937 ;;;###mh-autoload |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
938 (defun mh-letter-toggle-header-field-display (arg) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
939 "Toggle display of header field at point. |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
940 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
941 Use this command to display truncated header fields. This command |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
942 is a toggle so entering it again will hide the field. This |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
943 command takes a prefix argument ARG: if negative then the field |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
944 is hidden, if positive then the field is displayed." |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
945 (interactive (list nil)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
946 (when (and (mh-in-header-p) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
947 (progn |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
948 (end-of-line) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
949 (re-search-backward mh-letter-header-field-regexp nil t))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
950 (let ((buffer-read-only nil) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
951 (modified-flag (buffer-modified-p)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
952 (begin (point)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
953 end) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
954 (end-of-line) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
955 (setq end (1- (if (re-search-forward "^[^ \t]" nil t) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
956 (match-beginning 0) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
957 (point-max)))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
958 (goto-char begin) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
959 ;; Make it clickable... |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
960 (add-text-properties begin end `(keymap ,mh-hidden-header-keymap |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
961 mouse-face highlight)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
962 (unwind-protect |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
963 (cond ((or (and (not arg) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
964 (text-property-any begin end 'invisible 'vanish)) |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
965 (and (numberp arg) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
966 (>= arg 0)) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
967 (and (eq arg 'long) |
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
968 (> (mh-line-beginning-position 5) end))) |
68477
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
969 (remove-text-properties begin end '(invisible nil)) |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68520
diff
changeset
|
970 (search-forward ":" (mh-line-end-position) t) |
68477
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
971 (mh-letter-skip-leading-whitespace-in-header-field)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
972 ;; XXX Redesign to make usable by user. Perhaps use a positive |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
973 ;; numeric prefix to make that many lines visible. |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
974 ((eq arg 'long) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
975 (end-of-line 4) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
976 (mh-letter-truncate-header-field end) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
977 (beginning-of-line)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
978 (t (end-of-line) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
979 (mh-letter-truncate-header-field end) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
980 (beginning-of-line))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
981 (set-buffer-modified-p modified-flag))))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
982 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
983 ;;;###mh-autoload |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
984 (defun mh-letter-skip-leading-whitespace-in-header-field () |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
985 "Skip leading whitespace in a header field. |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
986 If the header field doesn't have at least one space after the |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
987 colon then a space character is added." |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
988 (let ((need-space t)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
989 (while (memq (char-after) '(?\t ?\ )) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
990 (forward-char) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
991 (setq need-space nil)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
992 (when need-space (insert " ")))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
993 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
994 (defun mh-letter-truncate-header-field (end) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
995 "Replace text from current line till END with an ellipsis. |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
996 If the current line is too long truncate a part of it as well." |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
997 (let ((max-len (min (window-width) 62))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
998 (when (> (+ (current-column) 4) max-len) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
999 (backward-char (- (+ (current-column) 5) max-len))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
1000 (when (> end (point)) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
1001 (add-text-properties (point) end '(invisible vanish))))) |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
1002 |
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68465
diff
changeset
|
1003 ;;;###mh-autoload |
68465 | 1004 (defun mh-signature-separator-p () |
1005 "Return non-nil if buffer includes \"^-- $\"." | |
1006 (save-excursion | |
1007 (goto-char (point-min)) | |
1008 (re-search-forward mh-signature-separator-regexp nil t))) | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
56406
diff
changeset
|
1009 |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
1010 (provide 'mh-utils) |
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
1011 |
67681 | 1012 ;; Local Variables: |
1013 ;; indent-tabs-mode: nil | |
1014 ;; sentence-end-double-space: nil | |
1015 ;; End: | |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
1016 |
67681 | 1017 ;; arch-tag: 1af39fdf-f66f-4b06-9b48-18a7656c8e36 |
49459
06b77df47802
* mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff
changeset
|
1018 ;;; mh-utils.el ends here |