Xref: utzoo comp.emacs:9572 gnu.emacs.help:379 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!mercury.cair.du.edu!pikes!uakari.primate.wisc.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!julius.cs.uiuc.edu!liberte From: liberte@cs.uiuc.edu (Daniel LaLiberte) Newsgroups: comp.emacs,gnu.emacs.help Subject: Re: Changing dired functions without copying Message-ID: Date: 21 Nov 90 02:56:17 GMT References: <1990Nov20.211322.11306@julius.cs.uiuc.edu> Sender: news@julius.cs.uiuc.edu (USENet News) Organization: University of Illinois, Urbana-Champaign, Dept CS Lines: 48 In-Reply-To: Mike.Williams@comp.vuw.ac.nz's message of 21 Nov 90 02:33:58 GMT The problem of "shadowing" function definitions in emacs has not been solved in a publically standard way yet. I propose a solution below. Here is the problem: +-- sane@cs.uiuc.edu (Aamod Sane) writes: | Is there a way of catching the loading of dired, and then executing | these function definitions so that I do not have to make a copy | of dired.el? From: Mike.Williams@comp.vuw.ac.nz (Mike Williams) What I do is to put the dired-mode setup code in a separate file (eg. dired-setup.el). Along with all the setup stuff, I define the function 'dired-mode-hook. It's then quite easy to get this function (and hence the rest of the setup file) to autoload when dired is first used, like so: ----- A more general scheme of "shadowing" definitions than depending on a -hook for each file would be something like the following: 1. Name your file of shadow definitions with the same name as the file with the standard definitions, but put it in a different directory that is earlier on your load-path. Thus it will be loaded first. 2. At the top of your shadow definitions, do the following: (require 'shadow) (shadow-load) 3. Follow with your shadow definitions. The shadow-load function should temporarily modify the load-path to exclude all the directories up to the directory that the current file is in, and then just do load again on the same file name. Unfortunately, the file name and directory of the file being loaded is not available, so the load function itself will have to be shadowed too to provide this information, or the call of shadow-load could provide this explicitly - with less portability, e.g. (shadow-load "foo-mode" "my-stuff"). I invite comments on this scheme, or the problem in general. Dan LaLiberte uiucdcs!liberte liberte@cs.uiuc.edu liberte%a.cs.uiuc.edu@uiucvmd.bitnet