[comp.emacs] cmulisp.el bug report and fix

shivers@a.gp.cs.cmu.edu (Olin Shivers) (09/21/90)

There is a bug in cmulisp.el: the function lisp-fn-called-at is missing
a save-restriction form. The following function is the correct version.
The only difference is the save-restriction form.

This bug and fix was reported by Lennart Staflin. The sources available
by anonymous ftp from CMU have the fix installed.
	-Olin

(defun lisp-fn-called-at-pt ()
  "Returns the name of the function called in the current call.
Nil if it can't find one."
  (condition-case nil
      (save-excursion
	(save-restriction
	  (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
	  (backward-up-list 1)
	  (forward-char 1)
	  (let ((obj (read (current-buffer))))
	    (and (symbolp obj) obj))))
    (error nil)))