delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/01/08:16:34

Date: Thu, 1 Mar 2001 15:10:42 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Cesar Rabak <csrabak AT uol DOT com DOT br>
cc: djgpp AT delorie DOT com
Subject: Re: gzipped info files in Emacs 20.5
In-Reply-To: <3A9C37EC.CAFC3591@uol.com.br>
Message-ID: <Pine.SUN.3.91.1010301150422.6488C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 27 Feb 2001, Cesar Rabak wrote:

> Supposing you already have all info files gzipped:
> 
> 1) emacs -q
> 2) in emacs C-h i (brings Info buffer)
> 3) m gcc*
> 
> The following message can be read in the echo line:
> 
> "No such anchor in tag table or node in tag table or file: Top"

You didn't say, but I'm guessing this was on Windows, right?  It does 
work for me on plain DOS.

This is a bug: Emacs would not consider long file names such as 
gcc.info-1.gz as possible with the DJGPP port, even on Windows 9X.  It 
would always assume that long file names are not available and look for 
the short versions of these file names, such as gcc.i1z etc.

The patch below should fix this.  Let me know if they work for you.  
(Don't forget to byte-compile info.el once you apply the patch.)

2001-03-01  Eli Zaretskii  <eliz AT is DOT elta DOT co DOT il>

	* info.el (info-insert-file-contents-1): Accept an additional
	argument `lfn': if it is non-nil, concatenate `filename' and
	`suffix'; otherwise use the complicated MS-DOS code.  All callers
	changed.
	(info-insert-file-contents, Info-find-node): If the MS-DOS port
	can access long file names, try the long file-name version of
	`info-insert-file-contents-1', then the short file-name version.

--- lisp/info.e~0	Thu Feb 15 11:01:38 2001
+++ lisp/info.el	Thu Mar  1 13:39:44 2001
@@ -234,10 +234,10 @@
 be last in the list.")
 
 ;; Concatenate SUFFIX onto FILENAME.  SUFFIX should start with a dot.
-;; First, on ms-dos, delete some of the extension in FILENAME
-;; to make room.
-(defun info-insert-file-contents-1 (filename suffix)
-  (if (not (eq system-type 'ms-dos))
+;; First, on MS-DOS with no long file names support, delete some of
+;; the extension in FILENAME to make room.
+(defun info-insert-file-contents-1 (filename suffix lfn)
+  (if lfn	; long file names are supported
       (concat filename suffix)
     (let* ((sans-exts (file-name-sans-extension filename))
 	   ;; How long is the extension in FILENAME (not counting the dot).
@@ -263,8 +263,12 @@
 (defun info-insert-file-contents (filename &optional visit)
   "Insert the contents of an info file in the current buffer.
 Do the right thing if the file has been compressed or zipped."
-  (let ((tail Info-suffix-list)
-	fullname decoder)
+  (let* ((tail Info-suffix-list)
+	 (lfn (or (not (fboundp 'msdos-long-file-names))
+		  (msdos-long-file-names)))
+	 (check-short (and (fboundp 'msdos-long-file-names)
+			   lfn))
+	 fullname decoder done)
     (if (file-exists-p filename)
 	;; FILENAME exists--see if that name contains a suffix.
 	;; If so, set DECODE accordingly.
@@ -277,14 +281,23 @@
 	  (setq fullname filename
 		decoder (cdr (car tail))))
       ;; Try adding suffixes to FILENAME and see if we can find something.
-      (while (and tail
-		  (not (info-file-exists-p (info-insert-file-contents-1
-					    filename (car (car tail))))))
+      (while (and tail (not done))
+	(setq fullname (info-insert-file-contents-1 filename
+						    (car (car tail)) lfn))
+	(if (info-file-exists-p fullname)
+	    (setq done t
+		  ;; If we found a file with a suffix, set DECODER
+		  ;; according to the suffix.
+		  decoder (cdr (car tail)))
+	  ;; When the MS-DOS port runs on Windows, we need to check
+	  ;; the short variant of a long file name as well.
+	  (when check-short
+	    (setq fullname (info-insert-file-contents-1 filename
+							(car (car tail)) nil))
+	    (if (info-file-exists-p fullname)
+		(setq done t
+		      decoder (cdr (car tail))))))
 	(setq tail (cdr tail)))
-      ;; If we found a file with a suffix, set DECODER according to the suffix
-      ;; and set FULLNAME to the file's actual name.
-      (setq fullname (info-insert-file-contents-1 filename (car (car tail)))
-	    decoder (cdr (car tail)))
       (or tail
 	  (error "Can't find %s or any compressed version of it" filename)))
     ;; check for conflict with jka-compr
@@ -459,16 +472,24 @@
               (setq temp-downcase
                     (expand-file-name (downcase filename) (car dirs)))
               ;; Try several variants of specified name.
-              (let ((suffix-list Info-suffix-list))
+              (let ((suffix-list Info-suffix-list)
+		    (lfn (or (not (fboundp 'msdos-long-file-names))
+			     (msdos-long-file-names))))
                 (while (and suffix-list (not found))
                   (cond ((info-file-exists-p
                           (info-insert-file-contents-1
-                           temp (car (car suffix-list))))
+                           temp (car (car suffix-list)) lfn))
                          (setq found temp))
                         ((info-file-exists-p
                           (info-insert-file-contents-1
-                           temp-downcase (car (car suffix-list))))
-                         (setq found temp-downcase)))
+                           temp-downcase (car (car suffix-list)) lfn))
+                         (setq found temp-downcase))
+			((and (fboundp 'msdos-long-file-names)
+			      lfn
+			      (info-file-exists-p
+			       (info-insert-file-contents-1
+				temp (car (car suffix-list)) nil)))
+			 (setq found temp)))
                   (setq suffix-list (cdr suffix-list))))
               (setq dirs (cdr dirs)))))
         (if found

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019