From xemacs-m  Thu Mar 20 10:08:32 1997
Received: from macon.informatik.uni-tuebingen.de (macon2.Informatik.Uni-Tuebingen.De [134.2.13.2])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id KAA13903
	for <xemacs-beta@xemacs.org>; Thu, 20 Mar 1997 10:08:30 -0600 (CST)
Received: from modas.informatik.uni-tuebingen.de (modas.Informatik.Uni-Tuebingen.De [134.2.12.3]) by macon.informatik.uni-tuebingen.de (8.8.4/8.8.3/AIX-4.1/WSI-1.0) with SMTP id RAA21100; Thu, 20 Mar 1997 17:08:30 +0100
Received: by modas.informatik.uni-tuebingen.de (AIX 4.1/UCB 5.64/4.03)
          id AA21198; Thu, 20 Mar 1997 17:08:28 +0100
Sender: sperber@informatik.uni-tuebingen.de
To: kifer@cs.sunysb.edu (Michael Kifer)
Cc: xemacs-beta@xemacs.org
Subject: Re: efs broken in 20.0
References: <199702140004.TAA23848@cs.sunysb.edu>
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: text/plain; charset=US-ASCII
From: sperber@informatik.uni-tuebingen.de (Michael Sperber [Mr. Preprocessor])
Date: 20 Mar 1997 17:08:26 +0100
In-Reply-To: kifer@CS.SunySB.EDU's message of Thu, 13 Feb 1997 18:52:58 -0500
Message-Id: <y9lzpvylf5x.fsf@modas.informatik.uni-tuebingen.de>
Lines: 304
X-Mailer: Gnus v5.4.23/XEmacs 20.1

>>>>> "michael" == Michael Kifer <kifer@CS.SunySB.EDU> writes:

michael> Something fishy is going on when efs-1.15 interacts with find-file
michael> in XEmacs20.0 compiled --with-mule.

michael> If you first load (require 'efs) and then do:

michael> (defadvice find-file (before vip-add-suffix-advice activate)
michael>   "Use `read-file-name' for reading arguments."
michael>   (interactive (list (read-file-name "Find file: " nil default-directory))))

michael> then everything is fine. But if you first advise find-file and *then* load
michael> efs, find-file breaks, as you start geting errors about the wrong number of
michael> args. 

The fix is attached.  A comment explains the problem.

I have not been able to reproduce the other problem Michael Kifer has
reported where the same setup produces

list nesting exceeds max-lisp-eval-depth

I'll try to find out more tomorrow.  Steve, note that the attached fix
will (hopefully) be part of a larger patch I'll send tomorrow.  This
is just to show I'm not just sitting on my ass wrt EFS.

Cheers =8-} Mike

