* Quote marked region [utilities]
@ 2021-03-28 9:59 Jean Louis
2021-03-28 10:06 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Jean Louis @ 2021-03-28 9:59 UTC (permalink / raw)
To: Help GNU Emacs
Few utilities I have made today for quoting marked region with quotes
or escaped quotes. Very simple and handy when editing quoted strings,
like function descriptions or similar. Who knows, maybe it already
exists in Emacs.
(defun quote-region-single (start end)
"Quotes marked region with single quotes."
(interactive "r")
(goto-char end)
(insert "'")
(goto-char start)
(insert "'"))
(defun quote-region-double (start end)
"Quotes marked region with double quotes."
(interactive "r")
(goto-char end)
(insert "\"")
(goto-char start)
(insert "\""))
(defun quote-region-double-escaped (start end)
"Quotes marked region with escaped double quotes."
(interactive "r")
(goto-char end)
(insert "\\\"")
(goto-char start)
(insert "\\\""))
Jean
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 9:59 Quote marked region [utilities] Jean Louis
@ 2021-03-28 10:06 ` Eli Zaretskii
2021-03-28 10:09 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-03-28 10:06 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 28 Mar 2021 12:59:17 +0300
> From: Jean Louis <bugs@gnu.support>
>
> Few utilities I have made today for quoting marked region with quotes
> or escaped quotes. Very simple and handy when editing quoted strings,
> like function descriptions or similar. Who knows, maybe it already
> exists in Emacs.
See combine-and-quote-strings. (Did you try using "M-x apropos" to
find something like that?)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 10:06 ` Eli Zaretskii
@ 2021-03-28 10:09 ` Eli Zaretskii
2021-03-28 10:21 ` Jean Louis
2021-03-28 10:23 ` Jean Louis
2 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-03-28 10:09 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 28 Mar 2021 13:06:46 +0300
> From: Eli Zaretskii <eliz@gnu.org>
>
> See combine-and-quote-strings.
Or maybe replace-region-contents.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 10:06 ` Eli Zaretskii
2021-03-28 10:09 ` Eli Zaretskii
@ 2021-03-28 10:21 ` Jean Louis
2021-03-28 10:29 ` Eli Zaretskii
2021-03-28 10:23 ` Jean Louis
2 siblings, 1 reply; 8+ messages in thread
From: Jean Louis @ 2021-03-28 10:21 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
* Eli Zaretskii <eliz@gnu.org> [2021-03-28 13:07]:
> > Date: Sun, 28 Mar 2021 12:59:17 +0300
> > From: Jean Louis <bugs@gnu.support>
> >
> > Few utilities I have made today for quoting marked region with quotes
> > or escaped quotes. Very simple and handy when editing quoted strings,
> > like function descriptions or similar. Who knows, maybe it already
> > exists in Emacs.
>
> See combine-and-quote-strings. (Did you try using "M-x apropos" to
> find something like that?)
`combine-and-quote-strings' seem handy for lists of strings. It is not
interactive function that works on region, and my function does not
yet work on list of strings
M-x apropos is definitely useful, but I have not tried searching that
way. I have tried in a different way by using `C-h f' with joker
symbol `*' and `quote' with TAB, for example, it looks like:
Describe function: *quote*reg<TAB><TAB>
or
Describe function: *reg*quote<TAB><TAB>
or
Describe function: *quote*stri<TAB><TAB>
or
Describe function: *strin*quote<TAB><TAB>
and other good way to find functions is by using some of completion
packages like `ivy' as then one can type one or two words and find it
in reverse order.
Jean
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 10:06 ` Eli Zaretskii
2021-03-28 10:09 ` Eli Zaretskii
2021-03-28 10:21 ` Jean Louis
@ 2021-03-28 10:23 ` Jean Louis
2021-03-28 10:30 ` Eli Zaretskii
2 siblings, 1 reply; 8+ messages in thread
From: Jean Louis @ 2021-03-28 10:23 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
* Eli Zaretskii <eliz@gnu.org> [2021-03-28 13:07]:
> > Date: Sun, 28 Mar 2021 12:59:17 +0300
> > From: Jean Louis <bugs@gnu.support>
> >
> > Few utilities I have made today for quoting marked region with quotes
> > or escaped quotes. Very simple and handy when editing quoted strings,
> > like function descriptions or similar. Who knows, maybe it already
> > exists in Emacs.
Actually, I was thinking it could exist under some different names not
related to "quote".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 10:21 ` Jean Louis
@ 2021-03-28 10:29 ` Eli Zaretskii
2021-03-28 10:38 ` Jean Louis
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-03-28 10:29 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 28 Mar 2021 13:21:15 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: help-gnu-emacs@gnu.org
>
> > See combine-and-quote-strings. (Did you try using "M-x apropos" to
> > find something like that?)
>
> `combine-and-quote-strings' seem handy for lists of strings. It is not
> interactive function that works on region, and my function does not
> yet work on list of strings
But it's trivial to make use of combine-and-quote-strings, coupled
with buffer-substring, to produce a command that works on the region,
no?
> M-x apropos is definitely useful, but I have not tried searching that
> way. I have tried in a different way by using `C-h f' with joker
> symbol `*' and `quote' with TAB, for example, it looks like:
That's much less efficient. Try this instead:
M-x apropos RET string quote RET
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 10:23 ` Jean Louis
@ 2021-03-28 10:30 ` Eli Zaretskii
0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-03-28 10:30 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 28 Mar 2021 13:23:20 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: help-gnu-emacs@gnu.org
>
> * Eli Zaretskii <eliz@gnu.org> [2021-03-28 13:07]:
> > > Date: Sun, 28 Mar 2021 12:59:17 +0300
> > > From: Jean Louis <bugs@gnu.support>
> > >
> > > Few utilities I have made today for quoting marked region with quotes
> > > or escaped quotes. Very simple and handy when editing quoted strings,
> > > like function descriptions or similar. Who knows, maybe it already
> > > exists in Emacs.
>
> Actually, I was thinking it could exist under some different names not
> related to "quote".
Before you conclude that, you had better exhausted all the possible
ways of searching for a function whose name does use "quote".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Quote marked region [utilities]
2021-03-28 10:29 ` Eli Zaretskii
@ 2021-03-28 10:38 ` Jean Louis
0 siblings, 0 replies; 8+ messages in thread
From: Jean Louis @ 2021-03-28 10:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
* Eli Zaretskii <eliz@gnu.org> [2021-03-28 13:30]:
> > Date: Sun, 28 Mar 2021 13:21:15 +0300
> > From: Jean Louis <bugs@gnu.support>
> > Cc: help-gnu-emacs@gnu.org
> >
> > > See combine-and-quote-strings. (Did you try using "M-x apropos" to
> > > find something like that?)
> >
> > `combine-and-quote-strings' seem handy for lists of strings. It is not
> > interactive function that works on region, and my function does not
> > yet work on list of strings
>
> But it's trivial to make use of combine-and-quote-strings, coupled
> with buffer-substring, to produce a command that works on the region,
> no?
>
> > M-x apropos is definitely useful, but I have not tried searching that
> > way. I have tried in a different way by using `C-h f' with joker
> > symbol `*' and `quote' with TAB, for example, it looks like:
>
> That's much less efficient. Try this instead:
>
> M-x apropos RET string quote RET
Definitely, I have to use apropos.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-03-28 10:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-28 9:59 Quote marked region [utilities] Jean Louis
2021-03-28 10:06 ` Eli Zaretskii
2021-03-28 10:09 ` Eli Zaretskii
2021-03-28 10:21 ` Jean Louis
2021-03-28 10:29 ` Eli Zaretskii
2021-03-28 10:38 ` Jean Louis
2021-03-28 10:23 ` Jean Louis
2021-03-28 10:30 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).