From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.help Subject: Re: What is the difference between `current-word' and `word-at-point'? Date: Mon, 29 Mar 2021 11:00:44 +0200 Message-ID: <87o8f272rn.fsf@posteo.net> References: <87ft0ea77v.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23192"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: Help Gnu Emacs mailing list To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 29 11:06:15 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQnqh-0005wO-5Y for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Mar 2021 11:06:15 +0200 Original-Received: from localhost ([::1]:47908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQnqg-0002rX-0n for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Mar 2021 05:06:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQnlY-0000Nh-8O for help-gnu-emacs@gnu.org; Mon, 29 Mar 2021 05:00:56 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:41911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQnlR-00008d-U2 for help-gnu-emacs@gnu.org; Mon, 29 Mar 2021 05:00:55 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 99C0E2400FB for ; Mon, 29 Mar 2021 11:00:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1617008446; bh=qdE3ICTBqk/k9IdlgtQJLDtj8z3ofQPP1oXIhV4tvXs=; h=From:To:Cc:Subject:Date:From; b=QwC9/TesJ1sQyvKH8wgxTJf0hIy0Nf2GJhu8k9Le/Yi6vMcUxTUxdpBrWICmlD1+1 XKc2Q6LvU5K3OO213RNc1BBI/NbPsO7dVCgb4RJXQoDltcmPsY/RisKxw71NPMDmpD NzPYnV0d2978MoQnSMmr+qEWLcmsN0m7fZvGINY+HafJikf+koSwvU4pLfkSI9aqOQ Z67T2vLwWg2o8ZnyUa/+A0lAj7T/SgOTa4/g6sG72zhbuqhbmuIRvRABd3mzwc7fGS ForIRx/eeSNuqoqvYzSZJTFwcKGtPZy3nrKpPBF/1uYbPQodAjJ9FX7Jrz08oktQGX UwYnjpRd3LJhA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4F864F5vLrz6tmP; Mon, 29 Mar 2021 11:00:45 +0200 (CEST) In-Reply-To: <87ft0ea77v.fsf@mbork.pl> (Marcin Borkowski's message of "Mon, 29 Mar 2021 06:56:20 +0200") Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128746 Archived-At: Marcin Borkowski 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.