[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is the difference between `current-word' and `word-at-point'?
From: |
Philip Kaludercic |
Subject: |
Re: What is the difference between `current-word' and `word-at-point'? |
Date: |
Mon, 29 Mar 2021 11:00:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
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.