Xref: utzoo gnu.emacs.help:698 comp.emacs:9809 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!bjaspan From: bjaspan@ATHENA.MIT.EDU ("Barr3y Jaspan") Newsgroups: gnu.emacs.help,comp.emacs Subject: Re: How to read a word from a buffer for use as a variable in a function. Message-ID: <9101030011.AA29940@bill-the-cat.MIT.EDU> Date: 3 Jan 91 00:11:35 GMT Sender: daemon@tut.cis.ohio-state.edu Followup-To: gnu.emacs.help Organization: Gatewayed from the GNU Project mailing list help-gnu-emacs@prep.ai.mit.edu Lines: 27 Date: 2 Jan 91 18:11:08 GMT From: southern@neit.cgd.ucar.edu Typing the word into the minibuffer is proving cumbersome and I would like to find a way to make the function look up the documentation for the word that the cursor is currently on. The following elisp (from tags.el in the standard emacs distribution) does what you want, I think. Of course, that assumes I correctly understand what you want to do. ;; Return a default tag to search for, based on the text at point. (defun find-tag-default () (save-excursion (while (looking-at "\\sw\\|\\s_") (forward-char 1)) (if (re-search-backward "\\sw\\|\\s_" nil t) (progn (forward-char 1) (buffer-substring (point) (progn (forward-sexp -1) (while (looking-at "\\s'") (forward-char 1)) (point)))) nil))) Barr3y Jaspan, bjaspan@mit.edu