all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: Unable to request replace-string of " \t"
@ 2006-07-16  2:02 Bob Rogers
  2006-07-16  8:34 ` Andreas Schwab
  0 siblings, 1 reply; 11+ messages in thread
From: Bob Rogers @ 2006-07-16  2:02 UTC (permalink / raw)


   When invoking the replace-string command from the keyboard, spaces
seem to get dropped from the first argument to replace-string if
followed by a TAB character.  To reproduce:

   1.  "emacs -Q"

   2.  "M-x replace-string RET SPC TAB RET x RET".  It won't matter that
it doesn't replace anything.  Notice that the SPC and TAB are inserted
into the minibuffer normally, though the prompt after typing RET says
"Replace regexp ^I with: ", indicating that the SPC was deleted.

   3.  You can also do "C-x ESC ESC" to verify that the actual first
argument to replace-string consists of a single TAB.

   Wierd, eh?  I discovered it in an emacs built two weeks ago, and then
reproduced it in one built via "make bootstrap" from CVS as of about
half an hour ago.  I followed the trail as far as read_minibuf, but then
got lost.

					-- Bob Rogers
					   http://rgrjr.dyndns.org/

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

* [Fwd: Re: Bug: Unable to request replace-string of " \t"]
@ 2006-07-16  7:23   ` Andreas Roehler
  2006-07-16 16:33     ` Bug: Unable to request replace-string of " \t" Bob Rogers
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Roehler @ 2006-07-16  7:23 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: Re: Bug: Unable to request replace-string of " \t" --]
[-- Type: message/rfc822, Size: 1613 bytes --]

From: Andreas Roehler <andreas.roehler@easy-emacs.de>
To: Bob Rogers <rogers-emacs@rgrjr.dyndns.org>
Subject: Re: Bug: Unable to request replace-string of " \t"
Date: Sun, 16 Jul 2006 08:33:04 +0200
Message-ID: <44B9DDA0.8050202@easy-emacs.de>

Bob Rogers schrieb:
>    When invoking the replace-string command from the keyboard, spaces
> seem to get dropped from the first argument to replace-string if
> followed by a TAB character.  To reproduce:
>
>    1.  "emacs -Q"
>
>    2.  "M-x replace-string RET SPC TAB RET x RET".  It won't matter that
> it doesn't replace anything.  Notice that the SPC and TAB are inserted
> into the minibuffer normally, though the prompt after typing RET says
> "Replace regexp ^I with: ", indicating that the SPC was deleted.
>
>    3.  You can also do "C-x ESC ESC" to verify that the actual first
> argument to replace-string consists of a single TAB.
>
>    Wierd, eh?  I discovered it in an emacs built two weeks ago, and then
> reproduced it in one built via "make bootstrap" from CVS as of about
> half an hour ago.  I followed the trail as far as read_minibuf, but then
> got lost.
>
>   

This seems avoidable quoting both chars

"M-x replace-string RET C-q SPC C-q TAB RET x RET"

BTW is this in the docu? At a first glance searching at
`string-replace' I couldn't see it.

__
Andreas Roehler




