From: Philip Kaludercic <philipk@posteo.net>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: What is the difference between `current-word' and `word-at-point'?
Date: Mon, 29 Mar 2021 11:00:44 +0200 [thread overview]
Message-ID: <87o8f272rn.fsf@posteo.net> (raw)
In-Reply-To: <87ft0ea77v.fsf@mbork.pl> (Marcin Borkowski's message of "Mon, 29 Mar 2021 06:56:20 +0200")
Marcin Borkowski <mbork@mbork.pl> writes:
> Hi all,
>
> it seems Emacs has two functions with a very similar purpose,
> `current-word' and `word-at-point'. I understand some obvious
> differences (like that `current-word' can treat "symbol" characters as
> constituting a word or not, and `word-at-point' can give the current
> word with the properties), but does anyone know
>
> (a) why Emacs has both functions, and
I suppose that word-at-point is a simple extension of the thing-at-point
mechanism, that uses forward-word instead of the syntax table.
> (b) if/when their results can actually differ (apart from the obvious
> cases like I mentioned)?
One difference I could make out is that word-at-point respects
find-word-boundary-function-table (as it is implemented via
forward-word). This means that when something like subword-mode is
active and the buffer contains
someCam|lCaseWord
where | is the point, (word-at-point) returns "Camel" while
(current-word) gives me "someCamelCaseWord".
> TIA,
--
Philip K.
next prev parent reply other threads:[~2021-03-29 9:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 4:56 What is the difference between `current-word' and `word-at-point'? Marcin Borkowski
2021-03-29 9:00 ` Philip Kaludercic [this message]
2021-03-29 14:56 ` [External] : " Drew Adams
2021-03-29 15:01 ` Philip Kaludercic
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=87o8f272rn.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=help-gnu-emacs@gnu.org \
--cc=mbork@mbork.pl \
/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.
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).