From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: find-tag-default Date: Thu, 13 May 2004 09:37:53 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <874qqkq1by.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1084430718 7803 80.91.224.253 (13 May 2004 06:45:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 May 2004 06:45:18 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 13 08:45:08 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BO9xs-0005Kf-00 for ; Thu, 13 May 2004 08:45:08 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BO9xr-0004Be-00 for ; Thu, 13 May 2004 08:45:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BO9x3-0001sF-Vh for emacs-devel@quimby.gnus.org; Thu, 13 May 2004 02:44:18 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BO9wQ-0001nb-SF for emacs-devel@gnu.org; Thu, 13 May 2004 02:43:38 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BO9vr-0001LB-TQ for emacs-devel@gnu.org; Thu, 13 May 2004 02:43:36 -0400 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BO9vr-0001K7-EE for emacs-devel@gnu.org; Thu, 13 May 2004 02:43:03 -0400 Original-Received: from mail.jurta.org (80-235-35-214-dsl.mus.estpak.ee [80.235.35.214]) by knife.dreamhost.com (Postfix) with ESMTP id 83A5CE40B0 for ; Wed, 12 May 2004 23:43:01 -0700 (PDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23303 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23303 I noticed that grep.el has a copy of find-tag-default function from etags.el, for the reason not to load etags.el at run-time. The function find-tag-default is a quite general function, which is used by other Emacs Lisp files, so it could be moved from etags.el to simple.el (without renaming), thus allowing other files to use it without loading etags.el. find-tag-default could be used also as an additional attempt to find a function or variable name around point in functions describe-function, describe-variable. This is useful when a function or variable name is located in a buffer not in Emacs Lisp mode, such as message or article mode, where it is not quoted and has trailing punctuation. (For example, try to type C-h f on function names in this paragraph.) Index: emacs/lisp/help.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/help.el,v retrieving revision 1.264 diff -u -w -b -r1.264 help.el --- emacs/lisp/help.el 27 Apr 2004 06:35:25 -0000 1.264 +++ emacs/lisp/help.el 13 May 2004 06:11:20 -0000 @@ -237,7 +237,7 @@ (defun function-called-at-point () "Return a function around point or else called by the list containing point. If that doesn't give a function, return nil." - (with-syntax-table emacs-lisp-mode-syntax-table + (or (with-syntax-table emacs-lisp-mode-syntax-table (or (condition-case () (save-excursion (or (not (zerop (skip-syntax-backward "_w"))) @@ -262,7 +262,10 @@ (error "Probably not a Lisp function call")) (let ((obj (read (current-buffer)))) (and (symbolp obj) (fboundp obj) obj)))) - (error nil))))) + (error nil)))) + (let* ((str (find-tag-default)) + (obj (if str (intern str)))) + (and (symbolp obj) (fboundp obj) obj)))) ;;; `User' help functions Index: emacs/lisp/help-fns.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/help-fns.el,v retrieving revision 1.48 diff -u -w -b -r1.48 help-fns.el --- emacs/lisp/help-fns.el 11 May 2004 23:50:25 -0000 1.48 +++ emacs/lisp/help-fns.el 13 May 2004 06:11:21 -0000 @@ -456,7 +456,7 @@ (defun variable-at-point () "Return the bound variable symbol found around point. Return 0 if there is no such symbol." - (condition-case () + (or (condition-case () (with-syntax-table emacs-lisp-mode-syntax-table (save-excursion (or (not (zerop (skip-syntax-backward "_w"))) @@ -465,9 +465,12 @@ (forward-sexp -1)) (skip-chars-forward "'") (let ((obj (read (current-buffer)))) - (or (and (symbolp obj) (boundp obj) obj) - 0)))) - (error 0))) + (and (symbolp obj) (boundp obj) obj)))) + (error nil)) + (let* ((str (find-tag-default)) + (obj (if str (intern str)))) + (and (symbolp obj) (boundp obj) obj)) + 0)) ;;;###autoload (defun describe-variable (variable &optional buffer) -- Juri Linkov http://www.jurta.org/emacs/