summaryrefslogtreecommitdiff
path: root/editors/emacs/patches/patch-bb
blob: b244f19e626b33ecf76c4cb27c34963453d38685 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
$NetBSD: patch-bb,v 1.1 1999/02/25 17:08:34 sommerfe Exp $

--- mh-utils.el.~1~	Thu Feb 25 01:31:26 1999
+++ mh-utils.el	Thu Feb 25 11:21:45 1999
@@ -38,12 +38,24 @@
 (defvar mh-lib nil
   "Directory containing the MH library.
 This directory contains, among other things,
-the mhl program and the components file.")
+the components file.")
+
+(defvar mh-lib-progs nil
+  "Directory containing MH helper programs.
+This directory contains, among other things, 
+the mhl program.")
+
+(defvar mh-nmh-p nil
+  "Non-nil if nmh is installed on this system instead of MH")
 
 ;;;###autoload
 (put 'mh-progs 'risky-local-variable t)
 ;;;###autoload
 (put 'mh-lib 'risky-local-variable t)
+;;;###autoload
+(put 'mh-lib-progs 'risky-local-variable t)
+;;;###autoload
+(put 'mh-nmh-p 'risky-local-variable t)
 
 ;;; User preferences:
 
@@ -532,7 +544,7 @@
 (defvar mail-user-agent 'mh-e-user-agent) ;from reporter.el 3.2
 
 (defun mh-find-path ()
-  ;; Set mh-progs and mh-lib.
+  ;; Set mh-progs, mh-lib, and mh-libs-progs
   ;; (This step is necessary if MH was installed after this Emacs was dumped.)
   ;; From profile file, set mh-user-path, mh-draft-folder,
   ;; mh-unseen-seq, mh-previous-seq, mh-inbox.
@@ -587,7 +599,8 @@
 
 (defun mh-find-progs ()
   "Find the `inc' and `mhl' programs of MH.
-Set the `mh-progs' and `mh-lib' variables to the file names."
+Set the `mh-progs' and `mh-lib', and `mh-lib-progs' variables to the
+directory names."
   (or (and mh-progs (mh-file-command-p (expand-file-name "inc" mh-progs)))
       (setq mh-progs
 	    (or (mh-path-search exec-path "inc")
@@ -596,38 +609,53 @@
 				  "/usr/bin/mh/" ;Ultrix 4.2
 				  "/usr/new/mh/" ;Ultrix <4.2
 				  "/usr/contrib/mh/bin/" ;BSDI
+				  "/usr/pkg/bin/"	; NetBSD
 				  "/usr/local/bin/"
 				  )
 				"inc"))))
+  (or (null mh-progs)
+      (let ((mh-base mh-progs))
+	(while (let ((dir-name (file-name-nondirectory
+				(directory-file-name mh-base))))
+		 (or (string= "mh" dir-name)
+		     (string= "bin" dir-name)))
+	  (setq mh-base
+		(file-name-directory (directory-file-name mh-base))))
+	(or (and mh-lib 
+		 (file-exists-p (expand-file-name "components" mh-lib)))
+	    (setq mh-lib
+		  ;; Look for a lib directory roughly parallel to the bin
+		  ;; directory:  Strip any trailing `mh' or `bin' path
+		  ;; components, then look for lib/mh or mh/lib.
+		  (or (mh-path-search
+		       (list (expand-file-name "lib/mh" mh-base)
+			     (expand-file-name "etc/nmh" mh-base) ; NetBSD
+			     (expand-file-name "mh/lib" mh-base))
+		       "components"
+		       'file-exists-p))))
+	(or (and mh-lib-progs
+		 (mh-file-command-p (expand-file-name "mhl" mh-lib-progs)))
+	    (setq mh-lib-progs
+		  (or (mh-path-search
+		       (list (expand-file-name "lib/mh" mh-base)
+			     (expand-file-name "libexec/nmh" mh-base) ; NetBSD
+			     (expand-file-name "mh/lib" mh-base))
+		       "mhl")
+		      (mh-path-search '("/usr/local/bin/mh/") "mhl")
+		      (mh-path-search exec-path "mhl") ;unlikely
+		      )))))
+  (unless (and mh-progs mh-lib mh-lib-progs)
+    (error "Cannot find the commands `inc' and `mhl' and the file `components'"))
+  (setq mh-nmh-p (not (null
+		       (or (string-match "nmh" mh-lib-progs)
+			   (string-match "nmh" mh-lib))))))
 
-  (or (and mh-lib (mh-file-command-p (expand-file-name "mhl" mh-lib)))
-      (null mh-progs)
-      (setq mh-lib
-	    ;; Look for a lib directory roughly parallel to the bin
-	    ;; directory:  Strip any trailing `mh' or `bin' path
-	    ;; components, then look for lib/mh or mh/lib.
-	    (or (let ((mh-base mh-progs))
-		  (while (let ((dir-name (file-name-nondirectory
-					  (directory-file-name mh-base))))
-			   (or (string= "mh" dir-name)
-			       (string= "bin" dir-name)))
-		    (setq mh-base
-			  (file-name-directory (directory-file-name mh-base))))
-		  (mh-path-search
-		   (list (expand-file-name "lib/mh/" mh-base)
-			 (expand-file-name "mh/lib/" mh-base))
-		   "mhl"))
-		(mh-path-search '("/usr/local/bin/mh/") "mhl")
-		(mh-path-search exec-path "mhl") ;unlikely
-		)))
-  (unless (and mh-progs mh-lib)
-    (error "Cannot find the commands `inc' and `mhl'")))
-
-(defun mh-path-search (path file)
+(defun mh-path-search (path file &optional func-p)
   ;; Search PATH, a list of directory names, for FILE.
   ;; Returns the element of PATH that contains FILE, or nil if not found.
   (while (and path
-	      (not (mh-file-command-p (expand-file-name file (car path)))))
+	      (not (funcall (or func-p 'mh-file-command-p)
+			    (expand-file-name file (car path)))))
     (setq path (cdr path)))
   (car path))
 
@@ -646,7 +674,7 @@
   ;; mh-exec-cmd will display to the user.
   ;; The MH 5 version of install-mh might try prompt the user
   ;; for information, which would fail here.
-  (mh-exec-cmd (expand-file-name "install-mh" mh-lib) "-auto")
+  (mh-exec-cmd (expand-file-name "install-mh" mh-lib-progs) "-auto")
   ;; now try again to read the profile file
   (erase-buffer)
   (condition-case err
@@ -918,7 +946,7 @@
 (defun mh-exec-lib-cmd-output (command &rest args)
   ;; Execute MH library command COMMAND with ARGS.
   ;; Put the output into buffer after point.  Set mark after inserted text.
-  (apply 'mh-exec-cmd-output (expand-file-name command mh-lib) nil args))
+  (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args))
 
 
 (defun mh-handle-process-error (command status)