Mercurial > emacs
comparison lisp/mail/mh-utils.el @ 17893:ad5fda4d4c36
(mh-file-command-p): New function.
(mh-path-search): Use that.
(mh-find-progs): Don't check current directory
unless explicitly requested. Don't set mh-progs or mh-lib
if the programs are not found. Give an error message
unless they are found.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 20 May 1997 05:26:22 +0000 |
parents | 5c5fa38a1c79 |
children | 438ea21518f7 |
comparison
equal
deleted
inserted
replaced
17892:b3514551f08d | 17893:ad5fda4d4c36 |
---|---|
574 (if mh-previous-seq | 574 (if mh-previous-seq |
575 (setq mh-previous-seq (intern mh-previous-seq))) | 575 (setq mh-previous-seq (intern mh-previous-seq))) |
576 (setq mail-user-agent 'mh-e-user-agent) | 576 (setq mail-user-agent 'mh-e-user-agent) |
577 (run-hooks 'mh-find-path-hook)))) | 577 (run-hooks 'mh-find-path-hook)))) |
578 | 578 |
579 (defun mh-file-command-p (file) | |
580 "Return t if file FILE is the name of a executable regular file." | |
581 (and (file-regular-p file) (file-executable-p file))) | |
582 | |
579 (defun mh-find-progs () | 583 (defun mh-find-progs () |
580 (or (file-exists-p (expand-file-name "inc" mh-progs)) | 584 "Find the `inc' and `mhl' programs of MH. |
585 Set the `mh-progs' and `mh-lib' variables to the file names." | |
586 (or (and mh-progs (mh-file-command-p (expand-file-name "inc" mh-progs))) | |
581 (setq mh-progs | 587 (setq mh-progs |
582 (or (mh-path-search exec-path "inc") | 588 (or (mh-path-search exec-path "inc") |
583 (mh-path-search '("/usr/local/bin/mh/" | 589 (mh-path-search '("/usr/local/bin/mh/" |
584 "/usr/local/mh/" | 590 "/usr/local/mh/" |
585 "/usr/bin/mh/" ;Ultrix 4.2 | 591 "/usr/bin/mh/" ;Ultrix 4.2 |
586 "/usr/new/mh/" ;Ultrix <4.2 | 592 "/usr/new/mh/" ;Ultrix <4.2 |
587 "/usr/contrib/mh/bin/" ;BSDI | 593 "/usr/contrib/mh/bin/" ;BSDI |
588 "/usr/local/bin/" | 594 "/usr/local/bin/" |
589 ) | 595 ) |
590 "inc") | 596 "inc")))) |
591 mh-progs | 597 (or (and mh-lib (mh-file-command-p (expand-file-name "mhl" mh-lib))) |
592 "/usr/local/bin/"))) | |
593 (or (file-exists-p (expand-file-name "mhl" mh-lib)) | |
594 (setq mh-lib | 598 (setq mh-lib |
595 ;; Look for a lib directory roughly parallel to the bin | 599 ;; Look for a lib directory roughly parallel to the bin |
596 ;; directory: Strip any trailing `mh' or `bin' path | 600 ;; directory: Strip any trailing `mh' or `bin' path |
597 ;; components, then look for lib/mh or mh/lib. | 601 ;; components, then look for lib/mh or mh/lib. |
598 (or (let ((mh-base mh-progs)) | 602 (or (let ((mh-base mh-progs)) |
606 (list (expand-file-name "lib/mh/" mh-base) | 610 (list (expand-file-name "lib/mh/" mh-base) |
607 (expand-file-name "mh/lib/" mh-base)) | 611 (expand-file-name "mh/lib/" mh-base)) |
608 "mhl")) | 612 "mhl")) |
609 (mh-path-search '("/usr/local/bin/mh/") "mhl") | 613 (mh-path-search '("/usr/local/bin/mh/") "mhl") |
610 (mh-path-search exec-path "mhl") ;unlikely | 614 (mh-path-search exec-path "mhl") ;unlikely |
611 mh-lib | 615 ))) |
612 "/usr/local/lib/mh/")))) | 616 (unless (and mh-progs mh-lib) |
617 (error "Cannot find the commands `inc' and `mhl'"))) | |
613 | 618 |
614 (defun mh-path-search (path file) | 619 (defun mh-path-search (path file) |
615 ;; Search PATH, a list of directory names, for FILE. | 620 ;; Search PATH, a list of directory names, for FILE. |
616 ;; Returns the element of PATH that contains FILE, or nil if not found. | 621 ;; Returns the element of PATH that contains FILE, or nil if not found. |
617 (while (and path | 622 (while (and path |
618 (not (file-exists-p (expand-file-name file (car path))))) | 623 (not (mh-file-command-p (expand-file-name file (car path))))) |
619 (setq path (cdr path))) | 624 (setq path (cdr path))) |
620 (car path)) | 625 (car path)) |
621 | 626 |
622 (defvar mh-no-install nil) ;do not run install-mh | 627 (defvar mh-no-install nil) ;do not run install-mh |
623 | 628 |