From: "Drew Adams" <drew.adams@oracle.com>
To: "Stefan Monnier" <monnier@iro.umontreal.ca>,
"Andreas Rohler" <andreas.roehler@online.de>
Cc: emacs-devel@gnu.org
Subject: RE: symbol-at-point
Date: Thu, 26 Jul 2007 13:31:45 -0700 [thread overview]
Message-ID: <BNELLINCGFJLDJIKDGACIEPOCAAA.drew.adams@oracle.com> (raw)
In-Reply-To: <jwv3azbj7v1.fsf-monnier+emacs@gnu.org>
> > Wouldn't it be more clean to write a separate (intern
> > SYMBOL-at-point) function, if someone wants to do that?
>
> I agree that symbol-at-point should return a string.
> When I fixed symbol-at-point to work in non-elisp major modes, I preserved
> this part of the behavior for no good reason.
No, it should not return a string. Changing that could mean changing code
that uses the result, for example, in a completion list. Even though Emacs
22 now accepts a list of strings in place of an alist as a completion list,
I think that change would be a bad idea.
It's better to leave `symbol-at-point' as is, returning a symbol, and have a
separate function, `symbol-name-at-point', which gives you the name. That is
the approach I took in the thingatpt.el patch I sent.
> But returning a symbol has the main disadvantage that you can't
> distinguish the case where point is not on a symbol (w.g. it's
> looking at a semi-colon) from the case where it's looking at
> the symbol "nil".
Right. In the patch that I sent, these issues are addressed (for Lisp
symbols). Separate `lisp-symbol-name-*' functions return the symbol name, or
"" if there is no such symbol, whereas `list-symbol-*' returns the symbol
itself (possibly nil) or nil if thre is no such symbol.
I also included functions to return the name of a non-nil symbol or "", if
there is none: `non-nil-lisp-symbol-name-nearest-point',
`non-nil-lisp-symbol-name-at-point'.
For the symbol itself (not its name) at point, there is obviously no need
for a non-nil version. However, there is a function
`non-nil-symbol-nearest-point', which returns the nearest non-nil symbol, or
nil if there is none. ("there is none" means there is none within the
user-specifiable limits that define "nearness".)
next prev parent reply other threads:[~2007-07-26 20:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 9:07 symbol-at-point Andreas Röhler
2007-07-26 12:20 ` symbol-at-point Eli Zaretskii
2007-07-26 18:45 ` symbol-at-point Andreas Röhler
2007-07-26 19:06 ` symbol-at-point Eli Zaretskii
2007-07-26 15:37 ` symbol-at-point Tassilo Horn
2007-07-26 19:17 ` symbol-at-point Stefan Monnier
2007-07-26 20:31 ` Drew Adams [this message]
2007-07-27 5:36 ` symbol-at-point Stefan Monnier
2007-07-27 16:24 ` symbol-at-point Drew Adams
2007-07-27 18:56 ` symbol-at-point Stefan Monnier
2007-07-27 23:22 ` symbol-at-point Drew Adams
2007-07-28 4:01 ` symbol-at-point Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BNELLINCGFJLDJIKDGACIEPOCAAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=andreas.roehler@online.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 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.