aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1999-03-01 03:45:51 +0000
committerKarl Heuer1999-03-01 03:45:51 +0000
commitae3864d7a3f76b798859735b36e346af79eff570 (patch)
tree5e2635dfc8b8f074221abfbc2694f3b1bbefb667
parentcc039f78e544719115e277364378c217156c958f (diff)
downloademacs-ae3864d7a3f76b798859735b36e346af79eff570.tar.gz
emacs-ae3864d7a3f76b798859735b36e346af79eff570.zip
(mh-lib): Doc fix.
(mh-lib-progs, mh-nmh-p): New vars. (mh-find-progs): Set mh-lib-progs along with other vars. (mh-path-search): New arg FUNC-P; if specified, use that instead of mh-file-command-p. (mh-install, mh-exec-lib-cmd-output): Use mh-lib-progs.
-rw-r--r--lisp/mail/mh-utils.el90
1 files changed, 59 insertions, 31 deletions
diff --git a/lisp/mail/mh-utils.el b/lisp/mail/mh-utils.el
index 3e008d5d8db..8ef8bbf4ecf 100644
--- a/lisp/mail/mh-utils.el
+++ b/lisp/mail/mh-utils.el
@@ -38,12 +38,24 @@
38(defvar mh-lib nil 38(defvar mh-lib nil
39 "Directory containing the MH library. 39 "Directory containing the MH library.
40This directory contains, among other things, 40This directory contains, among other things,
41the mhl program and the components file.") 41the components file.")
42
43(defvar mh-lib-progs nil
44 "Directory containing MH helper programs.
45This directory contains, among other things,
46the mhl program.")
47
48(defvar mh-nmh-p nil
49 "Non-nil if nmh is installed on this system instead of MH")
42 50
43;;;###autoload 51;;;###autoload
44(put 'mh-progs 'risky-local-variable t) 52(put 'mh-progs 'risky-local-variable t)
45;;;###autoload 53;;;###autoload
46(put 'mh-lib 'risky-local-variable t) 54(put 'mh-lib 'risky-local-variable t)
55;;;###autoload
56(put 'mh-lib-progs 'risky-local-variable t)
57;;;###autoload
58(put 'mh-nmh-p 'risky-local-variable t)
47 59
48;;; User preferences: 60;;; User preferences:
49 61
@@ -532,7 +544,7 @@ Non-nil third argument means not to show the message."
532(defvar mail-user-agent 'mh-e-user-agent) ;from reporter.el 3.2 544(defvar mail-user-agent 'mh-e-user-agent) ;from reporter.el 3.2
533 545
534(defun mh-find-path () 546(defun mh-find-path ()
535 ;; Set mh-progs and mh-lib. 547 ;; Set mh-progs, mh-lib, and mh-libs-progs
536 ;; (This step is necessary if MH was installed after this Emacs was dumped.) 548 ;; (This step is necessary if MH was installed after this Emacs was dumped.)
537 ;; From profile file, set mh-user-path, mh-draft-folder, 549 ;; From profile file, set mh-user-path, mh-draft-folder,
538 ;; mh-unseen-seq, mh-previous-seq, mh-inbox. 550 ;; mh-unseen-seq, mh-previous-seq, mh-inbox.
@@ -587,7 +599,8 @@ Non-nil third argument means not to show the message."
587 599
588(defun mh-find-progs () 600(defun mh-find-progs ()
589 "Find the `inc' and `mhl' programs of MH. 601 "Find the `inc' and `mhl' programs of MH.
590Set the `mh-progs' and `mh-lib' variables to the file names." 602Set the `mh-progs' and `mh-lib', and `mh-lib-progs' variables to the
603directory names."
591 (or (and mh-progs (mh-file-command-p (expand-file-name "inc" mh-progs))) 604 (or (and mh-progs (mh-file-command-p (expand-file-name "inc" mh-progs)))
592 (setq mh-progs 605 (setq mh-progs
593 (or (mh-path-search exec-path "inc") 606 (or (mh-path-search exec-path "inc")
@@ -596,38 +609,53 @@ Set the `mh-progs' and `mh-lib' variables to the file names."
596 "/usr/bin/mh/" ;Ultrix 4.2 609 "/usr/bin/mh/" ;Ultrix 4.2
597 "/usr/new/mh/" ;Ultrix <4.2 610 "/usr/new/mh/" ;Ultrix <4.2
598 "/usr/contrib/mh/bin/" ;BSDI 611 "/usr/contrib/mh/bin/" ;BSDI
612 "/usr/pkg/bin/" ; NetBSD
599 "/usr/local/bin/" 613 "/usr/local/bin/"
600 ) 614 )
601 "inc")))) 615 "inc"))))
602 616 (or (null mh-progs)
603 (or (and mh-lib (mh-file-command-p (expand-file-name "mhl" mh-lib))) 617 (let ((mh-base mh-progs))
604 (null mh-progs) 618 (while (let ((dir-name (file-name-nondirectory
605 (setq mh-lib 619 (directory-file-name mh-base))))
606 ;; Look for a lib directory roughly parallel to the bin 620 (or (string= "mh" dir-name)
607 ;; directory: Strip any trailing `mh' or `bin' path 621 (string= "bin" dir-name)))
608 ;; components, then look for lib/mh or mh/lib. 622 (setq mh-base
609 (or (let ((mh-base mh-progs)) 623 (file-name-directory (directory-file-name mh-base))))
610 (while (let ((dir-name (file-name-nondirectory 624 (or (and mh-lib
611 (directory-file-name mh-base)))) 625 (file-exists-p (expand-file-name "components" mh-lib)))
612 (or (string= "mh" dir-name) 626 (setq mh-lib
613 (string= "bin" dir-name))) 627 ;; Look for a lib directory roughly parallel to the bin
614 (setq mh-base 628 ;; directory: Strip any trailing `mh' or `bin' path
615 (file-name-directory (directory-file-name mh-base)))) 629 ;; components, then look for lib/mh or mh/lib.
616 (mh-path-search 630 (or (mh-path-search
617 (list (expand-file-name "lib/mh/" mh-base) 631 (list (expand-file-name "lib/mh" mh-base)
618 (expand-file-name "mh/lib/" mh-base)) 632 (expand-file-name "etc/nmh" mh-base) ; NetBSD
619 "mhl")) 633 (expand-file-name "mh/lib" mh-base))
620 (mh-path-search '("/usr/local/bin/mh/") "mhl") 634 "components"
621 (mh-path-search exec-path "mhl") ;unlikely 635 'file-exists-p))))
622 ))) 636 (or (and mh-lib-progs
623 (unless (and mh-progs mh-lib) 637 (mh-file-command-p (expand-file-name "mhl" mh-lib-progs)))
624 (error "Cannot find the commands `inc' and `mhl'"))) 638 (setq mh-lib-progs
625 639 (or (mh-path-search
626(defun mh-path-search (path file) 640 (list (expand-file-name "lib/mh" mh-base)
641 (expand-file-name "libexec/nmh" mh-base) ; NetBSD
642 (expand-file-name "mh/lib" mh-base))
643 "mhl")
644 (mh-path-search '("/usr/local/bin/mh/") "mhl")
645 (mh-path-search exec-path "mhl") ;unlikely
646 )))))
647 (unless (and mh-progs mh-lib mh-lib-progs)
648 (error "Cannot find the commands `inc' and `mhl' and the file `components'"))
649 (setq mh-nmh-p (not (null
650 (or (string-match "nmh" mh-lib-progs)
651 (string-match "nmh" mh-lib))))))
652
653(defun mh-path-search (path file &optional func-p)
627 ;; Search PATH, a list of directory names, for FILE. 654 ;; Search PATH, a list of directory names, for FILE.
628 ;; Returns the element of PATH that contains FILE, or nil if not found. 655 ;; Returns the element of PATH that contains FILE, or nil if not found.
629 (while (and path 656 (while (and path
630 (not (mh-file-command-p (expand-file-name file (car path))))) 657 (not (funcall (or func-p 'mh-file-command-p)
658 (expand-file-name file (car path)))))
631 (setq path (cdr path))) 659 (setq path (cdr path)))
632 (car path)) 660 (car path))
633 661
@@ -646,7 +674,7 @@ Set the `mh-progs' and `mh-lib' variables to the file names."
646 ;; mh-exec-cmd will display to the user. 674 ;; mh-exec-cmd will display to the user.
647 ;; The MH 5 version of install-mh might try prompt the user 675 ;; The MH 5 version of install-mh might try prompt the user
648 ;; for information, which would fail here. 676 ;; for information, which would fail here.
649 (mh-exec-cmd (expand-file-name "install-mh" mh-lib) "-auto") 677 (mh-exec-cmd (expand-file-name "install-mh" mh-lib-progs) "-auto")
650 ;; now try again to read the profile file 678 ;; now try again to read the profile file
651 (erase-buffer) 679 (erase-buffer)
652 (condition-case err 680 (condition-case err
@@ -918,7 +946,7 @@ Set the `mh-progs' and `mh-lib' variables to the file names."
918(defun mh-exec-lib-cmd-output (command &rest args) 946(defun mh-exec-lib-cmd-output (command &rest args)
919 ;; Execute MH library command COMMAND with ARGS. 947 ;; Execute MH library command COMMAND with ARGS.
920 ;; Put the output into buffer after point. Set mark after inserted text. 948 ;; Put the output into buffer after point. Set mark after inserted text.
921 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib) nil args)) 949 (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args))
922 950
923 951
924(defun mh-handle-process-error (command status) 952(defun mh-handle-process-error (command status)