find-function-noselect blindly strips the last four characters from the
filename; but the filename might end only in ".el", or in no extension.
(The real problem is that evaluating a defadvice form (via eval-expression
or similar) for a compiled file changes the return value of
(compiled-function-annotation def) to "loadup.el".)
The second chunk of this patch improves the error message when the
definition can't be found in the particular file where it was searched for.
-Michael Ernst
mernst(a)cs.washington.edu
--- /uns/lib/xemacs-20.4/lisp/prim/find-func.el Sun Feb 1 21:30:26 1998
+++ - Thu May 7 09:08:12 1998
@@ -118,7 +118,10 @@
(nth 1 def))
((describe-function-find-file function))
((compiled-function-p def)
- (substring (compiled-function-annotation def) 0 -4))
+ (let ((filename (compiled-function-annotation def)))
+ (if (string-match "\\.elc?\\'" filename 1)
+ (substring filename 0 (match-beginning 0))
+ filename)))
((eq 'macro (car-safe def))
(and (compiled-function-p (cdr def))
(substring (compiled-function-annotation (cdr def)) 0 -4)))))
@@ -152,7 +155,7 @@
(progn
(beginning-of-line)
(cons (current-buffer) (point)))
- (error "Cannot find definition of `%s'" function))))))))
+ (error "Cannot find definition of `%s' in library
\"%s\"" function library))))))))
(defun find-function-read-function ()
"Read and return a function, defaulting to the one near point.
Show replies by date