From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66614: 29.1.50; Support not capitalizing words inside symbols Date: Wed, 18 Oct 2023 21:34:55 +0300 Message-ID: <831qdrok34.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34485"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66614@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 18 20:36:02 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 1qtBOj-0008iI-LG for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Oct 2023 20:36:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtBOO-000675-Bf; Wed, 18 Oct 2023 14:35:40 -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 1qtBOL-00066G-5B for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 14:35:37 -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 1qtBOJ-0004jM-VF for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 14:35:36 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtBOk-0007Rs-1U for bug-gnu-emacs@gnu.org; Wed, 18 Oct 2023 14:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Oct 2023 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66614 X-GNU-PR-Package: emacs Original-Received: via spool by 66614-submit@debbugs.gnu.org id=B66614.169765414028602 (code B ref 66614); Wed, 18 Oct 2023 18:36:02 +0000 Original-Received: (at 66614) by debbugs.gnu.org; 18 Oct 2023 18:35:40 +0000 Original-Received: from localhost ([127.0.0.1]:34668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtBOO-0007RG-C8 for submit@debbugs.gnu.org; Wed, 18 Oct 2023 14:35:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtBOM-0007R1-W6 for 66614@debbugs.gnu.org; Wed, 18 Oct 2023 14:35:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtBNq-0004bS-PO; Wed, 18 Oct 2023 14:35:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W8dXduKOnail0vtxkP2ypz6HKLIv8cQ+N0HlJjE5dig=; b=MJjR96OWANAj lO2Lb6iT4VZQ9zfWXxDsvV922izM+Vq7nxZj3pCRacNXq0BTD2b8+0KTFkb4meX0usHNe6/1PQdKY ImuNOpMjf/ETGmT39O9+kSt6KaUjnJmBVrBme+dJ7AWKqiiMBkoso5F4sCeZvhbJZgwGnh0nnxUdn G3YYREtXI7opgXef/nu1g9ngwombvBy2wgnHDcKWwdpOKQ06I19nlMveq2Vv1Xx8sA5iINAnHm2kv YJmA8cqQZs7GSt7hlCzu2d8f9gd3Px68Mb1tLqjcY/0qG70uNwgTDEslpPQNk2R4lVdm97t51P3mA aa2BqylEmoo0mf++ZivLFQ==; In-Reply-To: (message from Spencer Baugh on Wed, 18 Oct 2023 13:01:43 -0400) 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:272676 Archived-At: > From: Spencer Baugh > Date: Wed, 18 Oct 2023 13:01:43 -0400 > > --- a/doc/lispref/strings.texi > +++ b/doc/lispref/strings.texi > @@ -1510,7 +1510,9 @@ Case Conversion > > The definition of a word is any sequence of consecutive characters that > are assigned to the word constituent syntax class in the current syntax > -table (@pxref{Syntax Class Table}). > +table (@pxref{Syntax Class Table}), or if @var{case-symbols-as-words} is > +non-nil, also characters assigned to the symbol constituent syntax > +class. > > When @var{string-or-char} is a character, this function does the same > thing as @code{upcase}. > @@ -1542,7 +1544,9 @@ Case Conversion > > The definition of a word is any sequence of consecutive characters that > are assigned to the word constituent syntax class in the current syntax > -table (@pxref{Syntax Class Table}). > +table (@pxref{Syntax Class Table}), or if @var{case-symbols-as-words} is > +non-nil, also characters assigned to the symbol constituent syntax > +class. These two hunks use @var incorrectly: case-symbols-as-words is a literal symbol, so it should have the @code markup. > ++++ > +** New variable 'case-symbols-as-words' to change case behavior for symbols. "Case behavior" is confusing. I think you mean New variable 'case-symbols-as-words' affects case operations for symbols. > +If this is set to non-nil, then case operations such as > +'upcase-initials' or 'replace-match' (with nil FIXEDCASE) will treat > +symbol constituents as if they were part of words. Don't you mean will treat the entire symbol name as a single word ? I find the text you used confusing, FWIW. > This is useful for > +programming languages and style where words in the middle of symbols > +are never capitalized. Likewise here: instead of talking about "words in the middle of symbols", wouldn't it be better to say something like ...style where only the first letter of a symbol's name is ever capitalized. ? Also, please say here that the default of this new variable is nil. > + DEFVAR_BOOL ("case-symbols-as-words", case_symbols_as_words, > + doc: /* If non-nil, case functions treat symbol syntax as part of words. > + > +Functions such as `upcase-initials' and `replace-match' check or modify > +the case pattern of sequences of characters. Normally, these operate on > +sequences of characters whose syntax is word constituent. If this > +variable is non-nil, then they operate on sequences of characters who > +syntax is either word constituent or symbol constituent. > + > +This is useful for programming styles which wish to capitalize the > +beginning of symbols, but not capitalize individual words in a symbol.*/); Similar comments about this doc string. Also, shouldn't this variable be buffer-local? You want certain major modes to set it, right? > - if (SYNTAX (prevc) != Sword) > + if (SYNTAX (prevc) != Sword > + && (!case_symbols_as_words || SYNTAX (prevc) != Ssymbol)) I think the code will be more clear if you use && !(case_symbols_as_words && SYNTAX (prevc) == Ssymbol)) > else if (uppercasep (c)) > { > some_uppercase = 1; > - if (SYNTAX (prevc) != Sword) > + if (SYNTAX (prevc) != Sword > + && (!case_symbols_as_words || SYNTAX (prevc) != Ssymbol)) Same here. > /* If the initial is a caseless word constituent, > treat that like a lowercase initial. */ > - if (SYNTAX (prevc) != Sword) > + if (SYNTAX (prevc) != Sword > + && (!case_symbols_as_words || SYNTAX (prevc) != Ssymbol)) > some_nonuppercase_initial = 1; And here. Thanks.