diff options
| author | Karl Heuer | 1997-10-16 18:32:06 +0000 |
|---|---|---|
| committer | Karl Heuer | 1997-10-16 18:32:06 +0000 |
| commit | 1126786767348f06b8488d81eb2e6fe26a4df29a (patch) | |
| tree | 126ca309d61b259b9f139da98352b75260698f24 | |
| parent | 23cf1efa9c4a7b56303f92f78d99739b00141a92 (diff) | |
| download | emacs-1126786767348f06b8488d81eb2e6fe26a4df29a.tar.gz emacs-1126786767348f06b8488d81eb2e6fe26a4df29a.zip | |
(function-called-at-point): Always use Emacs Lisp syntax tab.
Reject any "function call" with whitespace after the open-paren.
| -rw-r--r-- | lisp/help.el | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lisp/help.el b/lisp/help.el index 8ea8c405c19..03fe4363434 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -472,21 +472,26 @@ C-w Display information on absence of warranty for GNU Emacs." | |||
| 472 | ;; If that gives no function, return a function whose name is around point. | 472 | ;; If that gives no function, return a function whose name is around point. |
| 473 | ;; If that doesn't give a function, return nil. | 473 | ;; If that doesn't give a function, return nil. |
| 474 | (defun function-called-at-point () | 474 | (defun function-called-at-point () |
| 475 | (or (condition-case () | 475 | (let ((stab (syntax-table))) |
| 476 | (save-excursion | 476 | (set-syntax-table emacs-lisp-mode-syntax-table) |
| 477 | (save-restriction | 477 | (unwind-protect |
| 478 | (narrow-to-region (max (point-min) (- (point) 1000)) (point-max)) | 478 | (or (condition-case () |
| 479 | (backward-up-list 1) | 479 | (save-excursion |
| 480 | (forward-char 1) | 480 | (save-restriction |
| 481 | (let (obj) | 481 | (narrow-to-region (max (point-min) (- (point) 1000)) (point-max)) |
| 482 | (setq obj (read (current-buffer))) | 482 | ;; Move up to surrounding paren, then after the open. |
| 483 | (and (symbolp obj) (fboundp obj) obj)))) | 483 | (backward-up-list 1) |
| 484 | (error nil)) | 484 | (forward-char 1) |
| 485 | (condition-case () | 485 | ;; If there is space here, this is probably something |
| 486 | (let ((stab (syntax-table))) | 486 | ;; other than a real Lisp function call, so ignore it. |
| 487 | (unwind-protect | 487 | (if (looking-at "[ \t]") |
| 488 | (error "Probably not a Lisp function call")) | ||
| 489 | (let (obj) | ||
| 490 | (setq obj (read (current-buffer))) | ||
| 491 | (and (symbolp obj) (fboundp obj) obj)))) | ||
| 492 | (error nil)) | ||
| 493 | (condition-case () | ||
| 488 | (save-excursion | 494 | (save-excursion |
| 489 | (set-syntax-table emacs-lisp-mode-syntax-table) | ||
| 490 | (or (not (zerop (skip-syntax-backward "_w"))) | 495 | (or (not (zerop (skip-syntax-backward "_w"))) |
| 491 | (eq (char-syntax (following-char)) ?w) | 496 | (eq (char-syntax (following-char)) ?w) |
| 492 | (eq (char-syntax (following-char)) ?_) | 497 | (eq (char-syntax (following-char)) ?_) |
| @@ -494,8 +499,8 @@ C-w Display information on absence of warranty for GNU Emacs." | |||
| 494 | (skip-chars-forward "'") | 499 | (skip-chars-forward "'") |
| 495 | (let ((obj (read (current-buffer)))) | 500 | (let ((obj (read (current-buffer)))) |
| 496 | (and (symbolp obj) (fboundp obj) obj))) | 501 | (and (symbolp obj) (fboundp obj) obj))) |
| 497 | (set-syntax-table stab))) | 502 | (error nil))) |
| 498 | (error nil)))) | 503 | (set-syntax-table stab)))) |
| 499 | 504 | ||
| 500 | (defun describe-function-find-file (function) | 505 | (defun describe-function-find-file (function) |
| 501 | (let ((files load-history) | 506 | (let ((files load-history) |