Anonymous avatar Anonymous committed 247494d

Created

Comments (0)

Files changed (62)

+1998-01-05  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile:  added diff.el.
+
+1997-12-18  Karl M. Hegbloom  <karlheg@bittersweet.inetarena.com>
+
+	* efs-netrc.el (efs-netrc-next-token): replace `char-equal'
+	  with `eq' to avoid error when `char-after' returns nil at
+	  eob.
+
+1998-01-02  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile: Update to newer package interface.
+
+1997-12-21  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile: Created.
+# Makefile for efs lisp code
+
+# This file is part of XEmacs.
+
+# XEmacs is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+
+# XEmacs is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with XEmacs; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+VERSION = 1.03
+PACKAGE = efs
+PKG_TYPE = regular
+REQUIRES = xemacs-base
+CATEGORY = libs
+
+ELCS = default-dir.elc diff.elc dired-cmpr.elc dired-diff.elc dired-faces.elc \
+	dired-grep.elc dired-help.elc dired-mob.elc dired-oas.elc \
+	dired-rgxp.elc dired-sex.elc dired-shell.elc dired-uu.elc \
+	dired-vir.elc dired-xemacs.elc dired-xy.elc dired.elc \
+	efs-auto.elc efs-cms-knet.elc efs-cms.elc efs-coke.elc \
+	efs-cp-p.elc efs-cu.elc efs-defun.elc efs-dired.elc \
+	efs-dl.elc efs-dos-distinct.elc efs-dump.elc efs-fnh.elc \
+	efs-guardian.elc efs-gwp.elc efs-hell.elc efs-ka9q.elc \
+	efs-kerberos.elc efs-mpe.elc efs-ms-unix.elc efs-mts.elc \
+	efs-mvs.elc efs-netrc.elc efs-netware.elc efs-nos-ve.elc \
+	efs-ovwrt.elc efs-pc.elc efs-plan9.elc efs-report.elc \
+	efs-ti-explorer.elc efs-ti-twenex.elc efs-tops-20.elc efs-vm.elc \
+	efs-vms.elc efs-vos.elc efs-x19.15.elc efs.elc
+
+INFO_FILES = efs.info
+
+include ../../XEmacs.rules
+
+all:: $(ELCS) auto-autoloads.elc custom-load.elc $(PACKAGE).info
+
+srckit: srckit-std
+
+binkit: binkit-sourceinfo
+###############################################################################
+#
+# File:         Makefile
+# Release:      $efs release: 1.15 $
+# Version:      $Revision$
+# RCS:
+# Description:  Makefile for byte-compiling efs and dired.
+# Author:       Andy Norman, HPLabs, Bristol, UK.
+# Created:      Sat Jan 30 00:18:56 1993
+# Language:     Text (make script)
+#
+###############################################################################
+
+## Installation Instructions
+############################
+# 1. Edit the configuration variables below.
+#    EMACS should be the name of the emacs program on your system.
+#    VERSION should be the emacs version. This must be one of:
+#      18     for all versions of Emacs 18.
+#      19     for all versions of the original GNU Emacs from FSF between
+#             19.1 and 19.22, inclusive.
+#      19.23  for version 19.23 and later of the original GNU Emacs from FSF
+#      l19.11 for XEmacs 19.11 trhu 19.14
+#      x19.15 for XEmacs 19.15
+#      x20    for XEmacs 20.1 and later
+#    LISPDIR should be the directory in which you want the .elc
+#      files installed.
+#    BDIR should be the directory containing the .elc files for the
+#      byte-compiler.  Although efs byte-compiles and works with the
+#      Emacs V18 byte-compiler, it is strongly recommended to use
+#      Jamie Zawinski's V19 byte-compiler. This byte-compiler is
+#      standard with Lucid Emacs, XEmacs, and GNU Emacs V19, so in this
+#      case you can set BDIR to nothing.
+#    VMDIR should be set to the directory containing the .elc files for
+#      VM. If you aren't using VM, then set this to nothing.
+#
+# 2. To byte-compile the entire package, except for VM support (efs-vm.el),
+#    run make VERSION, where VERSION is the emacs version that you are
+#    compiling for.  It must be one of:
+#    18     for Emacs 18
+#    19     for the original GNU Emacs from FSF, versions 19.1 through
+#             19.22, inclusive
+#    19.23  for the original GNU Emacs from FSF, version 19.23 and later.
+#    l19.11 for Lucid XEmacs 19.11 thru 19.14
+#    x19.15 for XEmacs 19.15
+#    x20    for XEmacs 20.1 and later
+#
+#    If you have set the VERSION variable correctly, then typing just    
+#    make will suffice.
+#
+# 3. To byte-compile everything, including VM support, run make all.
+#
+# 4. To byte-compile all the efs files, except for VM support,
+#    run make efs.
+#
+# 5. To byte-compile only the core efs files run make core.
+#
+# 6. To byte compile an efs-XXX.el file, run make XXX.
+#    This means that VM support can be compiled by running make vm.
+#
+# 7. To byte compile only dired, run make dired.
+#
+# 8. To byte-compile only efs-auto.el, for autoloading efs, run make auto.
+#
+
+## Edit these variables according to your configuration.
+
+# Name of Emacs program
+EMACS=xemacs
+# Emacs version. This must be set to one of 18, 19, 19.23,
+# l19.11, x19.15
+VERSION=x19.15
+# Current working directory
+CWD=`pwd`
+# Directory in which to install the lisp files
+LISPDIR=
+# Directory in which to install the info files
+INFODIR=
+# Directory in which to install the Texinfo file
+TEXIDIR=
+# Directory containing byte-compiler.  This is used by fixup.el
+BDIR=
+# Directory containing VM's .elc files.
+VMDIR=
+# Bourne shell executable, please.
+SHELL=/bin/sh
+
+###### It should not be necessary to edit anything below this line. ######
+
+COREOBJS = efs-defun.elc efs-ovwrt.elc efs-fnh.elc efs-cu.elc efs-netrc.elc \
+           efs.elc efs-dired.elc efs-report.elc \
+           efs-cp-p.elc \
+	   efs-dump.elc
+CORESRC = efs-defun.el efs-ovwrt.el efs-fnh.el efs-cu.el efs-netrc.el \
+          efs.el efs-dired.el efs-report.el \
+          efs-cp-p.el \
+	  efs-dump.el
+DOBJS = default-dir.elc dired.elc dired-mob.elc dired-oas.elc \
+        dired-rgxp.elc dired-shell.elc dired-vir.elc dired-xy.elc \
+        dired-grep.elc dired-uu.elc \
+        dired-cmpr.elc dired-diff.elc dired-help.elc dired-sex.elc
+DSRC = default-dir.el dired.el dired-mob.el dired-oas.el \
+       dired-rgxp.el dired-shell.el dired-vir.el dired-xy.el \
+       dired-grep.el dired-uu.el \
+       dired-cmpr.el dired-diff.el dired-help.el dired-sex.el
+EFSOBJS = $(COREOBJS) efs-auto.elc \
+          efs-cms.elc efs-cms-knet.elc efs-dos-distinct.elc efs-nos-ve.elc \
+          efs-gwp.elc efs-kerberos.elc efs-hell.elc efs-ka9q.elc \
+          efs-mpe.elc efs-mts.elc efs-mvs.elc efs-netware.elc \
+          efs-pc.elc efs-ti-explorer.elc efs-ti-twenex.elc \
+          efs-tops-20.elc efs-dl.elc efs-guardian.elc efs-coke.elc \
+          efs-vms.elc efs-vos.elc efs-plan9.elc efs-ms-unix.elc
+EFSSRC = $(CORESRC) efs-auto.el \
+          efs-cms.el efs-cms-knet.el efs-dos-distinct.el efs-nos-ve.el \
+          efs-gwp.el efs-kerberos.el efs-hell.el efs-ka9q.el \
+          efs-mpe.el efs-mts.el efs-mvs.el efs-netware.el \
+          efs-pc.el efs-ti-explorer.el efs-ti-twenex.el \
+          efs-tops-20.el efs-dl.el efs-guardian.el efs-coke.el \
+          efs-vms.el efs-vos.el efs-plan9.el efs-ms-unix.el
+VMOBJS = efs-vm.elc
+VMSRC = efs-vm.el
+MULEOBJS = dired-mule.elc efs-dired-mule.elc
+MULESRC = dired-mule.el efs-dired-mule.el
+GEOBJS = dired-fsf.elc \
+	 passwd.elc diff.elc auto-save.elc \
+	 $(MULEOBJS)
+GESRC = dired-fsf.el \
+	passwd.el diff.el auto-save.el \
+	$(MULESRC)
+XEOBJS = dired-faces.elc dired-xemacs.elc \
+	$(VMOBJS)
+XESRC = dired-faces.el dired-xemacs.el \
+	$(VMSRC) $(MULESRC)
+OBJS = $(DOBJS) $(EFSOBJS) $(VMOBJS) $(GEOBJS) $(XEOBJS) \
+       efs-18.elc efs-19.elc efs-19.23.elc \
+       efs-l19.11.elc efs-x19.15.elc \
+       emacs-19.elc fn-handler.elc \
+       reporter.elc
+
+# fixup.el is never byte-compiled.  It would do no harm, but be a waste
+# of time.
+
+## Specify new rules.
+
+.SUFFIXES: .elc .el .texi .info
+
+.el.elc:
+	BDIR=$(BDIR) CWD=$(CWD) VMDIR=$(VMDIR) \
+  $(EMACS) -batch -no-site-file -l $(CWD)/fixup -f batch-byte-compile $(CWD)/$<
+
+.texi.info:
+	$(EMACS) -batch -f batch-texinfo-format $(CWD)/$<
+
+## targets
+
+# What lazy fingers buys you
+default: $(VERSION) dired
+
+# .elc files depend on .el source
+# Do this in this brain-dead way because different makes do pattern
+# rules differently. grumble grumble...
+#
+# dired
+dired.elc: dired.el
+dired-mob.elc: dired-mob.el
+dired-oas.elc: dired-oas.el
+dired-rgxp.elc: dired-rgxp.el
+dired-shell.elc: dired-shell.el
+dired-vir.elc: dired-vir.el
+dired-xy.elc: dired-xy.el
+dired-grep.elc: dired-grep.el
+dired-uu.elc: dired-uu.el
+dired-fsf.elc: dired-fsf.el
+dired-cmpr.elc: dired-cmpr.el
+dired-help.elc: dired-help.el
+dired-diff.elc: dired-diff.el
+dired-sex.elc: dired-sex.el
+dired-mule.elc: dired-mule.el
+dired-xemacs.elc: dired-xemacs.el
+dired-faces.elc: dired-faces.el
+default-dir.elc: default-dir.el
+diff.elc: diff.el
+# efs core files
+efs.elc: efs.el
+efs-defun.elc: efs-defun.el
+efs-cp-p.elc: efs-cp-p.el
+efs-cu.elc: efs-cu.el
+efs-netrc.elc: efs-netrc.el
+efs-auto.elc: efs-auto.el
+efs-dired.elc: efs-dired.el
+efs-dired-mule.elc: efs-dired-mule.el
+efs-report.elc: efs-report.el
+efs-ovwrt.elc: efs-ovwrt.el
+efs-fnh.elc: efs-fnh.el
+# efs multi-OS and FTP server support
+efs-cms.elc: efs-cms.el
+efs-cms-knet.elc: efs-cms-knet.el
+efs-coke.elc: efs-coke.el
+efs-dos-distinct.elc: efs-dos-distinct.el
+efs-nos-ve.elc: efs-nos-ve.el
+efs-gwp.elc:  efs-gwp.el
+efs-hell.elc: efs-hell.el
+efs-ka9q.elc: efs-ka9q.el
+efs-kerberos.elc: efs-kerberos.el
+efs-mpe.elc: efs-mpe.el
+efs-mts.elc: efs-mts.el
+efs-mvs.elc: efs-mvs.el
+efs-netware.elc: efs-netware.el
+efs-pc.elc: efs-pc.el
+efs-ti-explorer.elc: efs-ti-explorer.el
+efs-ti-twenex.elc: efs-ti-twenex.el
+efs-tops-20.elc: efs-tops-20.el
+efs-dl.elc: efs-dl.el
+efs-vms.elc: efs-vms.el
+efs-vos.elc: efs-vos.el
+efs-guardian.elc: efs-guardian.el
+efs-plan9.elc: efs-plan9.el
+efs-ms-unix.elc: efs-ms-unix.el
+# efs support for different Emacs versions
+efs-18.elc: efs-18.el
+efs-19.elc: efs-19.el
+efs-19.23.elc: efs-19.23.el
+efs-l19.11.elc: efs-l19.11.el
+efs-x19.15.elc: efs-x19.15.el
+# efs vm support
+efs-vm.elc: efs-vm.el
+# backward compatibility files
+fn-handler.elc: fn-handler.el
+emacs-19.elc: emacs-19.el
+# auto-save package
+auto-save.elc: auto-save.el
+
+# Core targets
+core: $(COREOBJS)
+
+# Extra perks
+auto: core efs-auto.elc
+cms: core efs-cms.elc
+cms-knet: core efs-cms-knet.elc
+dos-distinct: core efs-dos-distinct.elc
+nos-ve: core efs-nos-ve.elc
+gwp: core efs-gwp.elc
+hell: core efs-hell.elc
+ka9q: core efs-ka9q.elc
+kerberos: core efs-kerberos.elc
+mpe: core efs-mpe.elc
+mts: core efs-mts.elc
+mvs: core efs-mvs.elc
+netware: core efs-netware.elc
+pc: core efs-pc.elc
+ti-explorer: core efs-ti-explorer.elc
+ti-twenex: core efs-ti-twenex.elc
+tops-20: core efs-tops-20.elc
+dl: core efs-dl.elc
+vms: core efs-vms.elc
+vos: core efs-vos.elc
+guardian: core efs-guardian.elc
+plan9: core efs-plan9.elc
+coke: core efs-coke.elc
+vm: core $(VMOBJS)
+
+# The grand tour
+efs: $(EFSOBJS)
+dired: $(DOBJS)
+all: $(OBJS)
+info: efs.info
+
+# Making for a specific emacs version
+18: emacs-19.elc fn-handler.elc efs dired efs-18.elc dired-mule.elc \
+    efs-dired-mule.elc reporter.elc passwd.elc diff.elc auto-save.elc
+19: fn-handler.elc efs dired efs-19.elc $(GEOBJS)
+19.23: efs dired efs-19.23.elc $(GEOBJS)
+l19.11: efs dired efs-l19.11.elc $(XEOBJS)
+x19.15: efs dired efs-x19.15.elc $(XEOBJS)
+x20: efs dired efs-x19.15.elc $(XEOBJS) $(MULEOBJS)
+
+# Installation
+install:
+	@echo "Installing in $(LISPDIR)..."
+	cp *.elc $(LISPDIR)
+	cp efs.info $(INFODIR)
+install_src:
+	@echo "Installing in $(LISPDIR)..."
+	cp `ls *.el | grep -v "fixup"` $(LISPDIR)
+	cp efs.texi $(TEXIDIR)
+install_xemacs:
+	@echo "Installing source in $(LISPDIR)..."
+	cp $(EFSSRC) $(DSRC) $(XESRC) efs-x19.15.el $(LISPDIR)
+	cp Makefile README fixup.el $(LISPDIR)
+	cp efs.texi $(TEXIDIR)
+diff_xemacs:
+	for f in $(EFSSRC) $(DSRC) $(XESRC) efs-x19.15.el \
+	         Makefile README fixup.el; do \
+		if [ -e $(LISPDIR)/$$f ]; \
+		then\
+		  diff -c $(LISPDIR)/$$f $$f; \
+		else \
+		  diff -c /dev/null $$f; \
+		fi \
+	done
+install_all: install_src install
+clean:
+	rm -f $(OBJS)
+
+autoloads: auto-autoloads.el
+
+auto-autoloads.el: $(EFSSRC) $(DSRC) efs-x19.15.el $(XESRC) $(MULESRC)
+	$(EMACS) -batch -q -no-site-file \
+		-eval '(setq autoload-target-directory "'`pwd`'/")' \
+		-eval '(setq autoload-package-name "efs")' \
+		-l autoload \
+		-f batch-update-autoloads $?
+
+## end of Makefile ##
+This version of EFS was modified for integration with XEmacs by
+Mike Sperber <sperber@informatik.uni-tuebingen.de>.
+He is the current maintainer of this version of EFS.
+
+A Few Things That You Should Know About EFS:
+--------------------------------------------
+
+For documentation, see the first page of the file efs.el.  If you
+access FTP via a gateway, then be sure to read the documentation in
+efs.el on how to configure efs to use a gateway.  To find the section
+on user customization variables in efs.el, search for the first
+occurrence of the string ">>>>".  TeXinfo documentation is
+forthcoming.
+
+The file CHANGES contains a description of changes to EFS from the
+previous release to this release.  It also tells you where you can get
+the latest version of efs.
+
+The file LISTS contains a description of mailing lists relevant to
+efs.  It too tells you where you can get the latest version of efs.
+We encourage users to join these lists.
+
+EFS and archie.el:
+------------------
+
+To use archie.el (by Jack Repenning) with efs, you need at least
+archie.el V3.0.1.  Problems using efs with archie may be posted to the
+efs mailing lists.
+;;  -*-Emacs-Lisp-*-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; File:         default-dir.el
+;; RCS:
+;; Version:      #Revision: 1.5 $
+;; Description:  Defines the function default-directory, for fancy handling
+;;               of the initial contents in the minibuffer when reading
+;;               file names.
+;; Authors:      Sebastian Kremer <sk@thp.uni-koeln.de>
+;;               Sandy Rutherford <sandy@ibm550.sissa.it>
+;; Created:      Sun Jul 18 11:38:06 1993 by sandy on ibm550
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 1, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+(provide 'default-dir)
+(require 'efs-ovwrt)
+
+(defconst default-dir-emacs-variant
+  (cond ((string-match "XEmacs" emacs-version) 'xemacs)
+	((>= (string-to-int (substring emacs-version 0 2)) 19) 'fsf-19)
+	(t 'fsf-18)))
+
+(defconst default-dir-find-file-takes-coding-system
+  (and (eq default-dir-emacs-variant 'xemacs)
+       (>= (string-to-int (substring emacs-version 0 2)) 20)))
+
+;;;###autoload
+(defvar default-directory-function nil
+  "A function to call to compute the default-directory for the current buffer.
+If this is nil, the function default-directory will return the value of the
+variable default-directory.
+Buffer local.")
+(make-variable-buffer-local 'default-directory-function)
+
+;; As a bonus we give shell-command history if possible.
+(defvar shell-command-history nil
+  "History list of previous shell commands.")
+
+(defun default-directory ()
+  " Returns the default-directory for the current buffer.
+Will use the variable default-directory-function if it non-nil."
+  (if default-directory-function
+      (funcall default-directory-function)
+    (if (eq default-dir-emacs-variant 'xemacs)
+	(abbreviate-file-name default-directory t)
+      (abbreviate-file-name default-directory))))
+
+;;; Overloads
+
+(cond
+ ((or (featurep 'mule)
+      (boundp 'MULE))
+
+  (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))
+
+  (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))
+  
+   (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)))))
+
+ (t
+    
+  (defun default-dir-find-file (file)
+    "Documented as original"
+    (interactive
+     (list
+      (expand-file-name
+       (read-file-name "Find file: " (default-directory)))))
+    (default-dir-real-find-file file))
+  
+  (defun default-dir-find-file-other-window (file)
+    "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)
+    "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)
+	  "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)
+	  "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)
+	  "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))))))
+
+ 
+
+(efs-overwrite-fn "default-dir" 'find-file 'default-dir-find-file)
+(efs-overwrite-fn "default-dir" 'find-file-other-window
+		  'default-dir-find-file-other-window)
+(if (fboundp 'find-file-other-frame)
+    (efs-overwrite-fn "default-dir" 'find-file-other-frame
+		      'default-dir-find-file-other-frame))
+(efs-overwrite-fn "default-dir" 'find-file-read-only
+		  'default-dir-find-file-read-only)
+(if (fboundp 'find-file-read-only-other-window)
+    (efs-overwrite-fn "default-dir" 'find-file-read-only-other-window
+		      'default-dir-find-file-read-only-other-window))
+(if (fboundp 'find-file-read-only-other-frame)
+    (efs-overwrite-fn "default-dir" 'find-file-read-only-other-frame
+		      'default-dir-find-file-read-only-other-frame))
+
+
+(defun default-dir-load-file (file)
+  "Documented as original"
+  (interactive
+   (list
+    (expand-file-name
+     (read-file-name "Load file: " (default-directory) nil t))))
+  (default-dir-real-load-file file))
+
+(efs-overwrite-fn "default-dir" 'load-file 'default-dir-load-file)
+
+(condition-case nil
+    (require 'view-less)
+  (error (require 'view)))
+
+(defun default-dir-view-file (file)
+  "Documented as original"
+  (interactive
+   (list
+    (expand-file-name
+     (read-file-name "View file: " (default-directory) nil t))))
+  (default-dir-real-view-file file))
+
+(efs-overwrite-fn "default-dir" 'view-file 'default-dir-view-file)
+
+(if (fboundp 'view-file-other-window)
+    (progn
+      (defun default-dir-view-file-other-window (file)
+	"Documented as original"
+	(interactive
+	 (list
+	  (expand-file-name
+	   (read-file-name "View file in other window: "
+			   (default-directory) nil t))))
+	(default-dir-real-view-file-other-window file))
+      (efs-overwrite-fn "default-dir" 'view-file-other-window
+			'default-dir-view-file-other-window)))
+
+(if (fboundp 'view-file-other-frame)
+    (progn
+      (defun default-dir-view-file-other-frame (file)
+	"Documented as original"
+	(interactive
+	 (list
+	  (expand-file-name
+	   (read-file-name "View file in other frame: "
+			   (default-directory) nil t))))
+	(default-dir-real-view-file-other-frame file))
+      (efs-overwrite-fn "default-dir" 'view-file-other-frame
+			'default-dir-view-file-other-frame)))
+
+
+(defun default-dir-shell-command (command &optional output-buffer)
+  "Documented as original"
+  (interactive
+   (list
+    (let ((prompt (format "Shell command in %s: " (default-directory))))
+      (cond
+       ((eq default-dir-emacs-variant 'xemacs)
+	(read-shell-command "Shell command: "))
+       ((eq default-dir-emacs-variant 'fsf-19)
+	(read-from-minibuffer prompt nil nil nil 'shell-command-history))
+       ((featurep 'gmhist)
+	(let ((minibuffer-history-symbol 'shell-command-history))
+	  (read-string prompt)))
+       (t (read-string prompt))))
+    current-prefix-arg))
+  (let ((default-directory (expand-file-name (default-directory))))
+    (default-dir-real-shell-command command output-buffer)))
+
+(efs-overwrite-fn "default-dir" 'shell-command 'default-dir-shell-command)
+
+(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))
+  
+(efs-overwrite-fn "default-dir" 'cd 'default-dir-cd)
+
+(defun default-dir-set-visited-file-name (filename)
+  "Documented as original"
+  (interactive
+   (list
+    (expand-file-name
+     (read-file-name "Set visited file name: " (default-directory)))))
+  (default-dir-real-set-visited-file-name filename))
+
+(efs-overwrite-fn "default-dir" 'set-visited-file-name
+		  'default-dir-set-visited-file-name)
+
+(defun default-dir-insert-file (filename &rest args)
+  "Documented as original"
+  (interactive
+   (list
+    (expand-file-name
+     (read-file-name "Insert file: " (default-directory) nil t))))
+  (apply 'default-dir-real-insert-file filename args))
+
+(efs-overwrite-fn "default-dir" 'insert-file 'default-dir-insert-file)
+
+(defun default-dir-append-to-file (start end filename &rest args)
+  "Documented as original"
+  (interactive
+   (progn
+     (or (mark) (error "The mark is not set now"))
+     (list
+      (min (mark) (point))
+      (max (mark) (point))
+      (expand-file-name
+       (read-file-name "Append to file: " (default-directory))))))
+  (apply 'default-dir-real-append-to-file start end filename args))
+
+(efs-overwrite-fn "default-dir" 'append-to-file 'default-dir-append-to-file)
+
+(defun default-dir-delete-file (file)
+  "Documented as original"
+  (interactive
+   (list
+    (expand-file-name
+     (read-file-name "Delete file: " (default-directory) nil t))))
+  (default-dir-real-delete-file file))
+
+(efs-overwrite-fn "default-dir" 'delete-file 'default-dir-delete-file)
+
+;;; end of default-dir.el
+;; -*-Emacs-Lisp-*-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; File:         diff.el
+;; Version:      $Revision$
+;; Author:       This file is based on diff.el by
+;;               sunpitt!wpmstr!fbresz@Sun.COM 1/27/89.
+;;               It has been completely rewritten in July 1994 by
+;;               Sandy Rutherford <sandy@ibm550.sissa.it>
+;; RCS:          
+;; Description:  diff-mode for handling output from unix diff utility.
+;; Modified:     Wed Jul 17 10:26:57 1996 (Andy Norman) ange@hplb.hpl.hp.com
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; Copyright (C) 1990 Free Software Foundation, Inc.
+;;; Copyright (C) 1994 Sandy Rutherford
+
+;;; This file is based on diff.el by sunpitt!wpmstr!fbresz@Sun.COM 1/27/89.
+;;; It has been completely rewritten in July 1994 by
+;;; Sandy Rutherford <sandy@ibm550.sissa.it>
+
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 1, or (at your option)
+;;; any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; A copy of the GNU General Public License can be obtained from this
+;;; program's author (send electronic mail to sandy@ibm550.sissa.it) or
+;;; from the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+;;; MA 02139, USA.
+
+(provide 'diff)
+
+;;; User Variables
+
+(defgroup diff nil
+  "Handling output from Unix diff utility"
+  :group 'tools)
+
+;; should be in to loaddefs.el now.
+;;;###autoload
+(defcustom diff-switches "-c"
+  "*A list of switches (strings) to pass to the diff program."
+  :type '(choice string
+		 (repeat string))
+  :group 'diff)
+
+(defcustom diff-do-narrow nil
+  "*If non-nil diff buffers are initialized narrowed to each difference."
+  :type 'boolean
+  :group 'diff)
+
+(defcustom diff-load-hooks nil
+  "Hooks to run after loading diff.el"
+  :type 'hook
+  :group 'diff)
+
+;;; Internal variables
+
+(defconst diff-emacs-19-p
+  (let ((ver (string-to-int (substring emacs-version 0 2))))
+    (>= ver 19)))
+
+(or diff-emacs-19-p (require 'emacs-19))
+
+(defvar diff-old-file nil)
+;; A list whose car is the name of the old file, and whose cdr indicates
+;; whether we should delete the buffer on quit.
+(defvar diff-new-file nil)
+;; Same as diff-old-file, except for the new file.
+(defvar diff-total-differences "0")
+;; Total number of difference hunks as a string.
+(defvar diff-current-difference "0")
+;; Current difference hunk as a string.
+(defvar diff-current-hunk 0)
+;; Current difference hunk as an integer.
+(defvar diff-total-hunks 0)
+;; Total number of difference hunks as an integer.
+(defvar diff-hunk-vector (vector 0))
+;; Vector storing the starting positions of the difference hunks.
+(defvar diff-old-file-pattern nil)
+(defvar diff-new-file-pattern nil)
+(defvar diff-hunk-pattern nil)
+;; Regexps to use when parsing file lines in difference hunks.
+
+
+(defvar diff-search-pattern-alist
+  (list
+    (list ?e "^[0-9]\\(,[0-9]+\\)?[acd]$" "^\\([0-9]+\\)" nil)
+    (list ?c "^\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\n"
+	  "^\\*+ \\([0-9]+\\)" "^-+ \\([0-9]+\\)")
+    (list ?u "^@@ " "^@@ -\\([0-9]+\\)" "^@@ -[0-9,]+ \\+\\([0-9]+\\)")
+    (list nil "^[0-9]+" "^\\([0-9]+\\)" "^[0-9,]+[acd]\\([0-9]+\\)")))
+
+(defvar diff-keymap-grokked nil)
+
+(defvar diff-temp-template "/tmp/diff")
+
+;; Initialize the keymap if it isn't already
+
+(defvar diff-mode-map nil
+  "Keymap used in diff mode.")
+
+(if diff-mode-map
+    nil
+  (setq diff-mode-map (make-keymap))
+  (suppress-keymap diff-mode-map)
+  (define-key diff-mode-map "?" 'describe-mode)
+  (define-key diff-mode-map "." 'diff-display-file)
+  (define-key diff-mode-map "N" 'diff-narrow)
+  (define-key diff-mode-map "W" 'widen)
+  (define-key diff-mode-map "f" 'diff-find-file)
+  (define-key diff-mode-map "h" 'diff-show-header)
+  (define-key diff-mode-map "j" 'diff-show-difference)
+  (define-key diff-mode-map "n" 'diff-next-difference)
+  (define-key diff-mode-map "o" 'diff-find-file-other-window)
+  (define-key diff-mode-map "p" 'diff-previous-difference)
+  (define-key diff-mode-map "q" 'diff-quit)
+  (define-key diff-mode-map "w" 'diff-find-file-other-frame)
+  (define-key diff-mode-map "\C-c\C-c" 'diff-find-file-other-window)
+  (define-key diff-mode-map " " 'diff-advertised-scroll-up)
+  (define-key diff-mode-map 'backspace 'diff-advertised-scroll-down)
+  (define-key diff-mode-map 'delete 'diff-advertised-scroll-down)
+  (define-key diff-mode-map "\C-n" 'diff-next-line)
+  (define-key diff-mode-map "\C-p" 'diff-previous-line)
+  (define-key diff-mode-map "\M->" 'diff-end-of-buffer)
+  (define-key diff-mode-map "\M-<" 'diff-beginning-of-buffer))
+
+;;; Internal functions
+
+(defun diff-grok-keys (to-command from-command)
+  ;; Assigns to TO-COMMAND the keys for the global binding of FROM-COMMAND.
+  ;; Does not clobber anything in the local keymap.
+  (let ((keys (where-is-internal from-command)))
+    (while keys
+      (condition-case nil
+	  (if (eq (global-key-binding (car keys)) (key-binding (car keys)))
+	      (local-set-key (car keys) to-command))
+	(error nil))
+      (setq keys (cdr keys)))))
+
+(defun diff-grok-keymap ()
+  (if diff-keymap-grokked
+      ()
+    (if (and term-setup-hook (boundp 'command-line-args-left))
+	(progn
+	  (if diff-emacs-19-p
+	      (run-hooks term-setup-hook)
+	    (funcall term-setup-hook))
+	  (setq term-setup-hook nil)))
+    (setq diff-keymap-grokked t)
+    (diff-grok-keys 'diff-next-line 'next-line)
+    (diff-grok-keys 'diff-previous-line 'previous-line)
+    (diff-grok-keys 'diff-forward-char 'forward-char)
+    (diff-grok-keys 'diff-backward-char 'backward-char)
+    (diff-grok-keys 'diff-scroll-up 'scroll-up)
+    (diff-grok-keys 'diff-scroll-down 'scroll-down)
+    (diff-grok-keys 'diff-beginning-of-buffer 'beginning-of-buffer)
+    (diff-grok-keys 'diff-end-of-buffer 'end-of-buffer)))
+
+(defun diff-buffer-narrowed-p ()
+  ;; Returns t if the current buffer is narrowed
+  (save-restriction
+    (let ((min (point-min))
+	  (max (point-max)))
+      (widen)
+      (not (and (= min (point-min)) (= max (point-max)))))))
+
+(defun diff-current-hunk ()
+  ;; Returns the current diff hunk.
+  (let ((pt (point))
+	(start 0)
+	(end (1+ diff-total-hunks))
+	m)
+    (while (> (- end start) 1)
+      (setq m (/ (+ start end) 2))
+      (if (>= pt (aref diff-hunk-vector m))
+	  (setq start m)
+	(setq end m)))
+    (if (>= pt (aref diff-hunk-vector end))
+	(setq m end)
+      (setq m start))
+    ;; Don't treat end of buffer as start of next hunk
+    (if (eobp) (1- m) m)))
+
+(defun diff-hunk-min (n)
+  ;; Returns the start of the current diff hunk.
+  (aref diff-hunk-vector n))
+
+(defun diff-hunk-max (n)
+  ;; Returns the end of the current diff hunk.
+  (aref diff-hunk-vector (1+ n)))
+
+(defun diff-parse-hunks ()
+  ;; Parses a buffer of diff output.
+  (save-excursion
+    (save-restriction
+      (message "Parsing differences...")
+      (widen)
+      (goto-char (point-min))
+      (let ((hunks (list 1)))
+	(while (re-search-forward diff-hunk-pattern nil t)
+	  (setq hunks (cons (match-beginning 0) hunks)))
+	(setq diff-total-hunks (1- (length hunks))
+	      diff-hunk-vector (apply 'vector
+				      (nreverse (cons (point-max) hunks)))))))
+  (message "Parsing differences...done"))
+
+(defun diff-update-modeline ()
+  ;; Updates the mode line to show current diff hunk.
+  (if (or (< (point) (diff-hunk-min diff-current-hunk))
+	  (>= (point) (diff-hunk-max diff-current-hunk)))
+      (progn
+	(setq diff-current-hunk (diff-current-hunk)
+	      diff-current-difference (int-to-string diff-current-hunk))
+	(set-buffer-modified-p (buffer-modified-p)))))
+
+(defun diff-read-args (oldprompt newprompt switchprompt
+				 &optional file-for-backup)
+  ;; Grab the args for diff.  OLDPROMPT and NEWPROMPT are the prompts
+  ;; for the old & new filenames, SWITCHPROMPT for the list of
+  ;; switches.  If FILE_FOR_BACKUP is provided (it must be a string if
+  ;; so), then it will be used to try & work out a file & backup to
+  ;; diff, & in this case the prompting order is backwards.  %s in a
+  ;; prompt has a guess substituted into it.  This is nasty.
+  (let (oldf newf)
+    (if file-for-backup
+	(setq newf file-for-backup
+	      newf (if (and newf (file-exists-p newf))
+		       (read-file-name
+			(format newprompt (file-name-nondirectory newf))
+			nil newf t)
+		     (read-file-name (format newprompt "") nil nil t))
+	      oldf (file-newest-backup newf)
+	      oldf (if (and oldf (file-exists-p oldf))
+		       (read-file-name
+			(format oldprompt (file-name-nondirectory oldf))
+			nil oldf t)
+		     (read-file-name (format oldprompt "")
+				     (file-name-directory newf) nil t)))
+      ;; Else we aren't trying to be bright...
+      (setq oldf (read-file-name (format oldprompt "") nil nil t)
+	    newf (read-file-name
+		  (format newprompt (file-name-nondirectory oldf))
+		  nil (file-name-directory oldf) t)))
+	(list oldf newf (diff-read-switches switchprompt))))
+
+(defun diff-read-switches (switchprompt)
+  ;; Read and return a list of switches
+  (if current-prefix-arg
+      (let ((default (if (listp diff-switches)
+			 (mapconcat 'identity diff-switches " ")
+		       diff-switches)))
+	(diff-fix-switches
+	 (read-string (format switchprompt default) default)))))
+
+(defun diff-fix-switches (switch-spec)
+  ;; Parse a string into a list of switches or leave it be if it's
+  ;; not a string
+  (if (stringp switch-spec)
+      (let (result (start 0))
+	(while (string-match "\\(\\S-+\\)" switch-spec start)
+	  (setq result (cons (substring switch-spec (match-beginning 1)
+					(match-end 1))
+			     result)
+		start (match-end 0)))
+	(nreverse result))
+    switch-spec))
+
+(defun diff-get-file-buffer (file)
+  ;; Returns \(BUFFER . DEL-P\), where DEL-P is t if diff is expected
+  ;; to delete the buffer, and nil otherwise.
+  (let* ((buff (get-file-buffer file))
+	 (del-p (null buff)))
+    (if (and buff (buffer-modified-p buff))
+	(progn
+	  (message
+	   "Buffer %s is modified.  Diffing against buffer contents."
+	   (buffer-name buff))
+	  (sit-for 1)))
+    ;; Call find-file-noselect even if we already have the buffer,
+    ;; as it will run verify-buffer-file-modtime.
+    (cons (find-file-noselect file) del-p)))
+
+(defun diff-cleanup-buffers ()
+  ;; Cleans up diff buffers by deleting buffers that we don't expect
+  ;; the user to care about.
+  (let ((files (list diff-old-file diff-new-file)))
+    (while files
+      (let ((ent (car files))
+	    buff)
+	(and (cdr ent)
+	     (setq buff (get-file-buffer (car ent)))
+	     (not (buffer-modified-p buff))
+	     (kill-buffer buff)))
+      (setq files (cdr files)))
+    (if (get-buffer "*Diff Header*")
+	(kill-buffer "*Diff Header*"))))
+
+(defun diff-latest-backup-file (file)
+  "Return the latest existing backup of FILE, or nil."
+  ;; First try simple backup, then the highest numbered of the
+  ;; numbered backups.
+  ;; Ignore the value of version-control because we look for existing
+  ;; backups, which maybe were made earlier or by another user with
+  ;; a different value of version-control.
+  (let* ((file (expand-file-name file))
+	 (handler (find-file-name-handler file 'diff-latest-backup-file)))
+    (if handler
+	(funcall handler 'diff-latest-backup-file file)
+      (or
+       (let ((bak (make-backup-file-name file)))
+	 (if (file-exists-p bak) bak))
+       (let* ((dir (file-name-directory file))
+	      (base-versions (concat (file-name-nondirectory file) ".~"))
+	      (bv-length (length base-versions)))
+	 (concat dir
+		 (car (sort
+		       (file-name-all-completions base-versions dir)
+		       ;; bv-length is a fluid var for backup-extract-version:
+		       (function
+			(lambda (fn1 fn2)
+			  (> (backup-extract-version fn1)
+			     (backup-extract-version fn2))))))))))))
+
+(defun diff-file-line (&optional old-file-p)
+  "Return line number of current hunk in `diff-new-file'.
+With optional argument OLD-FILE-P, use `diff-old-file' instead."
+  (save-excursion
+    (let ((min (diff-hunk-min diff-current-hunk))
+	  (max (diff-hunk-max diff-current-hunk))
+	  (regexp (if old-file-p diff-old-file-pattern diff-new-file-pattern)))
+      (goto-char min)
+      (or (and regexp (re-search-forward regexp max t))
+	  (error "Unable to locate a file line for %s file."
+		 (if old-file-p "old" "new")))
+      (string-to-int (buffer-substring (match-beginning 1) (match-end 1))))))
+
+(defun diff-run-diff (switches old old-temp new new-temp)
+  ;; Actually run the diff process with SWITCHES on OLD and NEW.
+  ;; OLD-TEMP and NEW-TEMP are names of temp files that can be used
+  ;; to dump the data out to.
+  (insert "diff " (mapconcat 'identity switches " ") " " old
+	  " " new "\n")
+  (apply 'call-process "diff" nil t nil
+	 (append switches (list old-temp new-temp))))
+
+
+(defun diff-fix-file-names (old old-temp new new-temp pattern)
+  ;; Replaces any temp file names with the real names of files.
+  (save-excursion
+    (save-restriction
+      (let ((files (list old new))
+	    (temps (list old-temp new-temp))
+	    buffer-read-only case-fold-search)
+	(goto-char (point-min))
+	(if (re-search-forward pattern nil t)
+	    (narrow-to-region (point-min) (match-beginning 0)))
+	(while files
+	  (let ((regexp (concat "[ \t\n]\\("
+				(regexp-quote (car temps))
+				"\\)[ \t\n]")))
+	    (goto-char (point-min))
+	    (forward-line 1)
+	    (while (re-search-forward regexp nil t)
+	      (goto-char (match-beginning 1))
+	      (delete-region (point) (match-end 1))
+	      (insert (car files))))
+	  (setq files (cdr files)
+		temps (cdr temps)))))))
+
+;;;; User commands	 
+
+(defun diff-mode ()
+  "Diff Mode is used by \\[diff] for perusing the output from the diff program.
+All normal editing commands are turned off.  Instead, these are available:
+\\<diff-mode-map>
+\\[diff-advertised-scroll-up]	Scroll to next screen of this difference.
+\\[diff-advertised-scroll-down]	Scroll to previous screen of this difference.
+\\[diff-next-difference]	Move to Next Difference.
+\\[diff-previous-difference]	Move to Previous Difference.
+\\[diff-show-difference]	Jump to difference specified by numeric position.
+\\[diff-find-file]	Find current diff in file
+\\[diff-find-file-other-window]	Find current diff in file in other window
+\\[diff-display-file]	Display file in other window
+\\[diff-narrow]	Narrow diff buffer to current difference
+\\[widen]	Widen diff buffer
+\\[diff-show-header]	Show diff header describing file name etc.
+\\[diff-quit]	Quit diff
+"
+  (interactive)
+  (use-local-map diff-mode-map)
+  (diff-grok-keymap)
+  (setq buffer-read-only t
+	major-mode 'diff-mode
+	mode-name "Diff"
+	mode-line-modified "--- "
+	mode-line-process
+	'(" " diff-current-difference "/" diff-total-differences))
+  (diff-parse-hunks)
+  (setq diff-total-differences (int-to-string diff-total-hunks)))
+
+;;; Motion commands
+
+(defun diff-next-difference (n)
+  "In diff-mode go the the beginning of the next difference hunk."
+  (interactive "p")
+  (if (zerop n)
+      (goto-char (diff-hunk-min diff-current-hunk))
+    (let ((narrow (diff-buffer-narrowed-p))
+	  (max (point-max))
+	  (min (point-min)))
+      (unwind-protect
+	  (progn
+	    (widen)
+	    (setq diff-current-hunk (+ n diff-current-hunk))
+	    (cond ((> diff-current-hunk diff-total-hunks)
+		   (setq diff-current-hunk diff-total-hunks)
+		   (message "No following difference hunks."))
+		  ((< diff-current-hunk 0)
+		   (setq diff-current-hunk 0)
+		   (message "No preceding difference hunks.")))
+	    (setq diff-current-difference (int-to-string diff-current-hunk)
+		  min (goto-char (diff-hunk-min diff-current-hunk))
+		  max (diff-hunk-max diff-current-hunk)))
+	(if narrow (narrow-to-region min max))))
+    (set-buffer-modified-p (buffer-modified-p))))
+
+(defun diff-previous-difference (n)
+  "In diff-mode go the the beginning of the previous difference hunk."
+  (interactive "p")
+  (diff-next-difference (- n)))
+
+(defun diff-next-line (n)
+  "In diff-mode go to the next line."
+  (interactive "p")
+  (condition-case nil
+      (next-line n)
+    (error (if (> n 0) (message "End of difference hunk"))))
+  (diff-update-modeline))
+
+(defun diff-previous-line (n)
+  "In diff-mode go to the previous line."
+  (interactive "p")
+  (diff-next-line (- n)))
+
+(defun diff-forward-char (n)
+  "In diff-mode move the point forward."
+  (interactive "p")
+  (forward-char n)
+  (diff-update-modeline))
+
+(defun diff-backward-char (n)
+  "In diff-mode move the point backward."
+  (interactive "p")
+  (backward-char n)
+  (diff-update-modeline))
+
+(defun diff-scroll-up (n)
+  "In diff-mode scroll the buffer up."
+  (interactive "P")
+  (scroll-up n)
+  (diff-update-modeline))
+
+(fset 'diff-advertised-scroll-up 'diff-scroll-up)
+
+(defun diff-scroll-down (n)
+  "In diff-mode scroll the buffer down."
+  (interactive "P")
+  (scroll-down n)
+  (diff-update-modeline))
+
+(fset 'diff-advertised-scroll-down 'diff-scroll-down)
+
+(defun diff-beginning-of-buffer (n)
+  "In diff-mode go to the beginning of the buffer."
+  (interactive "P")
+  (beginning-of-buffer n)
+  (diff-update-modeline))
+
+(defun diff-end-of-buffer (n)
+  "In diff-mode go to the end of the buffer."
+  (interactive "P")
+  (end-of-buffer n)
+  (diff-update-modeline))
+
+;;; The main command.
+
+;;;###autoload
+(defun diff (old new &optional switches)
+  "Find and display the differences between OLD and NEW files.
+Interactively you are prompted with the current buffer's file name for NEW
+and what appears to be its backup for OLD."
+  ;; Support for diffing directories is rather limited.  It needs work.
+  (interactive (diff-read-args "Diff original file (%s) "
+			       "Diff new file (%s) "
+			       "Switches for diff (%s) "
+			       (buffer-file-name)))
+  (setq switches (diff-fix-switches (or switches diff-switches))
+	old (expand-file-name old)
+	new (expand-file-name new))
+  (let ((curr-buff (current-buffer))
+	doing-dirs old-temp new-temp old-buffer new-buffer flag)
+    (let ((fdp-old (file-directory-p old))
+	  (fdp-new (file-directory-p new)))
+      (cond
+       ((null (or fdp-new fdp-old)))
+       ((null fdp-new)
+	(setq old (expand-file-name (file-name-nondirectory new) old)))
+       ((null fdp-old)
+	(setq new (expand-file-name (file-name-nondirectory old) new)))
+       (t (setq doing-dirs t))))
+;;    (message "diff %s %s %s..."
+;;	     (mapconcat (function identity) switches " ") new old)
+    (message "diff %s %s %s..."
+	     (mapconcat (function identity) switches " ") old new)
+    (if doing-dirs
+	(setq diff-old-file nil
+	      diff-new-file nil)
+      (setq old-temp (make-temp-name (concat diff-temp-template "1"))
+	    new-temp (make-temp-name (concat diff-temp-template "2"))
+	    old-buffer (diff-get-file-buffer old)
+	    new-buffer (diff-get-file-buffer new)
+	    diff-old-file (cons old (cdr old-buffer))
+	    diff-new-file (cons new (cdr new-buffer))))
+    (let (case-fold-search)
+      (mapcar (function
+	       (lambda (x)
+		 (if (string-match "[ecu]" x)
+		     (setq flag (aref x (match-beginning 0))))))
+	      switches))
+    (unwind-protect
+	(let ((patterns (assq flag diff-search-pattern-alist)))
+	  (set-buffer (get-buffer-create "*Diff Output*"))
+	  (setq default-directory (file-name-directory new)
+		diff-old-file-pattern (nth 2 patterns)
+		diff-new-file-pattern (nth 3 patterns)
+		diff-hunk-pattern (nth 1 patterns))
+	  (let (buffer-read-only)
+	    (if (fboundp 'buffer-disable-undo)
+		(buffer-disable-undo (current-buffer))
+	      ;; old style (Emacs 18.55 and earlier)
+	      (buffer-disable-undo (current-buffer)))
+	    (widen)
+	    (erase-buffer)
+	    (if doing-dirs
+		(progn
+		  (diff-run-diff switches old old new new)
+		  (setq diff-hunk-pattern (concat diff-hunk-pattern
+						  "\\|^Only in ")))
+	      (save-excursion
+		(set-buffer (car old-buffer))
+		(write-region (point-min) (point-max) old-temp nil 'quiet)
+		(set-buffer (car new-buffer))
+		(write-region (point-min) (point-max) new-temp nil 'quiet))
+	      (diff-run-diff switches old old-temp new new-temp))
+	    ;; Need to replace file names
+	    (if (and (not doing-dirs) (memq flag '(?c ?u)))
+		(diff-fix-file-names old old-temp new new-temp
+				     diff-hunk-pattern))
+	    (diff-mode)
+	    (goto-char (point-min))
+	    (setq diff-current-difference "0"
+		  diff-current-hunk 0)
+	    (if (zerop diff-total-hunks)
+		(progn
+		  (diff-cleanup-buffers)
+		  (message "No differences"))
+	      (if diff-do-narrow (narrow-to-region (point) (diff-hunk-max 0)))
+	      (display-buffer (current-buffer))
+	      (message "%s difference hunk%s" diff-total-differences
+		       (if (= diff-total-hunks 1) "" "s")))))
+      (condition-case nil
+	  (delete-file old-temp)
+	(error nil))
+      (condition-case nil
+	  (delete-file new-temp)
+	(error nil))
+      (set-buffer curr-buff))))
+
+;;;###autoload
+(defun diff-backup (file &optional switches)
+  "Diff this file with its backup file or vice versa.
+Uses the latest backup, if there are several numerical backups.
+If this file is a backup, diff it with its original.
+The backup file is the first file given to `diff'."
+  (interactive (list (read-file-name "Diff (file with backup): ")
+		     (and current-prefix-arg
+			  (diff-read-switches "Diff switches: "))))
+  (let (bak ori)
+    (if (backup-file-name-p file)
+	(setq bak file
+	      ori (file-name-sans-versions file))
+      (setq bak (or (diff-latest-backup-file file)
+		    (error "No backup found for %s" file))
+	    ori file))
+    (diff bak ori switches)))
+
+(defun diff-show-difference (n)
+  "Show difference number N (prefix argument)."
+  (interactive "p")
+  (let ((narrowedp (diff-buffer-narrowed-p))
+	(min (diff-hunk-min diff-current-hunk))
+	(max (diff-hunk-max diff-current-hunk)))
+    (unwind-protect
+	(progn
+	  (widen)
+	  (cond
+	   ((< n 0)
+	    (message "No negative hunks.")
+	    (setq n 0))
+	   ((> n diff-total-hunks)
+	    (message "No hunk %d." n)
+	    (setq n diff-total-hunks)))
+	  (setq diff-current-hunk n
+		diff-current-difference (int-to-string diff-current-hunk)
+		min (diff-hunk-min n)
+		max (diff-hunk-max n))
+	  (goto-char min))
+      (if narrowedp (narrow-to-region min max))
+      (set-buffer-modified-p (buffer-modified-p)))))
+
+(defun diff-show-header ()
+  "Show `diff-header'."
+  (interactive)
+  (with-output-to-temp-buffer "*Diff Header*"
+    (princ (save-restriction
+	     (widen)
+	     (buffer-substring (diff-hunk-min 0) (diff-hunk-max 0))))))
+
+
+(defun diff-find-file (old-file-p)
+  "Visit diffed file, at the point corresponding to the current hunk.
+Default is to visit the new file; prefix means visit old file instead."
+  (interactive "P")
+  (let ((line (diff-file-line old-file-p)))
+    (find-file 
+     (if old-file-p
+	 (car diff-old-file)
+       (car diff-new-file)))
+    (goto-line line)
+    (recenter 0)))
+
+(defun diff-find-file-other-window (old-file-p)
+  "Visit the diffed file in other window, with the point at the current hunk.
+Default is to visit the new file; prefix means visit the old file instead."
+  (interactive "P")
+  (let ((line (diff-file-line old-file-p)))
+    (find-file-other-window
+     (if old-file-p
+	 (car diff-old-file)
+       (car diff-new-file)))
+    (goto-line line)
+    (recenter 0)))
+
+(defun diff-find-file-other-frame (old-file-p)
+  "Visit the diffed file in other frame, with point at the current hunk.
+Default is to visit the new file; prefix means visit the old file instead."
+  (interactive "P")
+  (let ((line (diff-file-line old-file-p)))
+    (find-file-other-frame
+     (if old-file-p
+	 (car diff-old-file)
+       (car diff-new-file)))
+    (goto-line line)
+    (recenter 0)))
+
+(defun diff-display-file (old-file-p)
+  "Display the diffed file in other window, with point at the current hunk.
+Default is to visit the new file; prefix means visit the old file instead."
+  (interactive "P")
+  (let ((line (diff-file-line old-file-p))
+	(wind (display-buffer (find-file-noselect (if old-file-p
+						      (car diff-old-file)
+						    (car diff-new-file)))))
+	(curr-wind (selected-window)))
+    (unwind-protect
+	(progn
+	  (select-window wind)
+	  (goto-line line)
+	  (recenter 0))
+      (select-window curr-wind))))
+
+(defun diff-quit ()
+  "Quit diff by killing the diff buffer."
+  (interactive)
+  (kill-buffer "*Diff Output*")
+  (diff-cleanup-buffers))
+
+(defun diff-narrow ()
+  "Narrow diff buffer to current difference hunk."
+  (interactive)
+  (narrow-to-region (diff-hunk-min diff-current-hunk)
+		    (diff-hunk-max diff-current-hunk)))
+
+;;; Run any load hooks
+(run-hooks 'diff-load-hook)
+
+;;; end of diff.el
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; File:          dired-cmpr.el
+;; Dired Version: #Revision: 7.9 $
+;; RCS:
+;; Description:   Commands for compressing marked files.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; Requirements and provisions
+(provide 'dired-cmpr)
+(require 'dired)
+
+;;; Entry points.
+
+(defun dired-do-compress (&optional arg files)
+  "Compress or uncompress marked (or next ARG) files.
+With a zero prefix, prompts for a new value of `dired-compression-method'."
+  (interactive
+   (let ((arg (prefix-numeric-value current-prefix-arg))
+	 files)
+     (if (zerop arg)
+	 (let ((new (completing-read
+		     (format "Set compression method (currently %s): "
+			     dired-compression-method)
+		     (mapcar
+		      (function
+		       (lambda (x)
+			 (cons (symbol-name (car x)) nil)))
+		      dired-compression-method-alist)
+		     nil t)))
+	   (or (string-equal new "")
+	       (setq dired-compression-method (intern new))))
+       (setq files (dired-get-marked-files nil current-prefix-arg))
+       (or (memq 'compress dired-no-confirm)
+	   (let* ((dir (dired-current-directory))
+		  (rfiles (mapcar (function
+				   (lambda (fn)
+				     (dired-make-relative fn dir t)))
+				    files))
+		  (prompt "")
+		  (comp 0)
+		  (uncomp nil)
+		  (total (length files))
+		  elt)
+	     (mapcar (function
+		      (lambda (fn)
+			(if (listp (setq elt
+					 (dired-make-compressed-filename fn)))
+			    (let* ((method (car (nth 3 elt)))
+				   (count (assoc method uncomp)))
+			      (if count
+				  (setcdr count (1+ (cdr count)))
+				(setq uncomp (cons (cons method 1) uncomp))))
+			  (setq comp (1+ comp)))))
+		     files)
+	     (if (/= comp 0)
+		 (setq prompt
+		       (format "%s %d"
+			       (car
+				(nth 2
+				     (assq dired-compression-method
+					   dired-compression-method-alist)))
+			       comp)))
+	     (if uncomp
+		 (let ((case-fold-search t)
+		       method)
+		   (or (string-equal prompt "")
+		       (setq prompt (concat prompt "; ")))
+		   (setq uncomp
+			 (sort
+			  (mapcar
+			   (function
+			    (lambda (elt)
+			      (setq method (car elt))
+			      (if (string-equal method "gzip")
+				  (setq method "gunzip")
+				(or (string-match "^un" method)
+				    (setq method (concat "un" method))))
+			      (setcar elt method)
+			      elt))
+			   uncomp)
+			  (function
+			   (lambda (x y)
+			     (string< (car x) (car y))))))
+		   (setq prompt
+			 (concat prompt
+				 (mapconcat
+				  (function
+				   (lambda (elt)
+				     (format "%s %d" (car elt) (cdr elt))))
+				  uncomp ", ")))))
+	     (cond
+	      ((= (length rfiles) 1)
+	       (setq prompt (format "%s %s? "
+				    ;; Don't need the number 1
+				    (substring prompt 0 -2)
+				    (car rfiles))))
+	      ((or (> (length uncomp) 1) (and (/= 0 comp) uncomp))
+	       (setq prompt (format "%s? Total: %d file%s " prompt total
+				    (dired-plural-s total))))
+	      ((setq prompt (format "%s file%s? " prompt
+				    (dired-plural-s total)))))
+	     (or (dired-mark-pop-up nil 'compress rfiles 'y-or-n-p prompt)
+		 (setq arg 0)))))
+     (list arg files)))
+       
+  (if (not (zerop arg))
+      (dired-create-files
+       'dired-compress-file
+       "Compress or Uncompress"
+       files
+       (function
+	(lambda (fn)
+	  (let ((cfn (dired-make-compressed-filename fn)))
+	    (if (stringp cfn)
+		cfn
+	      (substring fn 0 (- (length (nth 1 cfn))))))))
+       dired-keep-marker-compress nil t)))
+
+(defun dired-compress-subdir-files (&optional uncompress)
+  "Compress all uncompressed files in the current subdirectory.
+With a prefix argument uncompresses all compressed files."
+  (interactive "P")
+  (let ((dir (dired-current-directory))
+	files methods uncomp elt)
+    (save-excursion
+      (save-restriction
+	(narrow-to-region (dired-subdir-min) (dired-subdir-max))
+	(dired-map-dired-file-lines
+	 (function
+	  (lambda (f)
+	    (if uncompress
+		(and (listp (setq uncomp (dired-make-compressed-filename f)))
+		     (let ((program (car (nth 3 uncomp))))
+		       (setq files (cons f files))
+		       (if (setq elt (assoc program methods))
+			   (setcdr elt (1+ (cdr elt)))
+			 (setq methods (cons (cons program 1) methods)))))
+	      (and (stringp (dired-make-compressed-filename f))
+		   (setq files (cons f files)))))))))
+    (if files
+	(let ((total (length files))
+	      (rfiles (mapcar
+		       (function
+			(lambda (fn)
+			  (dired-make-relative fn dir t)))
+		       files))
+	      prompt)
+	  (if uncompress
+	      (progn
+		(setq prompt (mapconcat
+			      (function
+			       (lambda (x)
+				 (format "%s %d"
+					 (if (string-equal (car x) "gzip")
+					     "gunzip"
+					   (if (string-match "^un" (car x))
+					       (car x)
+					     (concat "un" (car x))))
+					 (cdr x))))
+			      methods ", "))
+		(cond
+		 ((= total 1)
+		  (setq prompt
+			(concat (substring prompt 0 -1) (car rfiles) "? ")))
+		 ((= (length methods) 1)
+		  (setq prompt
+			(format "%s file%s? " prompt (dired-plural-s total))))
+		 (t
+		  (setq prompt (format "%s? Total: %d file%s " prompt total
+				       (dired-plural-s total))))))
+	    (setq prompt
+		  (if (= total 1)
+		      (format "%s %s? " dired-compression-method (car rfiles))
+		    (format "%s %d file%s? "
+			    dired-compression-method total
+			    (dired-plural-s total)))))
+	  (if (dired-mark-pop-up nil 'compress rfiles 'y-or-n-p prompt)
+	      (dired-create-files
+	       'dired-compress-file
+	       "Compress or Uncompress"
+	       files
+	       (function
+		(lambda (fn)
+		  (let ((cfn (dired-make-compressed-filename fn)))
+		    (if (stringp cfn)
+			cfn
+		      (substring fn 0 (- (length (nth 1 cfn))))))))
+	       dired-keep-marker-compress nil t)))
+      (message "No files need %scompressing in %s."
+	       (if uncompress "un" "")
+	       (dired-abbreviate-file-name dir)))))
+
+(defun dired-compress-file (file ok-flag)
+  ;; Compress or uncompress FILE.
+  ;; If ok-flag is non-nil, it is OK to overwrite an existing
+  ;; file. How well this actually works may depend on the compression
+  ;; program.
+  ;; Return the name of the compressed or uncompressed file.
+  (let ((handler (find-file-name-handler file 'dired-compress-file)))
+    (if handler
+	(funcall handler 'dired-compress-file file ok-flag)
+      (let ((compressed-fn (dired-make-compressed-filename file))
+	    (err-buff (get-buffer-create " *dired-check-process output*")))
+	(save-excursion
+	  (set-buffer err-buff)
+	  (erase-buffer)
+	  (cond ((file-symlink-p file)
+		 (signal 'file-error (list "Error compressing file"
+					   file "a symbolic link")))
+		((listp compressed-fn)
+		 (message "Uncompressing %s..." file)
+		 (let* ((data (nth 3 compressed-fn))
+			(ret
+			 (apply 'call-process
+				(car data) file t nil
+				(append (cdr data)
+					(and ok-flag
+					     (list (nth 4 compressed-fn)))
+					(list file)))))
+		   (if (or (and (integerp ret) (/= ret 0))
+			   (not (bobp)))
+		       (signal 'file-error
+			       (nconc
+				(list "Error uncompressing file"
+				      file)
+				(and (not (bobp))
+				     (list
+				      (progn
+					(goto-char (point-min))
+					(buffer-substring
+					 (point) (progn (end-of-line)
+							(point))))))))))
+		 (message "Uncompressing %s...done" file)
+		 (dired-remove-file file)
+		 (let ((to (substring file 0
+				      (- (length (nth 1 compressed-fn))))))
+		   ;; rename any buffers
+		   (and (get-file-buffer file)
+			(save-excursion
+			  (set-buffer (get-file-buffer file))
+			  (let ((modflag (buffer-modified-p)))
+			    ;; kills write-file-hooks
+			    (set-visited-file-name to)	
+			    (set-buffer-modified-p modflag))))
+		   to))
+		((stringp compressed-fn)
+		 (message "Compressing %s..." file)
+		 (let* ((data (assq dired-compression-method
+				    dired-compression-method-alist))
+			(compr-args (nth 2 data))
+			(ret
+			 (apply 'call-process
+				(car compr-args) file t nil
+				(append (cdr compr-args)
+					(and ok-flag
+					     (list (nth 4 data)))
+					(list file)))))
+		   (if (or (and (integerp ret) (/= ret 0))
+			   (not (bobp)))
+		       (signal 'file-error
+			       (nconc
+				(list "Error compressing file"
+				      file)
+				(and (not (bobp))
+				     (list
+				      (progn
+					(goto-char (point-min))
+					(buffer-substring
+					 (point) (progn (end-of-line)
+							(point))))))))))
+		 (message "Compressing %s...done" file)
+		 (dired-remove-file file)
+		 ;; rename any buffers
+		 (and (get-file-buffer file)
+		      (save-excursion
+			(set-buffer (get-file-buffer file))
+			(let ((modflag (buffer-modified-p)))
+			  ;; kills write-file-hooks
+			  (set-visited-file-name compressed-fn)	
+			  (set-buffer-modified-p modflag))))
+		 compressed-fn)
+		(t (error "Strange error in dired-compress-file."))))))))
+
+(defun dired-make-compressed-filename (name &optional method)
+  ;; If NAME is in the syntax of a compressed file (according to
+  ;; dired-compression-method-alist), return the data (a list) from this
+  ;; alist on how to uncompress it. Otherwise, return a string, the
+  ;; compressed form of this file name. This is computed using the optional
+  ;; argument METHOD (a symbol). If METHOD is nil, the ambient value of
+  ;; dired-compression-method is used.
+  (let ((handler (find-file-name-handler
+		  name 'dired-make-compressed-filename)))
+    (if handler
+	(funcall handler 'dired-make-compressed-filename name method)
+      (let ((alist dired-compression-method-alist)
+	    (len (length name))
+	    ext ext-len result)
+	(while alist
+	  (if (and (> len
+		      (setq ext-len (length (setq ext (nth 1 (car alist))))))
+		   (string-equal ext (substring name (- ext-len))))
+	      (setq result (car alist)
+		    alist nil)
+	    (setq alist (cdr alist))))
+	(or result
+	    (concat name
+		    (nth 1 (or (assq (or method dired-compression-method)
+				     dired-compression-method-alist)
+			       (error "Unknown compression method: %s"
+				      (or method dired-compression-method))))))
+	))))
+
+;;; end of dired-cmpr.el
+;; -*-Emacs-Lisp-*-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; File:           dired-diff.el
+;; RCS:
+;; Dired Version:  #Revision: 7.9 $
+;; Description:    Support for diff and related commands.
+;; Author:         Sandy Rutherford <sandy@ibm550.sissa.it>
+;; Created:        Fri Jun 24 08:50:20 1994 by sandy on ibm550
+;; 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 1, or (at your option)
+;;; any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; A copy of the GNU General Public License can be obtained from this
+;;; program's author (send electronic mail to sandy@ibm550.sissa.it) or
+;;; from the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+;;; MA 02139, USA.
+
+(provide 'dired-diff)
+(require 'dired)
+
+(defvar emerge-last-dir-input)
+(defvar emerge-last-dir-output)
+(defvar emerge-last-dir-ancestor)
+(defvar diff-switches)
+
+(defun dired-diff-read-file-name (prompt)
+  ;; Read and return a file name for diff.
+  (let* ((mark-active t)
+	 (default (and (mark)
+		       (save-excursion
+			 (goto-char (mark))
+			 (dired-get-filename nil t)))))
+    (read-file-name (format "%s %s with: %s"
+			    prompt (dired-get-filename 'no-dir)
+			    (if default
+				(concat "["
+					(dired-make-relative
+					 default
+					 (dired-current-directory) t)
+					"] ")
+			      ""))
+		    (default-directory) default t)))
+
+(defun dired-diff-read-switches (switchprompt)
+  ;; Read and return a list of switches
+  (or (boundp 'diff-switches)
+      (require 'diff)) ; Make sure that `diff-switches' is defined.
+  (let* ((default (if (listp diff-switches)
+		      (mapconcat 'identity diff-switches " ")
+		    diff-switches))
+	 (switches
+	  (read-string (format switchprompt default) default)))
+    (let (result (start 0))
+      (while (string-match "\\(\\S-+\\)" switches start)
+	(setq result (cons (substring switches (match-beginning 1)
+				      (match-end 1))
+			   result)
+	      start (match-end 0)))
+      (nreverse result))))
+
+(defun dired-diff (file &optional switches)
+  "Compare file at point with file FILE using `diff'.
+FILE defaults to the file at the mark.
+The prompted-for file is the first file given to `diff'.
+With a prefix allows the switches for the diff program to be edited."
+  (interactive
+   (list
+    (dired-diff-read-file-name "Diff") 
+    (and current-prefix-arg (dired-diff-read-switches "Options for diff: "))))
+  (if switches
+      (diff file (dired-get-filename) switches)
+    (diff file (dired-get-filename))))
+
+(defun dired-backup-diff (&optional switches)
+  "Diff this file with its backup file or vice versa.
+Uses the latest backup, if there are several numerical backups.
+If this file is a backup, diff it with its original.
+The backup file is the first file given to `diff'."
+  (interactive (list (and current-prefix-arg
+			  (dired-diff-read-switches "Diff with switches: "))))
+  (if switches
+      (diff-backup (dired-get-filename) switches)
+    (diff-backup (dired-get-filename))))
+
+(defun dired-emerge (arg file out-file)
+  "Merge file at point with FILE using `emerge'.
+FILE defaults to the file at the mark."
+  (interactive
+   (let ((file (dired-diff-read-file-name "Merge")))
+     (list
+      current-prefix-arg
+      file
+      (and current-prefix-arg (emerge-read-file-name
+			       "Output file"
+			       emerge-last-dir-output
+			       (dired-abbreviate-file-name file) file)))))
+  (emerge-files arg file (dired-get-filename) out-file))
+
+(defun dired-emerge-with-ancestor (arg file ancestor file-out)
+  "Merge file at point with FILE, using a common ANCESTOR file.
+FILE defaults to the file at the mark."
+  (interactive
+   (let ((file (dired-diff-read-file-name "Merge")))
+     (list
+      current-prefix-arg
+      file
+      (emerge-read-file-name "Ancestor file" emerge-last-dir-ancestor nil file)
+      (and current-prefix-arg (emerge-read-file-name
+			       "Output file"
+			       emerge-last-dir-output
+			       (dired-abbreviate-file-name file) file)))))
+  (emerge-files-with-ancestor arg file (dired-get-filename)
+			      ancestor file-out))
+
+(defun dired-ediff (file)
+  "Ediff file at point with FILE.
+FILE defaults to the file at the mark."
+  (interactive (list (dired-diff-read-file-name "Ediff")))
+  (ediff-files file (dired-get-filename)))
+
+(defun dired-epatch (file)
+  "Patch file at point using `epatch'."
+  (interactive
+   (let ((file (dired-get-filename)))
+     (list
+      (and (or (memq 'patch dired-no-confirm)
+	       (y-or-n-p (format "Patch %s? "
+				(file-name-nondirectory file))))
+	   file))))
+  (if file
+      (ediff-patch-file file)
+    (message "No file patched.")))
+
+;;; Autoloads
+
+;;; Diff (diff)
+
+(autoload 'diff "diff" "Diff two files." t)
+(autoload 'diff-backup "diff"
+	  "Diff this file with its backup or vice versa." t)
+
+;;; Emerge
+
+(autoload 'emerge-files "emerge" "Merge two files." t)
+(autoload 'emerge-files-with-ancestor "emerge"
+	 "Merge two files having a common ancestor." t)
+(autoload 'emerge-read-file-name "emerge")
+
+;; Ediff
+
+(autoload 'ediff-files "ediff" "Ediff two files." t)
+(autoload 'ediff-patch-file "ediff" "Patch a file." t)
+
+;;; end of dired-diff.el
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; File:          dired-faces.el
+;; Dired Version: #Revision: 7.9 $
+;; RCS:
+;; Description:   rudimentary face customization support for dired
+;; Author:        Mike Sperber <sperber@informatik.uni-tuebingen.de>
+;; 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(provide 'dired-faces)
+
+(require 'custom)
+(require 'dired)
+
+;;; Variables
+
+(defgroup dired-faces nil
+  "Dired faces."
+  :group 'dired)
+
+(defcustom dired-do-highlighting t
+  "Set if we should use highlighting according to filetype."
+  :type 'boolean
+  :group 'dired)
+
+(defcustom dired-do-interactive-permissions t
+  "Set if we should allow interactive chmod."
+  :type 'boolean
+  :group 'dired)
+
+(defface dired-face-marked '((((class color))
+			       (:background "PaleVioletRed"))
+			     (t (:underline t)))
+  "Face used for marked files."
+  :group 'dired)
+
+(defface dired-face-flagged '((((class color))
+			       (:background "LightSlateGray"))
+			      (t (:underline t)))
+  "Face used for flagged files."
+  :group 'dired)
+
+(defface dired-face-directory '((t (:bold t)))
+  "Face used for directories."
+  :group 'dired)
+
+(defface dired-face-executable '((((class color))
+				  (:foreground "SeaGreen"))
+				 (t (:bold t)))
+  "Face used for executables."
+  :group 'dired)
+
+(defface dired-face-setuid '((((class color))
+			      (:foreground "Red"))
+			     (t (:bold t)))
+  "Face used for setuid executables."
+  :group 'dired)
+
+(defface dired-face-boring '((((class color))
+			      (:foreground "Gray65"))
+			     (((class grayscale))
+			      (:foreground "Gray65")))
+  "Face used for unimportant files."
+  :group 'dired)
+
+(defface dired-face-permissions '((t (:background "grey75"
+				      :foreground "black")))
+  "Face used for interactive permissions."
+  :group 'dired)
+
+(defface dired-face-socket '((((class color))
+			      (:foreground "magenta"))
+			     (t (:bold nil)))
+  "Face used to indicate sockets."
+  :group 'dired)
+
+(defface dired-face-symlink  '((((class color))
+			      (:foreground "cyan"))
+			     (t (:bold t)))
+  "Face used to indicate symbolic links."
+  :group 'dired)
+
+;;; end of dired-faces.el
+;; -*-Emacs-Lisp-*-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; File:           dired-grep.el
+;; RCS:
+;; Dired Version:  #Revision: 7.9 $
+;; Description:    Support for running grep on marked files in a dired buffer.
+;; Author:         Sandy Rutherford <sandy@ibm550.sissa.it>
+;; Created:        Tue Jul 13 22:59:37 1993 by sandy on ibm550
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; Copyright (C) 1993 Sandy Rutherford
+
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 1, or (at your option)
+;;; any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; A copy of the GNU General Public License can be obtained from this
+;;; program's author (send electronic mail to sandy@ibm550.sissa.it) or
+;;; from the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+;;; MA 02139, USA.
+
+;;; The user-level command in this file is dired-grep-file. The command
+;;; grep is defined in compile.el. This file does not change that command.
+
+;;; Requirements and provisions
+
+(provide 'dired-grep)
+(or (fboundp 'file-local-copy) (require 'emacs-19))
+(or (fboundp 'generate-new-buffer) (require 'emacs-19))
+(require 'dired)
+
+;;; Variables
+
+(defvar dired-grep-program "grep"
+  "Name of program to use to grep files.
+When used with the \"-n\" flag, program must precede each match with \"###:\",
+where \"###\" is the line number of the match.
+If there are grep programs which don't do this, we'll try to think of
+some way to accomodate them.")
+
+(defvar dired-grep-switches nil
+  "*Switches to pass to the grep program.
+This may be either a string or a list of strings.  It is not necessary to 
+include \"-n\" as that switch is always used.")
+
+(defvar dired-grep-zcat-program "zcat"
+  "Name of program to cat compressed files.")
+
+(defvar dired-grep-compressed-file ".\\.\\(gz\\|[zZ]\\)$"
+  "Regexp to match names of compressed files.")
+
+(defvar dired-grep-pop-up-buffer t
+  "*If non-nil, the grep output is displayed in the other window upon
+completion of the grep process.")
+
+(defvar dired-grep-results-buffer "*Dired Grep*"
+  "Name of buffer where grep results are logged.")
+
+(defvar dired-grep-mode-hook nil
+  "Hook run after going into grep-mode")
+
+(defvar grep-history nil
+  "History of previous grep patterns used.")
+
+(defvar dired-grep-parse-flags-cache nil)
+(defvar dired-grep-parse-flags-cache-result nil)
+
+(defvar dired-grep-mode-map nil
+  "Keymap for dired-grep-mode buffers.")
+
+(if dired-grep-mode-map
+    ()
+  (setq dired-grep-mode-map (make-keymap))
+  (suppress-keymap dired-grep-mode-map)
+  (define-key dired-grep-mode-map "[" 'backward-page)
+  (define-key dired-grep-mode-map "]" 'forward-page)
+  (define-key dired-grep-mode-map ">" 'dired-grep-next-hit)
+  (define-key dired-grep-mode-map "<" 'dired-grep-previous-hit)
+  (define-key dired-grep-mode-map "n" 'dired-grep-advertized-next-hit)
+  (define-key dired-grep-mode-map "p" 'dired-grep-advertized-previous-hit)
+  (define-key dired-grep-mode-map "k" 'dired-grep-delete-line)
+  (define-key dired-grep-mode-map "d" 'dired-grep-delete-page)
+  (define-key dired-grep-mode-map "^" 'dired-grep-delete-preceding-pages)
+  (define-key dired-grep-mode-map "f" 'dired-grep-find-file)
+  (define-key dired-grep-mode-map "e" 'dired-grep-find-file)
+  (define-key dired-grep-mode-map "m" 'dired-grep-delete-misses)
+  (define-key dired-grep-mode-map "o" 'dired-grep-find-file-other-window)
+  (define-key dired-grep-mode-map "v" 'dired-grep-view-file)
+  (define-key dired-grep-mode-map "w" 'dired-grep-delete-grep-for)
+  (define-key dired-grep-mode-map "\C-_" 'dired-grep-undo)
+  (define-key dired-grep-mode-map "\C-xu" 'dired-grep-undo))
+
+;;; Entry functions from dired.el
+
+(defun dired-grep (pattern flags)
+  ;; grep the file on the current line for PATTERN, using grep flags FLAGS.
+  ;; Return nil on success. Offending filename otherwise.
+  (let* ((file (dired-get-filename))
+	 (result (dired-grep-file pattern file flags)))
+    (and result
+	 (progn
+	   (dired-log (buffer-name (current-buffer)) (concat result "\n"))
+	   file))))
+
+(defun dired-do-grep (pattern &optional flags arg)
+  "Grep marked files for a pattern. With a \C-u prefix prompts for grep flags."
+  (interactive
+   (let* ((switches (if (consp current-prefix-arg)
+			(read-string "Switches for grep: ")
+		      dired-grep-switches))
+	  (prompt (format "grep %sfor pattern"
+			  (if (stringp switches)
+			      (if (string-equal switches "")
+				  switches
+				(concat switches " "))
+			    (if switches
+				(concat (mapconcat 'identity switches " ") " ")
+			      ""))))
+	  (pattern (dired-read-with-history (concat prompt ": ")
+					    nil 'grep-history)))
+     (list pattern switches
+	   (and (not (consp current-prefix-arg)) current-prefix-arg))))
+  (dired-map-over-marks-check
+   (function
+    (lambda ()
+      (dired-grep pattern flags)))
+   arg 'grep (concat "grep " flags (if flags " \"" "\"") pattern "\"") t))
+
+;;; Utility functions
+
+(defun dired-grep-get-results-buffer ()
+  ;; Return the buffer object of the dired-grep-results-buffer, creating and
+  ;; initializing it if necessary.
+  (let ((buffer (get-buffer dired-grep-results-buffer)))
+    (or buffer
+	 (save-excursion
+	   (set-buffer (setq buffer (get-buffer-create dired-grep-results-buffer)))
+	   (dired-grep-mode)
+	   buffer))))
+
+;; Only define if undefined, in case efs has got to it already.
+(or (fboundp 'dired-grep-delete-local-temp-file)
+    (defun dired-grep-delete-local-temp-file (file)
+      (condition-case nil (delete-file file) (error nil))))
+
+;;; Commands in the dired-grep-results-buffer buffer.
+
+(defun dired-grep-mode ()
+  "\\<dired-grep-mode-map>Mode for perusing grep output generated from dired.
+The output is divided into pages, one page per grepped file.
+
+Summary of commands:
+
+Move to next grep hit                     \\[dired-grep-advertized-next-hit], \\[dired-grep-next-hit]
+Move to previous grep hit                 \\[dired-grep-advertized-previous-hit], \\[dired-grep-previous-hit]
+Move to output for next file              \\[forward-page]
+Move to output for previous file          \\[backward-page]
+
+Delete the current grep line              \\[dired-grep-delete-line]
+Delete all output for current file        \\[dired-grep-delete-page]
+Delete all preceding pages                \\[dired-grep-delete-preceding-pages]
+Delete all pages for files with no hits   \\[dired-grep-delete-misses]
+Delete all pages which grep for the 
+  same pattern as the current page        \\[dired-grep-delete-grep-for]
+
+Find current grep hit in file             \\[dired-grep-find-file]
+Find current grep hit in other window     \\[dired-grep-find-file-other-window]
+View current grep hit                     \\[dired-grep-view-file]
+
+Undo changes to the grep buffer           \\[dired-grep-undo]
+
+Keybindings:
+\\{dired-grep-mode-map}"
+  (kill-all-local-variables)
+  (use-local-map dired-grep-mode-map)
+  (setq major-mode 'dired-grep-mode
+	mode-name "Dired-Grep"
+	buffer-read-only t)
+  (set (make-local-variable 'page-delimiter) "\n\n")
+  (run-hooks 'dired-grep-mode-hook))
+
+(defun dired-grep-current-file-and-line ()
+  ;; Returns a list \(FILENAME . LINE\) corresponding to the filename
+  ;; and line number associated with the position of the point in a
+  ;; grep buffer. Returns nil if there is none.
+  (save-excursion
+    (let (file line)
+      (and
+       (progn
+	 (beginning-of-line)