all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#46783: Catch mistaken (query-replace "a" "a")
@ 2021-02-25 22:27 積丹尼 Dan Jacobson
  2021-02-26  8:57 ` Lars Ingebrigtsen
  2021-02-27 16:10 ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-02-25 22:27 UTC (permalink / raw)
  To: 46783

(query-replace "a" "a") should ask "Are you sure?"
Better yet: "Are you nuts?"...

So how could it happen?

Well, e.g.,
the user needs to replace some character with a similar character, all
through the document. So similar in fact that it is hard to tell the
difference.

Therefore emacs should be a good Samaritan and please "Refuse loudly to
do one big no-op that will make the user furious once he discovers he
meticulously did... *nothing at all*."

Imagine answering
ynnyynnnnnnyynynnnynyyyyynynyyyyyynnnnynnnynynynyny only to find out it was just a big
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn !

So emacs should simply double check the strings before starting.

No the user can't always tell, no matter how hard he looks, if they are
the same or not.

One might say "well there are still some uses for replacing the same
thing with itself." No, wrong.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-25 22:27 bug#46783: Catch mistaken (query-replace "a" "a") 積丹尼 Dan Jacobson
@ 2021-02-26  8:57 ` Lars Ingebrigtsen
  2021-02-26  9:49   ` Robert Pluim
  2021-02-26 15:59   ` bug#46783: [External] : " Drew Adams
  2021-02-27 16:10 ` Richard Stallman
  1 sibling, 2 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-26  8:57 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 46783

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

> One might say "well there are still some uses for replacing the same
> thing with itself." No, wrong.

There is -- to remove text properties.

I'm not sure that's a compelling use case, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-26  8:57 ` Lars Ingebrigtsen
@ 2021-02-26  9:49   ` Robert Pluim
  2021-02-27  4:15     ` Lars Ingebrigtsen
  2021-02-26 15:59   ` bug#46783: [External] : " Drew Adams
  1 sibling, 1 reply; 9+ messages in thread
From: Robert Pluim @ 2021-02-26  9:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 46783, 積丹尼 Dan Jacobson

>>>>> On Fri, 26 Feb 2021 09:57:09 +0100, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> 積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:
    >> One might say "well there are still some uses for replacing the same
    >> thing with itself." No, wrong.

    Lars> There is -- to remove text properties.

    Lars> I'm not sure that's a compelling use case, though.

I find the following quite useful:

(require 'char-fold)
(setq replace-char-fold t)
C-x 8 RET e1 RET
(goto-char (point-min)
M-x query-replace RET a RET a

Robert
-- 





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: [External] : bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-26  8:57 ` Lars Ingebrigtsen
  2021-02-26  9:49   ` Robert Pluim
@ 2021-02-26 15:59   ` Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2021-02-26 15:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen, 積丹尼 Dan Jacobson
  Cc: 46783@debbugs.gnu.org

> > One might say "well there are still some uses for
> > replacing the same thing with itself." No, wrong.
> 
> There is -- to remove text properties.

This.

It's also possible that someone wants to use
the query-replace dialog as a means of either
navigating or checking something at each
occurrence (e.g. looking at the context),
e.g., as an alternative to using Isearch or
`occur'.

Yes, there are other ways to accomplish such
aims, but each way to accomplish something
can have advantages and disadvantages.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-26  9:49   ` Robert Pluim
@ 2021-02-27  4:15     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-27  4:15 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 46783, 積丹尼 Dan Jacobson

Robert Pluim <rpluim@gmail.com> writes:

