Xref: utzoo comp.emacs:9571 gnu.emacs.help:378 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!think.com!samsung!munnari.oz.au!comp.vuw.ac.nz!byrd From: Mike.Williams@comp.vuw.ac.nz (Mike Williams) Newsgroups: comp.emacs,gnu.emacs.help Subject: Re: Changing dired functions without copying Message-ID: Date: 21 Nov 90 02:33:58 GMT References: <1990Nov20.211322.11306@julius.cs.uiuc.edu> Sender: news@comp.vuw.ac.nz (News Admin) Organization: Dept. of Computer Science, Victoria Uni. of Wellington, NZ. Lines: 35 Nntp-Posting-Host: embassy.comp.vuw.ac.nz In-Reply-To: sane@cs.uiuc.edu's message of 20 Nov 90 21:13:22 GMT +-- sane@cs.uiuc.edu (Aamod Sane) writes: | | I wanted to change dired functions such as dired-find-file to work | with epoch. I have right now altered them in my own copy of dired.el. | | The reason is that if I just put them in the .emacs, they | get overwritten when dired.el get loaded later. | | 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? 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: (setq dired-mode-hook 'dired-mode-hook) (autoload 'dired-mode-hook "dired-setup") Note that the 'dired-mode-hook function doesn't actually have to do anything - it's primary purpose is to act as a autoload trigger. This is a general technique for loading mode-specific setup code. For key bindings, function re-definitions etc., it's better than putting them inside a mode-hook, as the code is only run once. Also, you can ensure that your setup code is only run *after* loading dired, by putting (require 'dired) at the top of the dired-setup.el file. -- /-------------------- byrd@comp.vuw.ac.nz --------------------\ | Mike Williams, Victoria University of Wellington, Aotearoa. | \-------- Yesterday, I ... no, wait, that wasn't me. ---------/