unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: find-tag-default
Date: Thu, 20 May 2004 11:09:48 +0300	[thread overview]
Message-ID: <87pt8z1pv6.fsf@mail.jurta.org> (raw)
In-Reply-To: <E1BQWJa-0002xw-Aj@fencepost.gnu.org> (Richard Stallman's message of "Wed, 19 May 2004 15:01:18 -0400")

I have a better idea: to left the function `find-tag-default'
alone in its etags.el, and to add a new function (which is
slightly extended version of `find-tag-default') to simple.el:

(defun identifier-at-point ()
  "Return a default identifier based on the text at point."
  (or (and (boundp 'find-tag-default-function)
           find-tag-default-function
           (funcall find-tag-default-function))
      (and (get major-mode 'find-tag-default-function)
           (funcall (get major-mode 'find-tag-default-function)))
      (save-excursion
        (while (looking-at "\\sw\\|\\s_")
          (forward-char 1))
        (when (or (re-search-backward "\\sw\\|\\s_"
                                      (save-excursion (beginning-of-line) (point))
                                      t)
                  (re-search-forward "\\(\\sw\\|\\s_\\)+"
                                     (save-excursion (end-of-line) (point))
                                     t))
          (goto-char (match-end 0))
          (buffer-substring-no-properties
           (point)
           (progn (forward-sexp -1)
                  (while (looking-at "\\s'")
                    (forward-char 1))
                  (point)))))))

There are several benefits:

1. no need to load etags.el;

2. a complicated construct

(funcall (or find-tag-default-function
         (get major-mode 'find-tag-default-function)
         'find-tag-default))

is replaced by a simple function call `(identifier-at-point)'.

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2004-05-20  8:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` Juri Linkov [this message]
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=87pt8z1pv6.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.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).