comparison lisp/mh-e/mh-init.el @ 67758:6b063593fdad

Follow Emacs coding conventions. Use default setting of emacs-lisp-docstring-fill-column which is 65.
author Bill Wohler <wohler@newt.com>
date Fri, 23 Dec 2005 07:40:40 +0000
parents 3a8785724cca
children 9c3504ae6060
comparison
equal deleted inserted replaced
67757:488b4dbc7482 67758:6b063593fdad
79 79
80 ;;;###mh-autoload 80 ;;;###mh-autoload
81 (defun mh-variants () 81 (defun mh-variants ()
82 "Return a list of installed variants of MH on the system. 82 "Return a list of installed variants of MH on the system.
83 This function looks for MH in `mh-sys-path', `mh-path' and 83 This function looks for MH in `mh-sys-path', `mh-path' and
84 `exec-path'. The format of the list of variants that is returned is described 84 `exec-path'. The format of the list of variants that is returned
85 by the variable `mh-variants'." 85 is described by the variable `mh-variants'."
86 (if mh-variants 86 (if mh-variants
87 mh-variants 87 mh-variants
88 (let ((list-unique)) 88 (let ((list-unique))
89 ;; Make a unique list of directories, keeping the given order. 89 ;; Make a unique list of directories, keeping the given order.
90 ;; We don't want the same MH variant to be listed multiple times. 90 ;; We don't want the same MH variant to be listed multiple times.
98 (add-to-list 'mh-variants variant))))) 98 (add-to-list 'mh-variants variant)))))
99 mh-variants))) 99 mh-variants)))
100 100
101 (defvar mh-variant-in-use nil 101 (defvar mh-variant-in-use nil
102 "The MH variant currently in use; a string with variant and version number. 102 "The MH variant currently in use; a string with variant and version number.
103 This differs from `mh-variant' when the latter is set to `autodetect'.") 103 This differs from `mh-variant' when the latter is set to
104 `autodetect'.")
104 105
105 ;;;###mh-autoload 106 ;;;###mh-autoload
106 (defun mh-variant-set (variant) 107 (defun mh-variant-set (variant)
107 "Set the MH variant to VARIANT. 108 "Set the MH variant to VARIANT.
108 Sets `mh-progs', `mh-lib', `mh-lib-progs' and `mh-flists-present-flag'. 109 Sets `mh-progs', `mh-lib', `mh-lib-progs' and
109 If the VARIANT is `autodetect', then first try nmh, then MH and finally 110 `mh-flists-present-flag'.
110 GNU mailutils." 111 If the VARIANT is `autodetect', then first try nmh, then MH and
112 finally GNU mailutils."
111 (interactive 113 (interactive
112 (list (completing-read 114 (list (completing-read
113 "MH Variant: " 115 "MH Variant: "
114 (mapcar (lambda (x) (list (car x))) (mh-variants)) 116 (mapcar (lambda (x) (list (car x))) (mh-variants))
115 nil t))) 117 nil t)))
136 mh-variants " or ")))))) 138 mh-variants " or "))))))
137 139
138 (defun mh-variant-set-variant (variant) 140 (defun mh-variant-set-variant (variant)
139 "Setup the system variables for the MH variant named VARIANT. 141 "Setup the system variables for the MH variant named VARIANT.
140 If VARIANT is a string, use that key in the variable `mh-variants'. 142 If VARIANT is a string, use that key in the variable `mh-variants'.
141 If VARIANT is a symbol, select the first entry that matches that variant." 143 If VARIANT is a symbol, select the first entry that matches that
144 variant."
142 (cond 145 (cond
143 ((stringp variant) ;e.g. "nmh 1.1-RC1" 146 ((stringp variant) ;e.g. "nmh 1.1-RC1"
144 (when (assoc variant mh-variants) 147 (when (assoc variant mh-variants)
145 (let* ((alist (cdr (assoc variant mh-variants))) 148 (let* ((alist (cdr (assoc variant mh-variants)))
146 (lib-progs (cadr (assoc 'mh-lib-progs alist))) 149 (lib-progs (cadr (assoc 'mh-lib-progs alist)))
191 "/usr/local/bin/" 194 "/usr/local/bin/"
192 "/usr/local/bin/mu-mh/" ; GNU mailutils - default 195 "/usr/local/bin/mu-mh/" ; GNU mailutils - default
193 "/usr/bin/mu-mh/") ; GNU mailutils - packaged 196 "/usr/bin/mu-mh/") ; GNU mailutils - packaged
194 "List of directories to search for variants of the MH variant. 197 "List of directories to search for variants of the MH variant.
195 The list `exec-path' is searched in addition to this list. 198 The list `exec-path' is searched in addition to this list.
196 There's no need for users to modify this list. Instead add extra 199 There's no need for users to modify this list. Instead add extra
197 directories to the customizable variable `mh-path'.") 200 directories to the customizable variable `mh-path'.")
198 201
199 (defun mh-variant-mh-info (dir) 202 (defun mh-variant-mh-info (dir)
200 "Return info for MH variant in DIR assuming a temporary buffer is setup." 203 "Return info for MH variant in DIR assuming a temporary buffer is setup."
201 ;; MH does not have the -version option. 204 ;; MH does not have the -version option.
300 (defvar mh-image-load-path-called-flag nil) 303 (defvar mh-image-load-path-called-flag nil)
301 304
302 ;;;###mh-autoload 305 ;;;###mh-autoload
303 (defun mh-image-load-path () 306 (defun mh-image-load-path ()
304 "Ensure that the MH-E images are accessible by `find-image'. 307 "Ensure that the MH-E images are accessible by `find-image'.
305 Images for MH-E are found in ../../etc/images relative to the files in 308 Images for MH-E are found in ../../etc/images relative to the
306 `lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images 309 files in `lisp/mh-e'. If `image-load-path' exists (since Emacs
307 directory is added to it if isn't already there. Otherwise, the images 310 22), then the images directory is added to it if isn't already
308 directory is added to the `load-path' if it isn't already there." 311 there. Otherwise, the images directory is added to the
312 `load-path' if it isn't already there."
309 (unless mh-image-load-path-called-flag 313 (unless mh-image-load-path-called-flag
310 (let (mh-library-name mh-image-load-path) 314 (let (mh-library-name mh-image-load-path)
311 ;; First, find mh-e in the load-path. 315 ;; First, find mh-e in the load-path.
312 (setq mh-library-name (locate-library "mh-e")) 316 (setq mh-library-name (locate-library "mh-e"))
313 (if (not mh-library-name) 317 (if (not mh-library-name)
330 334
331 (defun mh-defface-compat (spec) 335 (defun mh-defface-compat (spec)
332 "Convert SPEC for defface if necessary to run on older platforms. 336 "Convert SPEC for defface if necessary to run on older platforms.
333 See `defface' for the spec definition. 337 See `defface' for the spec definition.
334 338
335 When `mh-min-colors-defined-flag' is nil, this function finds a display with a 339 When `mh-min-colors-defined-flag' is nil, this function finds a
336 single \"class\" requirement with a \"color\" item, renames the requirement to 340 display with a single \"class\" requirement with a \"color\"
337 \"tty\" and moves it to the beginning of the list. It then strips any 341 item, renames the requirement to \"tty\" and moves it to the
338 \"min-colors\" requirements." 342 beginning of the list. It then strips any \"min-colors\"
343 requirements."
339 (when (not mh-min-colors-defined-flag) 344 (when (not mh-min-colors-defined-flag)
340 ;; Insert ((class tty)) display with ((class color)) attributes. 345 ;; Insert ((class tty)) display with ((class color)) attributes.
341 (let ((attributes (cdr (assoc '((class color)) spec)))) 346 (let ((attributes (cdr (assoc '((class color)) spec))))
342 (cons (cons '((class tty)) attributes) spec)) 347 (cons (cons '((class tty)) attributes) spec))
343 ;; Delete ((class color)) display. 348 ;; Delete ((class color)) display.