From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#66614: 29.1.50; Support not capitalizing words inside symbols Date: Wed, 18 Oct 2023 12:32:04 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27020"; mail-complaints-to="usenet@ciao.gmane.io" To: 66614@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 18 18:33:00 2023 Return-path: Envelope-to: geb-bug-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 1qt9Tg-0006kF-3l for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Oct 2023 18:33:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt9TS-0007aG-P2; Wed, 18 Oct 2023 12:32:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt9TK-0007V6-BO for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 12:32:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt9TI-0006cB-Q4 for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 12:32:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qt9Ti-0000nx-Fq for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 12:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Oct 2023 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66614 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16976467673066 (code B ref -1); Wed, 18 Oct 2023 16:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Oct 2023 16:32:47 +0000 Original-Received: from localhost ([127.0.0.1]:34561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qt9TS-0000nO-IL for submit@debbugs.gnu.org; Wed, 18 Oct 2023 12:32:47 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:56010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qt9TO-0000n6-1e for submit@debbugs.gnu.org; Wed, 18 Oct 2023 12:32:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt9Ss-0007H7-B4 for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 12:32:10 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt9Sq-0006Xo-Mh for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 12:32:10 -0400 Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272668 Archived-At: Quick definitions: - word: a sequence of characters whose syntax is word constituent - symbol: a sequence of characters whose syntax is either word constituent or symbol constituent In some programming languages and styles, a symbol (or every symbol in a sequence of symbols) might be capitalized, but the individual words making up the symbol should never be capitalized. For example, in OCaml, type names Look_like_this and variable names look_like_this, but it is basically never correct for something to Look_Like_This. And one might have "aa_bb cc_dd ee_ff" or "Aa_bb Cc_dd Ee_ff", but never "Aa_Bb Cc_Dd Ee_Ff". Currently, case handling in casefiddle.c and Freplace_match always capitalizes individual words, which has undesirable effects when programming in these styles. Three examples: - If I have a variable "hash_set" and a type name "Hash_set", and I type "Ha" and dabbrev-expand, then depending on the context Ha may expand to Hash_Set instead of hash_set. But it is never correct to caplitalize internal words in this style, so we could avoid this. - If I have a variable foo and Foo, and I query-replace foo with bar_baz, the replacements will be bar_baz and Bar_Baz. But again it is never correct to capitalize internal words in this style. - More concretely, (progn (string-match "az" "Az") (replace-match "az_bz" nil nil "Az")) yields Az_Bz, but in this programming style it should always yield Az_bz. A naive solution is to change the syntax class of symbol constituents so that they are treated as part of words. Or, equivalently, to use superword-mode. This solution is incorrect, though: the distinction between symbols and words is still useful for word and symbol navigation commands, and other purposes besides. Changing the syntax class will break those other use cases. The only thing that needs to be changed is the case behavior. This is straightforwardly solvable by supporting a behavior where symbol constituents are treated as part of words only for case operations. A patch follows which adds a variable which allows that. In GNU Emacs 29.1.50 (build 11, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2023-10-18 built on Repository revision: 9163e634e296435aa7a78bc6b77b4ee90666d2ac Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000