From xemacs-m  Fri Aug  8 02:45:45 1997
Received: from bittersweet.inetarena.com (karlheg@bittersweet.inetarena.com [206.129.216.38])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id CAA05888
	for <xemacs-beta@xemacs.org>; Fri, 8 Aug 1997 02:45:43 -0500 (CDT)
Received: (from karlheg@localhost)
	by bittersweet.inetarena.com (8.8.6/8.8.6/Debian/GNU) id AAA20815;
	Fri, 8 Aug 1997 00:45:57 -0700
To: XEmacs Beta <xemacs-beta@xemacs.org>
Subject: [patch] `info.el': proper support for "localdir" files.
X-Face: /Q}=yl}1_v7nP)xXo5XjG8+tl@=uVu7o5u6)f]zN?+<hB!K.m9:[|*p34jVN`O;:XZXVSy>/\R>qDt(t8w!-i{(y0"`jFw^uk8inzO9wXabd'CdjUWfC\GHi:6nO*YC89#-qD>Q4r%9!V"<RYJ=7D#$";q=zML5'!=wvXk^$`6FT=5CMofQX)WUKt0p:OKl.mFOXx/D
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: multipart/mixed;
 boundary="Multipart_Fri_Aug__8_00:45:53_1997-1"
Content-Transfer-Encoding: 7bit
From: karlheg+xemacs@inetarena.com (Karl M. Hegbloom)
Date: 08 Aug 1997 00:45:53 -0700
Message-ID: <873eolkthq.fsf@bittersweet.inetarena.com>
Lines: 132
X-Mailer: Gnus v5.4.64/XEmacs 20.3(beta16) - "Budapest"

--Multipart_Fri_Aug__8_00:45:53_1997-1
Content-Type: text/plain; charset=US-ASCII

 Thanks, Adrian.  Here's a patch that makes it do what I think it
should do.  Steven, is this what you had in mind for this, so far?


In your main "dir" file, you can have either the line:

* Locals:

... or, a line like:

Locals

... and it will insert the localdir file there.  The second form will
remain in the Info directory listing as a section heading, the first
will be removed and replaced by the contents of the "localdir" file as
before.

 I will be posting to the discuss list also; I want to ask a few
questions about info files and stuff.


1997-08-08  Karl M. Hegbloom  <karlheg@inetarena.com>

	* packages/info.el: (Manual-insert-dir) fixed support for
 	"localdir" files.


--Multipart_Fri_Aug__8_00:45:53_1997-1
Content-Type: text/plain; charset=US-ASCII

Index: lisp/packages/info.el
===================================================================
RCS file: /usr/local/cvsroot/xemacs-20/lisp/packages/info.el,v
retrieving revision 1.1.1.2.2.5
diff -u -r1.1.1.2.2.5 info.el
--- info.el	1997/08/07 09:10:16	1.1.1.2.2.5
+++ info.el	1997/08/08 07:34:38
@@ -773,6 +773,8 @@
 		      (or buffers
 			  (message "Composing main Info directory..."))
 		      (set-buffer (generate-new-buffer "info dir"))
+		      (when (string-match "localdir" file)
+			(insert "localdir\n"))
 		      (insert-file-contents file)
 		      (setq buffers (cons (current-buffer) buffers)
 			    Info-dir-file-attributes
@@ -796,24 +798,52 @@
 
       ;; Look at each of the other buffers one by one.
       (while others
-	(let ((other (car others)))
-	  ;; In each, find all the menus.
-	  (save-excursion
-	    (set-buffer other)
-	    (goto-char (point-min))
-	    ;; Find each menu, and add an elt to NODES for it.
-	    (while (re-search-forward "^\\* Menu:" nil t)
-	      (let (beg nodename end)
-		(forward-line 1)
-		(setq beg (point))
-		(search-backward "\n\^_")
-		(search-forward "Node: ")
-		(setq nodename (Info-following-node-name))
-		(search-forward "\n\^_" nil 'move)
-		(beginning-of-line)
-		(setq end (point))
-		(setq nodes (cons (list nodename other beg end) nodes))))))
-	(setq others (cdr others)))
+	(let ((other (car others))
+	      (info-buffer (current-buffer)))
+	  (if (with-current-buffer other
+		(goto-char (point-min))
+		(when (looking-at "localdir")
+		  (forward-line 1)
+		  (delete-region (point-min) (point))
+		  t))		
+	      (save-excursion
+		(set-buffer info-buffer)
+		(goto-char (point-max))
+		(cond
+		 ((re-search-backward "^ *\\* *Locals *: *\n" nil t)
+		  (delete-region (match-beginning 0) (match-end 0)))
+		 ((re-search-backward "^Local" nil t)
+		  (end-of-line))
+		 (t (search-backward "\^L" nil t)))
+		;; Insert menu part of the file
+		(let* ((pt (point))
+		       (len (length (buffer-string nil nil other))))
+		  (insert "\n" (buffer-string nil nil other))
+		  (goto-char (+ pt len))
+		  (save-excursion
+		    (goto-char pt)
+		    (if (search-forward "* menu:" (+ pt len) t)
+			(progn
+			  (forward-line 1)
+			  (delete-region pt (point)))))))
+	    ;; In each, find all the menus.
+	    (save-excursion
+	      (set-buffer other)
+	      (goto-char (point-min))
+	      ;; Find each menu, and add an elt to NODES for it.
+	      (while (re-search-forward "^\\* Menu:" nil t)
+		(let (beg nodename end)
+		  (forward-line 1)
+		  (setq beg (point))
+		  (search-backward "\n\^_")
+		  (search-forward "Node: ")
+		  (setq nodename (Info-following-node-name))
+		  (search-forward "\n\^_" nil 'move)
+		  (beginning-of-line)
+		  (setq end (point))
+		  (setq nodes (cons (list nodename other beg end) nodes))))))
+	  (setq others (cdr others))))
+      
       ;; Add to the main menu a menu item for each other node.
       (re-search-forward "^\\* Menu:")
       (forward-line 1)


--Multipart_Fri_Aug__8_00:45:53_1997-1
Content-Type: text/plain; charset=US-ASCII

mailto:karlheg+sig@inetarena.com (Karl M. Hegbloom)
http://www.inetarena.com/~karlheg
Portland, OR  USA
Debian GNU 1.3  Linux 2.0.30+parport AMD K5 PR-133


--Multipart_Fri_Aug__8_00:45:53_1997-1--

