From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 14 19:32:38 2023 Received: (at submit) by debbugs.gnu.org; 14 Jul 2023 23:32:38 +0000 Received: from localhost ([127.0.0.1]:43638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKSH8-000180-H9 for submit@debbugs.gnu.org; Fri, 14 Jul 2023 19:32:38 -0400 Received: from lists.gnu.org ([2001:470:142::17]:50766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKSH7-00017l-KR for submit@debbugs.gnu.org; Fri, 14 Jul 2023 19:32:38 -0400 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 1qKSH2-0005qG-0C for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 19:32:32 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKSGt-0007VM-ET for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 19:32:31 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2b701e41cd3so38649331fa.3 for ; Fri, 14 Jul 2023 16:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689377540; x=1691969540; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=RwjAPe4bP8LPpIIWHugenmKA61Um4ZUGgh4m6zbKzfc=; b=sRYhP2BCe5dfjmdeXjFgPptOMKeqzFE0B8vgrhNGPm9jJG+XC+CUL3QnUcdltulLq2 h6jJHD6Vd5wxnzykcapzXWolmbBxcnLiEqhnG6nnhE6FKXm6bGTAHX+zo3hqMFTEWKlI wMvsJU757iKYkbKRRVqKsFB7vxRHpT0kpyY3Z9DXXJcHjxVibboosj4qXzYCvZbI4m/1 isfQMUnbB3hVfle6IHnG7C8q1K5/v/ltHUyupuhOrY/5GUf2Hwsf0scvDUvZGKvFintK dAlzFfuJcQJ0YtkKLgb105VCkATsyJTXaE6yYn2G/XEEWLzCO9dbrxaXiRfksyQ0rhOo BPSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689377540; x=1691969540; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RwjAPe4bP8LPpIIWHugenmKA61Um4ZUGgh4m6zbKzfc=; b=XZRcyXuqPn606SicEIbe/lTb9Duujfaw5Y5sJgHwl9gBY2sIDVv/1N+9za8aBkg+CG placlDaXaI4hwd6a56yU464VIirl0d/uaUyDAc3XrJs1KT4C/1ZpX40QOCMHzfgeGqVy n2dch6Wrie19+0jGbSdsQspCTLIJuLntaaIE06zDR/rV4S7REs9lVbL77uRN457fA4Ki 8X2XJ8N6MqsFfPsquAjtaXPPGVn+kOLX+FL8vrNRtlnBVjikbIC0gcjDmqk+KwZ952wN t7PO0hELz913XcBoqNbpkejaQbeHP/bEv0V4LL7Z0Vyu/BZFLfOfhg46E28h7gckVfGO wU9Q== X-Gm-Message-State: ABy/qLaFp70Eu81xeRmb427OfOk+BN3nbf63EbP5LrAJSKNaVwd6jaWr xnJuWy3IQGAfzV8GlswYVUb/5bAu/a/i9dwdo6suEUs+ X-Google-Smtp-Source: APBJJlHH29lhUZp8ITS27+4mX6r/SQuuZ/9A775tMefHoffRwlTFoTN9DAAA7A1jgs77fNebOTviKSw5pC6FGKn/alA= X-Received: by 2002:a2e:98d1:0:b0:2b7:ada:cb25 with SMTP id s17-20020a2e98d1000000b002b70adacb25mr5313533ljj.31.1689377540242; Fri, 14 Jul 2023 16:32:20 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?Sm9zw6kgSsO6bmlvcg==?= Date: Fri, 14 Jul 2023 20:31:42 -0300 Message-ID: Subject: Feature request: downcase-char, downcase-initials To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="0000000000002d807206007adc09" Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=jjnilton@gmail.com; helo=mail-lj1-x22f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --0000000000002d807206007adc09 Content-Type: text/plain; charset="UTF-8" Hi, my suggestion is to add equivalent functions for `upcase-char` and `upcase-initials` but for downcase (`downcase-char` and `downcase-initials`). When I first these functions, I expected to have the downcase equivalent for each of them. --0000000000002d807206007adc09 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, my suggestion is to add equivalent functions for `upca= se-char` and `upcase-initials` but for downcase (`downcase-char` and `downc= ase-initials`). When I first these functions, I expected to have the downca= se equivalent for each of them.
--0000000000002d807206007adc09-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 02:06:43 2023 Received: (at 64632) by debbugs.gnu.org; 15 Jul 2023 06:06:43 +0000 Received: from localhost ([127.0.0.1]:43841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKYQU-0004S1-MP for submit@debbugs.gnu.org; Sat, 15 Jul 2023 02:06:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKYQT-0004Rm-99 for 64632@debbugs.gnu.org; Sat, 15 Jul 2023 02:06:41 -0400 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 1qKYQO-0004Je-1R; Sat, 15 Jul 2023 02:06:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=S/IBpQhPGsJp20VmAYWPN0fSJNrqafiDe57JiEXcB+U=; b=AbXZWhZ5gTDWPaiSsHmg ppuefu2Cnuqs3pAeKBGqv0UGbdl+8M1clFNWIEVzWr6prxn55FR7KAzHFbcaWTWhX96JrtXQfyda9 O2lerParHlWTJZmhil2uS+YCeBiBshfzTDfl094QrUpOVDFgF1BVLEqQhWx9p8b/1MTAnWcNInFbB CkNpHsRU8sMiXTjH2nHu6v8zn2ZI48jFs1dTta5LRtUGwIjSr3rQ6Z/CANII5imsilazEOofcOOXz TkeQAJZZ082wHmjOobxZtuIuqG1CYH33hAgR1NZaQE6CAelDmfFYNmVj6/ueFk3Ybe7WtxAGkR76A VCSs7cC1CAe+UQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKYQN-0006zX-IE; Sat, 15 Jul 2023 02:06:35 -0400 Date: Sat, 15 Jul 2023 09:06:56 +0300 Message-Id: <83fs5pemin.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?B?Sm9zw6kgSsO6bmlvcg==?= In-Reply-To: (message from =?utf-8?B?Sm9zw6kgSsO6bmlvcg==?= on Fri, 14 Jul 2023 20:31:42 -0300) Subject: Re: bug#64632: Feature request: downcase-char, downcase-initials References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64632 Cc: 64632@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: José Júnior > Date: Fri, 14 Jul 2023 20:31:42 -0300 > > Hi, my suggestion is to add equivalent functions for `upcase-char` and `upcase-initials` but for > downcase (`downcase-char` and `downcase-initials`). When I first these functions, I expected to have > the downcase equivalent for each of them. Thanks. In which situations would such commands be useful? We don't introduce commands just because they are equivalents of others. Anyway, we already have downcase-region, which you could use to downcase any range of characters, including a single character anywhere in a word. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 10:14:27 2023 Received: (at 64632) by debbugs.gnu.org; 15 Jul 2023 14:14:27 +0000 Received: from localhost ([127.0.0.1]:45684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKg2U-000789-Nc for submit@debbugs.gnu.org; Sat, 15 Jul 2023 10:14:27 -0400 Received: from mail-vs1-xe2d.google.com ([2607:f8b0:4864:20::e2d]:56535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKg2Q-00077r-BH for 64632@debbugs.gnu.org; Sat, 15 Jul 2023 10:14:25 -0400 Received: by mail-vs1-xe2d.google.com with SMTP id ada2fe7eead31-440b54708f2so1035125137.0 for <64632@debbugs.gnu.org>; Sat, 15 Jul 2023 07:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689430457; x=1692022457; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=S3iu4Y5MEmJ4Ekt4jdKKGd3OrPZBQm22vqKVf43G8kE=; b=VNzWHoxRecFClwR+pq+Lw7pbMQSmHzfo+j0oPdn2kvcGvwalrfL6gH560qyPArQ06R d4IMdDCZE0hWlrlreADZA1jL+nw9nmfxl0ODiurfCZkBia02FL7T8CO1bJyBGpsToWNu nh5qzDSeomWBLCuVXPlenUemWvUVGXDA5zM/tkBwKZBvmo11wj1hQDN3E91VNGtQ3nne 9Zgm6Mt4iMBRize2RFhp0+wzyHrqgb+G9wja/nk/7b9RGo17q6gklL7sVt4XuXaOARJ7 RoZfrYN7oG0ixlkBO/J+dDNGYRwMK3ZUi+0waqDiaL9pchMXjJ9o4rZSld30u0ymdi7o vTUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689430457; x=1692022457; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=S3iu4Y5MEmJ4Ekt4jdKKGd3OrPZBQm22vqKVf43G8kE=; b=JoSX46znGfoIL/0YuhDQS3sU9aTWwQDgG6DnMmhsyEQBYF1I7V2syz4aGQ6SKK/0I2 OshZxEENkIPjxtsRiSnZl2vhO9GGMTtlD1HQWHEoPMFUZsoI8awAjVoEVnUc4q0b6Zem kTIrZ1Fg5assAQSjqAUiKHkJg2t/oAcfJ/qwbjKe+9RQ6MbI7/FjWuGy9/COG+f82NiJ +i2QsNjNQrRBfelCYDlCowfh7Qt2vXxDPb0DkSZuoJhz5swNkzgj6DxtMsXQjWTgjdhl vRwoRs0Ojf/gx/ZPAObKvPsnipRokO7M4yPp/ohEG7nIVNR4PmR9z+WbMyTyyt03L1m3 7Etg== X-Gm-Message-State: ABy/qLYIwUfH2q7ZHdVc0S8DcidPrVdi3+MpoQzxSwH36qKl0bnxSTXI G8HFW7jJUW4YDR7aIFnCHZOUsI/lfvywAsjvLbg= X-Google-Smtp-Source: APBJJlHRncXfgIIYWlKgONlLB1ZMWgzrNCEy/EtIgKCqi4AihvXDNDslNM+8w1CAS3Rfmm2I0dae3V+V57Wfdjczufw= X-Received: by 2002:a67:f842:0:b0:443:8034:be54 with SMTP id b2-20020a67f842000000b004438034be54mr3943053vsp.32.1689430456676; Sat, 15 Jul 2023 07:14:16 -0700 (PDT) MIME-Version: 1.0 References: <83fs5pemin.fsf@gnu.org> In-Reply-To: <83fs5pemin.fsf@gnu.org> From: =?UTF-8?B?Sm9zw6kgSsO6bmlvcg==?= Date: Sat, 15 Jul 2023 11:13:40 -0300 Message-ID: Subject: Re: bug#64632: Feature request: downcase-char, downcase-initials To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000003e34ae0600872e24" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64632 Cc: 64632@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000003e34ae0600872e24 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable In my case, it would be helpful for writing snippets. I missed these functions when I was writing some snippets for some boilerplate code, where in some situations `upcase-initials` was helpful, and so would be `downcase-initials`. I'd guess a `downcase-initials-region` (like `upcase-initials-region`) could be useful in certain cases, like fixing function names in code, or even writing in general, but probably very situational. I understand equivalence alone wouldn't be enough to introduce new commands, but it _feels_ that is missing something having one way but not the other, especially when there's a `upcase-char` but not a `downcase-char`. And about `downcase-region` I don't think it would help in my case because I needed to down case only the initial character of the word, and it's interactive and requires an extra step (marking the region). Anyway, I wrote these functions to fix my issue, maybe it can help someone else: (they probably could be better since I don't know Emacs Lisp well, but worked for me) ``` (defun downcase-char (arg) "Downcasify ARG chars starting from point. Point doesn't move." (interactive "p") (save-excursion (downcase-region (point) (progn (forward-char arg) (point))))) (defun downcase-initial (string) "Downcase initial character of the string." (concat (downcase (substring string 0 1)) (substring string 1))) (defun downcase-initials (string) "Upcase the initial of each word in the string." (mapcar #'downcase-initial (split-string string "[^[:alpha:]]"))) (defun downcase-initials-region (beg end) "Upcase the initial of each word in the region." (interactive "r") (let ((region (buffer-substring-no-properties beg end))) (delete-region beg end) (insert (downcase region)))) ``` On Sat, Jul 15, 2023 at 3:06=E2=80=AFAM Eli Zaretskii wrote: > > From: Jos=C3=A9 J=C3=BAnior > > Date: Fri, 14 Jul 2023 20:31:42 -0300 > > > > Hi, my suggestion is to add equivalent functions for `upcase-char` and > `upcase-initials` but for > > downcase (`downcase-char` and `downcase-initials`). When I first these > functions, I expected to have > > the downcase equivalent for each of them. > > Thanks. > > In which situations would such commands be useful? We don't introduce > commands just because they are equivalents of others. > > Anyway, we already have downcase-region, which you could use to > downcase any range of characters, including a single character > anywhere in a word. > --0000000000003e34ae0600872e24 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In my case, it would be helpful for writing snippets.= I missed these functions when I was writing some snippets for some boilerp= late code, where in some situations `upcase-initials` was helpful, and so w= ould be `downcase-initials`. I'd guess a `downcase-initials-region` (li= ke `upcase-initials-region`) could be useful in certain cases, like fixing = function names in code, or even writing in general, but probably very situa= tional.

I understand equivalence alone wouldn&= #39;t be enough to introduce new commands, but it _feels_ that is missing s= omething having one way but not the other, especially when there's a `u= pcase-char` but not a `downcase-char`.

And abo= ut `downcase-region` I don't think it would help in my case because I n= eeded to down case only the initial character of the word, and it's int= eractive and requires an extra step (marking the region).

Anyway, I wrote these functions to fix my issue, maybe it can help = someone else:
(they probably could be better since I don't kn= ow Emacs Lisp well, but worked for me)

```
(defun downcase-char (arg)
=C2=A0 "Downcasify ARG chars starting= from point. Point doesn't move."
=C2=A0 (interactive "p&q= uot;)
=C2=A0 (save-excursion
=C2=A0 =C2=A0 (downcase-region (point) (= progn (forward-char arg) (point)))))

(defun downcase-initial (string= )
=C2=A0 "Downcase initial character of the string."
=C2=A0= (concat (downcase (substring string 0 1)) (substring string 1)))

(d= efun downcase-initials (string)
=C2=A0 "Upcase the initial of each = word in the string."
=C2=A0 (mapcar #'downcase-initial (split-s= tring string "[^[:alpha:]]")))

(defun downcase-initials-re= gion (beg end)
=C2=A0 "Upcase the initial of each word in the regio= n."
=C2=A0 (interactive "r")
=C2=A0 (let ((region (buf= fer-substring-no-properties beg end)))
=C2=A0 =C2=A0 (delete-region beg = end)
=C2=A0 =C2=A0 (insert (downcase region))))
```

On Sa= t, Jul 15, 2023 at 3:06=E2=80=AFAM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Jos=C3=A9 J=C3=BAnior &l= t;jjnilton@gmail.co= m>
> Date: Fri, 14 Jul 2023 20:31:42 -0300
>
> Hi, my suggestion is to add equivalent functions for `upcase-char` and= `upcase-initials` but for
> downcase (`downcase-char` and `downcase-initials`). When I first these= functions, I expected to have
> the downcase equivalent for each of them.

Thanks.

In which situations would such commands be useful?=C2=A0 We don't intro= duce
commands just because they are equivalents of others.

Anyway, we already have downcase-region, which you could use to
downcase any range of characters, including a single character
anywhere in a word.
--0000000000003e34ae0600872e24--