Index: default-dir.el
===================================================================
RCS file: /afs/informatik.uni-tuebingen.de/home/sperber/cvs/elisp/efs/default-dir.el,v
retrieving revision 1.4
diff -r1.4 default-dir.el
37a38,41
> (defconst default-dir-find-file-takes-coding-system
>   (and (eq default-dir-emacs-variant 'xemacs)
>        (>= (string-to-int (substring emacs-version 0 2)) 20)))
> 
61,73c65,67
< (if (or (featurep 'mule)
< 	(boundp 'MULE))
<     (progn
<       
<       (defun default-dir-find-file (file &optional coding-system)
< 	"Documented as original"
< 	(interactive   
< 	 (list
< 	  (expand-file-name
< 	   (read-file-name "Find file: " (default-directory)))
< 	  (and current-prefix-arg
< 	       (read-coding-system "Coding-system: "))))
< 	(default-dir-real-find-file file coding-system))
---
> (cond
>  ((or (featurep 'mule)
>       (boundp 'MULE))
75,83c69,77
<       (defun default-dir-find-file-other-window (file &optional coding-system)
< 	"Documented as original"
< 	(interactive
< 	 (list
< 	  (expand-file-name
< 	   (read-file-name "Find file in other window: " (default-directory)))
< 	  (and current-prefix-arg
< 	       (read-coding-system "Coding-system: "))))
< 	(default-dir-real-find-file-other-window file coding-system))
---
>   (defun default-dir-find-file (file &optional coding-system)
>     "Documented as original"
>     (interactive   
>      (list
>       (expand-file-name
>        (read-file-name "Find file: " (default-directory)))
>       (and current-prefix-arg
> 	   (read-coding-system "Coding-system: "))))
>     (default-dir-real-find-file file coding-system))
85,124c79,159
<       (defun default-dir-find-file-read-only (file &optional coding-system)
< 	"Documented as original"
< 	(interactive
< 	 (list
< 	  (expand-file-name
< 	   (read-file-name "Find file read-only: " (default-directory) nil t))
< 	  (and current-prefix-arg
< 	       (read-coding-system "Coding-system: "))))
< 	(default-dir-real-find-file-read-only file coding-system))
< 
<       (if (fboundp 'find-file-read-only-other-window)
< 	  (progn
< 	    (defun default-dir-find-file-read-only-other-window
< 	      (file &optional coding-system)
< 	      "Documented as original"
< 	      (interactive
< 	       (list
< 		(expand-file-name
< 		 (read-file-name
< 		  "Find file read-only in other window: "
< 		  (default-directory) nil t))
< 		(and current-prefix-arg
< 		     (read-coding-system "Coding-system: "))))
< 	      (default-dir-real-find-file-read-only-other-window file
< 		coding-system))))
< 
<       (if (fboundp 'find-file-other-frame)
< 	  (progn
< 	    (defun default-dir-find-file-other-frame
< 	      (file &optional coding-system)
< 	      "Documented as original"
< 	      (interactive
< 	       (list
< 		(expand-file-name
< 		 (read-file-name "Find file in other frame: "
< 				 (default-directory)))
< 		(and current-prefix-arg
< 		     (read-coding-system "Coding-system: "))))
< 	      (default-dir-real-find-file-other-frame file
< 		coding-system))))
---
>   (defun default-dir-find-file-other-window (file &optional coding-system)
>     "Documented as original"
>     (interactive
>      (list
>       (expand-file-name
>        (read-file-name "Find file in other window: " (default-directory)))
>       (and current-prefix-arg
> 	   (read-coding-system "Coding-system: "))))
>     (default-dir-real-find-file-other-window file coding-system))
> 
>   (defun default-dir-find-file-read-only (file &optional coding-system)
>     "Documented as original"
>     (interactive
>      (list
>       (expand-file-name
>        (read-file-name "Find file read-only: " (default-directory) nil t))
>       (and current-prefix-arg
> 	   (read-coding-system "Coding-system: "))))
>     (default-dir-real-find-file-read-only file coding-system))
> 
>   (if (fboundp 'find-file-read-only-other-window)
>       (progn
> 	(defun default-dir-find-file-read-only-other-window
> 	  (file &optional coding-system)
> 	  "Documented as original"
> 	  (interactive
> 	   (list
> 	    (expand-file-name
> 	     (read-file-name
> 	      "Find file read-only in other window: "
> 	      (default-directory) nil t))
> 	    (and current-prefix-arg
> 		 (read-coding-system "Coding-system: "))))
> 	  (default-dir-real-find-file-read-only-other-window file
> 	    coding-system))))
> 
>   (if (fboundp 'find-file-other-frame)
>       (progn
> 	(defun default-dir-find-file-other-frame
> 	  (file &optional coding-system)
> 	  "Documented as original"
> 	  (interactive
> 	   (list
> 	    (expand-file-name
> 	     (read-file-name "Find file in other frame: "
> 			     (default-directory)))
> 	    (and current-prefix-arg
> 		 (read-coding-system "Coding-system: "))))
> 	  (default-dir-real-find-file-other-frame file
> 	    coding-system))))
>   
>   (if (fboundp 'find-file-read-only-other-frame)
>       (progn
> 	(defun default-dir-find-file-read-only-other-frame
> 	  (file &optional coding-system)
> 	  "Documented as original"
> 	  (interactive
> 	   (list
> 	    (expand-file-name
> 	     (read-file-name "Find file read-only in other frame: "
> 			     (default-directory) nil t))
> 	    (and current-prefix-arg
> 		 (read-coding-system "Coding-system: "))))
> 	  (default-dir-real-find-file-read-only-other-frame file
> 	    coding-system)))))
> 
>  (default-dir-find-file-takes-coding-system
>    ;; This lossage is due to the fact that XEmacs 20.x without mule
>    ;; still accepts an optional argument for find-file related
>    ;; functions.  Things like advice.el insist on passing nil for
>    ;; optional arguments, and the interaction screws things up.
>    ;; Therefore these functions accept an optional dummy coding-system
>    ;; argument.
>     
>    (defun default-dir-find-file (file &optional coding-system)
>      "Documented as original"
>      (interactive
>       (list
>        (expand-file-name
> 	(read-file-name "Find file: " (default-directory)))))
>      (default-dir-real-find-file file))
126,139c161,212
<       (if (fboundp 'find-file-read-only-other-frame)
< 	  (progn
< 	    (defun default-dir-find-file-read-only-other-frame
< 	      (file &optional coding-system)
< 	      "Documented as original"
< 	      (interactive
< 	       (list
< 		(expand-file-name
< 		 (read-file-name "Find file read-only in other frame: "
< 				 (default-directory) nil t))
< 		(and current-prefix-arg
< 		     (read-coding-system "Coding-system: "))))
< 	      (default-dir-real-find-file-read-only-other-frame file
< 		coding-system)))))
---
>    (defun default-dir-find-file-other-window (file &optional coding-system)
>      "Documented as original"
>      (interactive
>       (list
>        (expand-file-name
> 	(read-file-name "Find file in other window: " (default-directory)))))
>      (default-dir-real-find-file-other-window file))
> 
>    (defun default-dir-find-file-read-only (file  &optional coding-system)
>      "Documented as original"
>      (interactive
>       (list
>        (expand-file-name
> 	(read-file-name "Find file read-only: " (default-directory) nil t))))
>      (default-dir-real-find-file-read-only file))
>   
>    (if (fboundp 'find-file-read-only-other-window)
>        (progn
> 	 (defun default-dir-find-file-read-only-other-window
> 	   (file  &optional coding-system)
> 	   "Documented as original"
> 	   (interactive
> 	    (list
> 	     (expand-file-name
> 	      (read-file-name
> 	       "Find file read-only in other window: "
> 	       (default-directory) nil t))))
> 	   (default-dir-real-find-file-read-only-other-window file))))
> 
>    (if (fboundp 'find-file-other-frame)
>        (progn
> 	 (defun default-dir-find-file-other-frame
> 	   (file  &optional coding-system)
> 	   "Documented as original"
> 	   (interactive
> 	    (list
> 	     (expand-file-name
> 	      (read-file-name "Find file in other frame: "
> 			      (default-directory)))))
> 	   (default-dir-real-find-file-other-frame file))))
> 
>    (if (fboundp 'find-file-read-only-other-frame)
>        (progn
> 	 (defun default-dir-find-file-read-only-other-frame
> 	   (file &optional coding-system)
> 	   "Documented as original"
> 	   (interactive
> 	    (list
> 	     (expand-file-name
> 	      (read-file-name "Find file read-only in other frame: "
> 			      (default-directory) nil t))))
> 	   (default-dir-real-find-file-read-only-other-frame file)))))
140a214,215
>  (t
>     
197c272,274
< 	  (default-dir-real-find-file-read-only-other-frame file)))))
---
> 	  (default-dir-real-find-file-read-only-other-frame file))))))
> 
>  
285,299c362,368
< ;; Is advice about?
< (if (featurep 'advice)
<     (defadvice cd (before default-dir-cd activate compile)
<       (interactive
<        (list
< 	(expand-file-name
< 	 (read-file-name "Change default directory: " (default-directory))))))
< 
<   (defun default-dir-cd (dir)
<     "Documented as original"
<     (interactive
<      (list
<       (expand-file-name
<        (read-file-name "Change default directory: " (default-directory)))))
<     (default-dir-real-cd dir))
---
> (defun default-dir-cd (dir)
>   "Documented as original"
>   (interactive
>    (list
>     (expand-file-name
>      (read-file-name "Change default directory: " (default-directory)))))
>   (default-dir-real-cd dir))
301c370
<   (efs-overwrite-fn "default-dir" 'cd 'default-dir-cd))
---
> (efs-overwrite-fn "default-dir" 'cd 'default-dir-cd)

