changeset 20077:437758b7ca50

(function-called-at-point): Always use Emacs Lisp syntax tab. Reject any "function call" with whitespace after the open-paren.
author Karl Heuer <kwzh@gnu.org>
date Thu, 16 Oct 1997 18:32:06 +0000
parents 374e09781f08
children 0fc1437e7427
files lisp/help.el
diffstat 1 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help.el	Thu Oct 16 18:28:41 1997 +0000
+++ b/lisp/help.el	Thu Oct 16 18:32:06 1997 +0000
@@ -472,21 +472,26 @@
 ;; If that gives no function, return a function whose name is around point.
 ;; If that doesn't give a function, return nil.
 (defun function-called-at-point ()
-  (or (condition-case ()
-	  (save-excursion
-	    (save-restriction
-	      (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
-	      (backward-up-list 1)
-	      (forward-char 1)
-	      (let (obj)
-		(setq obj (read (current-buffer)))
-		(and (symbolp obj) (fboundp obj) obj))))
-	(error nil))
-      (condition-case ()
-	  (let ((stab (syntax-table)))
-	    (unwind-protect
+  (let ((stab (syntax-table)))
+    (set-syntax-table emacs-lisp-mode-syntax-table)
+    (unwind-protect
+	(or (condition-case ()
 		(save-excursion
-		  (set-syntax-table emacs-lisp-mode-syntax-table)
+		  (save-restriction
+		    (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
+		    ;; Move up to surrounding paren, then after the open.
+		    (backward-up-list 1)
+		    (forward-char 1)
+		    ;; If there is space here, this is probably something
+		    ;; other than a real Lisp function call, so ignore it.
+		    (if (looking-at "[ \t]")
+			(error "Probably not a Lisp function call"))
+		    (let (obj)
+		      (setq obj (read (current-buffer)))
+		      (and (symbolp obj) (fboundp obj) obj))))
+	      (error nil))
+	    (condition-case ()
+		(save-excursion
 		  (or (not (zerop (skip-syntax-backward "_w")))
 		      (eq (char-syntax (following-char)) ?w)
 		      (eq (char-syntax (following-char)) ?_)
@@ -494,8 +499,8 @@
 		  (skip-chars-forward "'")
 		  (let ((obj (read (current-buffer))))
 		    (and (symbolp obj) (fboundp obj) obj)))
-	      (set-syntax-table stab)))
-	(error nil))))
+	      (error nil)))
+      (set-syntax-table stab))))
 
 (defun describe-function-find-file (function)
   (let ((files load-history)