unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Subject: find-tag-default
Date: Thu, 13 May 2004 09:37:53 +0300	[thread overview]
Message-ID: <874qqkq1by.fsf@mail.jurta.org> (raw)

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))))
 
 \f
 ;;; `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/

             reply	other threads:[~2004-05-13  6:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-13  6:37 Juri Linkov [this message]
2004-05-16 13:21 ` find-tag-default Richard Stallman
2004-05-19  8:45   ` find-tag-default Juri Linkov
2004-05-19 18:35     ` find-tag-default Kevin Rodgers
2004-05-19 19:01     ` find-tag-default Richard Stallman
2004-05-20  8:09       ` find-tag-default Juri Linkov
2004-05-20  9:14         ` find-tag-default Juri Linkov
2004-05-21  1:27         ` find-tag-default Richard Stallman
2004-05-21  8:05           ` find-tag-default Juri Linkov
2004-05-22 21:44             ` find-tag-default Richard Stallman
2004-05-24 16:49               ` find-tag-default Drew Adams
2004-05-29  1:44                 ` find-tag-default Richard Stallman
2004-05-29 17:43                   ` find-tag-default Drew Adams
2004-05-30 19:41                     ` find-tag-default Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874qqkq1by.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).