home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.help
- Path: sparky!uunet!pipex!demon!edscom!kevin
- From: kevin@edscom.demon.co.uk (Kevin Broadey)
- Subject: How do I subvert a function?
- Message-ID: <KEVIN.92Sep4100146@runningbear.edscom.demon.co.uk>
- Sender: kevin@edscom.demon.co.uk (Kevin Broadey)
- Organization: EDS-Scicon, Milton Keynes, UK
- Distribution: gnu
- Date: Fri, 4 Sep 1992 10:01:46 GMT
- Lines: 43
-
- I'd like to be able to replace an elisp function with one I've written
- myself while keeping hold of the original.
-
- The reason for this is that I want to modify the function's behaviour
- slightly without upsetting the other Emacs users on my site and without
- the bother of having a private copy of the entire .el file.
-
- I tried doing this:-
-
- ;; original.el
-
- ...
-
- (defun original ()
- ...)
-
-
-
- ;; subvert.el
-
- (fset 'old-original 'original)
-
- (defun original ()
- (old-original)
- ;; modify behaviour here
- ...)
-
-
- The trouble is that (defun original ()...) also affects the function
- definition of `old-original', presumably because both symbols are
- pointing to the same definition cell, and it is the cell rather than the
- pointer that gets hacked by defun.
-
- Needless to say, this makes my function crawl up the stack at an
- alarming rate!
-
- So, how do I save a function definition. Is there a `purecopy' for
- functions?
- --
- Kevin Broadey <kbroadey@edscom.demon.co.uk>
- EDS-Scicon, Wavendon Tower, Wavendon, Milton Keynes, MK17 8LX, England.
- Phone: +44 908 284198 (direct) or +44 908 585858 ext 4198
- These opinions are mine: others available on request.
-