GNU bug report logs -
#64632
Feature request: downcase-char, downcase-initials
Previous Next
To reply to this bug, email your comments to 64632 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64632
; Package
emacs
.
(Fri, 14 Jul 2023 23:33:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
José Júnior <jjnilton <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 14 Jul 2023 23:33:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64632
; Package
emacs
.
(Sat, 15 Jul 2023 06:07:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 64632 <at> debbugs.gnu.org (full text, mbox):
> From: José Júnior <jjnilton <at> gmail.com>
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64632
; Package
emacs
.
(Sat, 15 Jul 2023 14:15:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 64632 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: José Júnior <jjnilton <at> gmail.com>
> > 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.
>
[Message part 2 (text/html, inline)]
This bug report was last modified 1 year and 340 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.