> I find the following quite useful:
>
> (require 'char-fold)
> (setq replace-char-fold t)
> C-x 8 RET e1 RET
> (goto-char (point-min)
> M-x query-replace RET a RET a

Right.  So there are at least two use cases for doing
(query-replace "a" "a"), so having `query-replace' query the user here
seems like it would be annoying.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-25 22:27 bug#46783: Catch mistaken (query-replace "a" "a") 積丹尼 Dan Jacobson
  2021-02-26  8:57 ` Lars Ingebrigtsen
@ 2021-02-27 16:10 ` Richard Stallman
  2021-02-27 23:07   ` 積丹尼 Dan Jacobson
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2021-02-27 16:10 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 46783

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > (query-replace "a" "a") should ask "Are you sure?"
  > Better yet: "Are you nuts?"...

Emacs should not say such mean things to users.
It should follow the Kind Communication Guidelines.

It could say, "Are you serious?"

But that has a flaw: it fails to say what the concrete issue is.  We
can't assume the user will figure this out from a vague expression of
doubt, whether kind or not.  Emavs must inform per.

So it could say, "FROM-STRING and TO-STRING are identical -- are you serious?"

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-27 16:10 ` Richard Stallman
@ 2021-02-27 23:07   ` 積丹尼 Dan Jacobson
  2021-02-28  6:17     ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-02-27 23:07 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 46783

>>>>> "RMS" == Richard Stallman <rms@gnu.org> writes:

RMS> So it could say, "FROM-STRING and TO-STRING are identical -- are you serious?"

Excellent points.

And for those power users who really are always serious, there could be
a query-replace-skip-mental-health-check . Oops, I meant
query-replace-skip-identical-string-check,
or a dialog:

You have used identical strings for both FROM-STRING and TO-STRING.

Press:

b to blunder on ahead ("Don't question my logic. I have my reasons.")
! to blunder on ahead and remember this for the remainder of your days.
q to "quit while you are ahead."
x to always bomb out forever. No more late night cocktails.
d to launch the Emacs Eliza doctor program.
9 to call in a real doctor.
7 to show the Seven Signs of Senility checklist.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-27 23:07   ` 積丹尼 Dan Jacobson
@ 2021-02-28  6:17     ` Richard Stallman
  2021-03-01  3:52       ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2021-02-28  6:17 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 46783

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Press:

  > b to blunder on ahead ("Don't question my logic. I have my reasons.")
  > ! to blunder on ahead and remember this for the remainder of your days.
  > q to "quit while you are ahead."
  > x to always bomb out forever. No more late night cocktails.
  > d to launch the Emacs Eliza doctor program.
  > 9 to call in a real doctor.
  > 7 to show the Seven Signs of Senility checklist.

Could you have this ready for release by April 1 -- with documentation?

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#46783: Catch mistaken (query-replace "a" "a")
  2021-02-28  6:17     ` Richard Stallman
@ 2021-03-01  3:52       ` 積丹尼 Dan Jacobson
  0 siblings, 0 replies; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-03-01  3:52 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 46783

>>>>> "RMS" == Richard Stallman <rms@gnu.org> writes:
RMS> Could you have this ready for release by April 1 -- with documentation?

Wait, don't forget EmacsCare™!
EmacsCare™, on by default, monitors the user's keystrokes 24 hours a day for
signs of OldTimersDisease. Holding down keys too long, saliva dribbling
on the keyboard, etc. will all notify caretakers to check on the
grandperson.

Keyboard navigation errors, and bad cognitive choices, like "trading
apples for apples" also calculate in one's final score. Sent to
caretakers every month.

Though there is no cure yet for OldTimersDisease, EmacsCare™ is ready
for the Baby Boomers now reaching their golden years and worse.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-01  3:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-25 22:27 bug#46783: Catch mistaken (query-replace "a" "a") 積丹尼 Dan Jacobson
2021-02-26  8:57 ` Lars Ingebrigtsen
2021-02-26  9:49   ` Robert Pluim
2021-02-27  4:15     ` Lars Ingebrigtsen
2021-02-26 15:59   ` bug#46783: [External] : " Drew Adams
2021-02-27 16:10 ` Richard Stallman
2021-02-27 23:07   ` 積丹尼 Dan Jacobson
2021-02-28  6:17     ` Richard Stallman
2021-03-01  3:52       ` 積丹尼 Dan Jacobson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.