all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* find-tag-default
@ 2004-05-13  6:37 Juri Linkov
  2004-05-16 13:21 ` find-tag-default Richard Stallman
  0 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2004-05-13  6:37 UTC (permalink / 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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-05-30 19:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-13  6:37 find-tag-default Juri Linkov
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.