comparison lisp/help-fns.el @ 95601:0f9baaf9427f

* help.el (function-called-at-point): * help-fns.el (variable-at-point): Use emacs-lisp-mode-syntax-table even when calling find-tag-default.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 06 Jun 2008 20:02:42 +0000
parents f4d291b9de49
children a5fc76bb12d1
comparison
equal deleted inserted replaced
95600:1adddfc3bbf3 95601:0f9baaf9427f
441 ;;;###autoload 441 ;;;###autoload
442 (defun variable-at-point (&optional any-symbol) 442 (defun variable-at-point (&optional any-symbol)
443 "Return the bound variable symbol found at or before point. 443 "Return the bound variable symbol found at or before point.
444 Return 0 if there is no such symbol. 444 Return 0 if there is no such symbol.
445 If ANY-SYMBOL is non-nil, don't insist the symbol be bound." 445 If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
446 (or (condition-case () 446 (with-syntax-table emacs-lisp-mode-syntax-table
447 (with-syntax-table emacs-lisp-mode-syntax-table 447 (or (condition-case ()
448 (save-excursion 448 (save-excursion
449 (or (not (zerop (skip-syntax-backward "_w"))) 449 (or (not (zerop (skip-syntax-backward "_w")))
450 (eq (char-syntax (following-char)) ?w) 450 (eq (char-syntax (following-char)) ?w)
451 (eq (char-syntax (following-char)) ?_) 451 (eq (char-syntax (following-char)) ?_)
452 (forward-sexp -1)) 452 (forward-sexp -1))
453 (skip-chars-forward "'") 453 (skip-chars-forward "'")
454 (let ((obj (read (current-buffer)))) 454 (let ((obj (read (current-buffer))))
455 (and (symbolp obj) (boundp obj) obj)))) 455 (and (symbolp obj) (boundp obj) obj)))
456 (error nil)) 456 (error nil))
457 (let* ((str (find-tag-default)) 457 (let* ((str (find-tag-default))
458 (sym (if str (intern-soft str)))) 458 (sym (if str (intern-soft str))))
459 (if (and sym (or any-symbol (boundp sym))) 459 (if (and sym (or any-symbol (boundp sym)))
460 sym 460 sym
461 (save-match-data 461 (save-match-data
462 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) 462 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str))
463 (setq sym (intern-soft (match-string 1 str))) 463 (setq sym (intern-soft (match-string 1 str)))
464 (and (or any-symbol (boundp sym)) sym))))) 464 (and (or any-symbol (boundp sym)) sym)))))
465 0)) 465 0)))
466 466
467 (defun describe-variable-custom-version-info (variable) 467 (defun describe-variable-custom-version-info (variable)
468 (let ((custom-version (get variable 'custom-version)) 468 (let ((custom-version (get variable 'custom-version))
469 (cpv (get variable 'custom-package-version)) 469 (cpv (get variable 'custom-package-version))
470 (output nil)) 470 (output nil))