[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-16  2:02 Bug: Unable to request replace-string of " \t" Bob Rogers
@ 2006-07-16  8:34 ` Andreas Schwab
  2006-07-16  7:23   ` [Fwd: Re: Bug: Unable to request replace-string of " \t"] Andreas Roehler
  2006-07-17  1:40   ` Richard Stallman
  0 siblings, 2 replies; 11+ messages in thread
From: Andreas Schwab @ 2006-07-16  8:34 UTC (permalink / raw)
  Cc: Emacs-Devel

Bob Rogers <rogers-emacs@rgrjr.dyndns.org> writes:

>    2.  "M-x replace-string RET SPC TAB RET x RET".  It won't matter that
> it doesn't replace anything.  Notice that the SPC and TAB are inserted
> into the minibuffer normally,

TAB runs the command indent-for-tab-command
   which is an interactive compiled Lisp function in `indent.el'.
It is bound to TAB.
(indent-for-tab-command &optional ARG)

> though the prompt after typing RET says
> "Replace regexp ^I with: ", indicating that the SPC was deleted.

Try C-q TAB instead.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-16  7:23   ` [Fwd: Re: Bug: Unable to request replace-string of " \t"] Andreas Roehler
@ 2006-07-16 16:33     ` Bob Rogers
  2006-07-17  1:02       ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Bob Rogers @ 2006-07-16 16:33 UTC (permalink / raw)
  Cc: emacs-devel

   From: Andreas Schwab <schwab@suse.de>
   Date: Sun, 16 Jul 2006 10:34:41 +0200

   Bob Rogers <rogers-emacs@rgrjr.dyndns.org> writes:

   >    2.  "M-x replace-string RET SPC TAB RET x RET".  It won't matter that
   > it doesn't replace anything.  Notice that the SPC and TAB are inserted
   > into the minibuffer normally,

   TAB runs the command indent-for-tab-command
      which is an interactive compiled Lisp function in `indent.el'.
   It is bound to TAB.
   (indent-for-tab-command &optional ARG)

OK, so it's nice that TAB canonicalizes preceding whitespace generally,
but why here?  Why should replace-string assume that I didn't really
mean what I literally typed?

   Furthermore, typing TAB also canonicalizes spaces in the *second*
argument to replace-string, which strikes me as clearly wrong:  " \t" is
not equivalent to "\t" in the replacement, which could start at any
column position.

   From: Andreas Roehler <andreas.roehler@easy-emacs.de>
   Date: Sun, 16 Jul 2006 09:23:11 +0200

   . . .

   BTW is this in the docu? At a first glance searching at
   `string-replace' I couldn't see it.

It does amount to a change in behavior from 21.3.  But I think it would
reduce the "surprise factor" (not to mention buggy behavior) by making
TAB insert itself for both replace-string arguments.  Is anyone actually
expecting TAB to have side effects here?

					-- Bob

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-16 16:33     ` Bug: Unable to request replace-string of " \t" Bob Rogers
@ 2006-07-17  1:02       ` Stefan Monnier
  2006-07-17  1:44         ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2006-07-17  1:02 UTC (permalink / raw)
  Cc: Andreas Schwab, Andreas Roehler, emacs-devel

> It does amount to a change in behavior from 21.3.  But I think it would
> reduce the "surprise factor" (not to mention buggy behavior) by making
> TAB insert itself for both replace-string arguments.  Is anyone actually
> expecting TAB to have side effects here?

Agreed.  We should probably bind TAB to `insert-tab' in
minibuffer-local-map.  Any objection?


        Stefan

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-16  8:34 ` Andreas Schwab
  2006-07-16  7:23   ` [Fwd: Re: Bug: Unable to request replace-string of " \t"] Andreas Roehler
@ 2006-07-17  1:40   ` Richard Stallman
  2006-07-17  1:48     ` Drew Adams
  2006-07-17  3:25     ` Stefan Monnier
  1 sibling, 2 replies; 11+ messages in thread
From: Richard Stallman @ 2006-07-17  1:40 UTC (permalink / raw)
  Cc: rogers-emacs, emacs-devel

    TAB runs the command indent-for-tab-command
       which is an interactive compiled Lisp function in `indent.el'.
    It is bound to TAB.
    (indent-for-tab-command &optional ARG)

Maybe that minibuffer -- or all minibuffers -- should rebind TAB.

If this has changed since Emacs 21, 
can anyone see why the change occurred?

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

* RE: Bug: Unable to request replace-string of " \t"
  2006-07-17  1:02       ` Stefan Monnier
@ 2006-07-17  1:44         ` Drew Adams
  2006-07-17  3:20           ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2006-07-17  1:44 UTC (permalink / raw)


    We should probably bind TAB to `insert-tab' in
    minibuffer-local-map.  Any objection?

What's wrong with `self-insert-command'? Isn't that what Bob was saying he
expected: just insert a TAB character?

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

* RE: Bug: Unable to request replace-string of " \t"
  2006-07-17  1:40   ` Richard Stallman
@ 2006-07-17  1:48     ` Drew Adams
  2006-07-17  3:25     ` Stefan Monnier
  1 sibling, 0 replies; 11+ messages in thread
From: Drew Adams @ 2006-07-17  1:48 UTC (permalink / raw)


    Maybe that minibuffer -- or all minibuffers -- should rebind TAB.

Not sure what you mean by "all minibuffers". The completion maps bind TAB to
completion commands, as they should.

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-17  1:44         ` Drew Adams
@ 2006-07-17  3:20           ` Stefan Monnier
  2006-07-18  0:12             ` Richard Stallman
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2006-07-17  3:20 UTC (permalink / raw)
  Cc: emacs-devel

>     We should probably bind TAB to `insert-tab' in
>     minibuffer-local-map.  Any objection?

> What's wrong with `self-insert-command'? Isn't that what Bob was saying he
> expected: just insert a TAB character?

I wasn't sure it works for the `tab' key (mapped to TAB via
function-key-map), but it looks like the `ascii-character' property on the
`tab' symbol does make it work, so maybe that's a better choice.  I don't
care either way, the main question is whether to override the usual binding.


        Stefan

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-17  1:40   ` Richard Stallman
  2006-07-17  1:48     ` Drew Adams
@ 2006-07-17  3:25     ` Stefan Monnier
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2006-07-17  3:25 UTC (permalink / raw)
  Cc: Andreas Schwab, rogers-emacs, emacs-devel

>     TAB runs the command indent-for-tab-command
>        which is an interactive compiled Lisp function in `indent.el'.
>     It is bound to TAB.
>     (indent-for-tab-command &optional ARG)

> Maybe that minibuffer -- or all minibuffers -- should rebind TAB.

> If this has changed since Emacs 21,
> can anyone see why the change occurred?

I believe it's a side-effect of a change I made a while back which changed
the global indent-line-function from indent-to-left-margin (used for
paragraph-indent-text-mode) to indent-relative (used for the "new"
text-mode, formerly known as indent-text-mode).

I believe the right thing to do is to rebind TAB in minibuffer-local-map.


        Stefan

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

* Re: Bug: Unable to request replace-string of " \t"
  2006-07-17  3:20           ` Stefan Monnier
@ 2006-07-18  0:12             ` Richard Stallman
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2006-07-18  0:12 UTC (permalink / raw)
  Cc: drew.adams, emacs-devel

    I wasn't sure it works for the `tab' key (mapped to TAB via
    function-key-map), but it looks like the `ascii-character' property on the
    `tab' symbol does make it work, so maybe that's a better choice.  I don't
    care either way, the main question is whether to override the usual binding.

What binding did it have in Emacs 21?  And why was it changed?

    I believe it's a side-effect of a change I made a while back which changed
    the global indent-line-function from indent-to-left-margin (used for
    paragraph-indent-text-mode) to indent-relative (used for the "new"
    text-mode, formerly known as indent-text-mode).

In that case, since it was not changed intentionally, definitely let's
change it back.

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

end of thread, other threads:[~2006-07-18  0:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-16  2:02 Bug: Unable to request replace-string of " \t" Bob Rogers
2006-07-16  8:34 ` Andreas Schwab
2006-07-16  7:23   ` [Fwd: Re: Bug: Unable to request replace-string of " \t"] Andreas Roehler
2006-07-16 16:33     ` Bug: Unable to request replace-string of " \t" Bob Rogers
2006-07-17  1:02       ` Stefan Monnier
2006-07-17  1:44         ` Drew Adams
2006-07-17  3:20           ` Stefan Monnier
2006-07-18  0:12             ` Richard Stallman
2006-07-17  1:40   ` Richard Stallman
2006-07-17  1:48     ` Drew Adams
2006-07-17  3:25     ` Stefan Monnier

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.