Article View: gnu.emacs.bug
Article #98696emacs crash when funcalling autoload
From: 128a-2hy
Date: Sun, 10 Mar 1991 09:07
Date: Sun, 10 Mar 1991 09:07
31 lines
1879 bytes
1879 bytes
After running the code
(let ((original-fortran-mode (symbol-function 'fortran-mode)))
(fset 'fortran-mode
(list 'lambda '()
(quote (interactive))
(list 'funcall (list 'quote original-fortran-mode))
'(abbrev-mode 1))))
which sets the function cell of 'fortran-mode to look like
(lambda ()
(funcall <old definition of fortran-mode>)
(abbrev-mode 1))
saying M-x fortran-mode crashes emacs with a segmentation
fault. The problem is that the old definition of fortran-mode
is an autoload expression, and emacs doesn't like
(funcall '(autoload ....))
The fix is to make the autoload function put something into
the function cell of the autoloaded symbol that can actually
be funcalled (a special kind of lambda expression, I guess).
The goal of the above example was to make the fortran-mode
command turn on abbrev mode automatically. It's not possible
to do this in the obvious way using fortran-mode-hook, because
the fortran-mode command actually
1) runs the hook, setting abbrev-mode
2) changes the buffer's major mode, clearing abbrev-mode.
Some general improvement to make this kind of thing possible
would be nice, but I'm not sure quite what to suggest.
Technical Details
Message-ID:
<9103100907.AA07037@weaver.berkeley.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbageShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,6662fc5c41d49e60,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-03-10 01:07:05 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage From: 128a-2hy@WEB.BERKELEY.EDU Newsgroups: gnu.emacs.bug Subject: emacs crash when funcalling autoload Message-ID: <9103100907.AA07037@weaver.berkeley.edu> Date: 10 Mar 91 09:07:05 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 31 Approved: bug-gnu-emacs@prep.ai.mit.edu