all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using string-rectangle more than once
@ 2013-11-07 15:36 Sebastien Vauban
  2013-11-07 15:48 ` Michael Heerdegen
       [not found] ` <mailman.5495.1383839347.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Sebastien Vauban @ 2013-11-07 15:36 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Hello,

Since not so long, I've discovered `string-rectangle' to replace rectangle
contents (each line of it) with some string.

That works perfectly the first time, but I have problem for the second one...

Suppose I want to replace `-' by `+' in the following list:

--8<---------------cut here---------------start------------->8---
- First
- Second
--8<---------------cut here---------------end--------------->8---

I call `C-x r t' on the right region (for example, a colon of two-chars wide),
and type `+ ' as the replacement string.

--8<---------------cut here---------------start------------->8---
+ First
+ Second
--8<---------------cut here---------------end--------------->8---

Now, I want to replace the `+' and the following space by nothing: I want to
remove the "list" aspect.

I do select the same region, call `C-x r t', and have to type the empty string.
But pressing RET selects the default, that is the last replacement string...
which is not empty.

How to pass an empty string, then?

Best regards,
  Seb

-- 
Sebastien Vauban


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

* Re: Using string-rectangle more than once
  2013-11-07 15:36 Using string-rectangle more than once Sebastien Vauban
@ 2013-11-07 15:48 ` Michael Heerdegen
       [not found] ` <mailman.5495.1383839347.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Heerdegen @ 2013-11-07 15:48 UTC (permalink / raw)
  To: help-gnu-emacs

"Sebastien Vauban" <sva-news@mygooglest.com>
writes:

> I do select the same region, call `C-x r t', and have to type the
> empty string.  But pressing RET selects the default, that is the last
> replacement string...  which is not empty.
>
> How to pass an empty string, then?

I would just kill the rectangle instead: C-x r k.


Regards,

Michael.




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

* Re: Using string-rectangle more than once
       [not found] ` <mailman.5495.1383839347.10748.help-gnu-emacs@gnu.org>
@ 2013-11-07 15:58   ` Sebastien Vauban
  2013-11-07 16:36     ` Michael Heerdegen
  0 siblings, 1 reply; 13+ messages in thread
From: Sebastien Vauban @ 2013-11-07 15:58 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Hello Michael,

Michael Heerdegen wrote:
> "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> writes:
>
>> I do select the same region, call `C-x r t', and have to type the
>> empty string.  But pressing RET selects the default, that is the last
>> replacement string...  which is not empty.
>>
>> How to pass an empty string, then?
>
> I would just kill the rectangle instead: C-x r k.

As you notice, my "rectangle" capability is still limited. And your solution is
correct, then.

Though, as this is common to many other situations, is there a way to pass the
empty string, instead of confirming to use the default proposition?

Best regards,
  Seb

-- 
Sebastien Vauban


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

* Re: Using string-rectangle more than once
  2013-11-07 15:58   ` Sebastien Vauban
@ 2013-11-07 16:36     ` Michael Heerdegen
  2013-11-07 16:45       ` Michael Heerdegen
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Michael Heerdegen @ 2013-11-07 16:36 UTC (permalink / raw)
  To: help-gnu-emacs

"Sebastien Vauban" <sva-news@mygooglest.com>
writes:

> Though, as this is common to many other situations, is there a way to
> pass the empty string, instead of confirming to use the default
> proposition?

In general, the behavior depends on how the code reads user input.
Without going much into details: in any situation where the empty string
is necessarily an available input option, it should be possible to enter
it (by hitting RET).  If not, it is a bug.

For your case (C-x r t), I think it is impossible to enter the empty
string at the prompt.  `repeat-complex-command' could be used to bypass
the problem, however.


Regards,

Michael.




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

* Re: Using string-rectangle more than once
  2013-11-07 16:36     ` Michael Heerdegen
@ 2013-11-07 16:45       ` Michael Heerdegen
  2013-11-07 17:21       ` Peter Dyballa
       [not found]       ` <mailman.5501.1383842734.10748.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Michael Heerdegen @ 2013-11-07 16:45 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Without going much into details: in any situation where the empty string
> is necessarily an available input option, it should be possible to enter
> it (by hitting RET).

Since I know you're using Helm: in Helm the empty string can be entered
with <C-return> where appropriate.

Regards,

Michael.




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

* Re: Using string-rectangle more than once
  2013-11-07 16:36     ` Michael Heerdegen
  2013-11-07 16:45       ` Michael Heerdegen
@ 2013-11-07 17:21       ` Peter Dyballa
       [not found]       ` <mailman.5501.1383842734.10748.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Peter Dyballa @ 2013-11-07 17:21 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


Am 07.11.2013 um 17:36 schrieb Michael Heerdegen:

> In general, the behavior depends on how the code reads user input.
> Without going much into details: in any situation where the empty string
> is necessarily an available input option, it should be possible to enter
> it (by hitting RET).

There is really no sense in entering the "empty string" as argument to string-rectangle. It won't do nothing.

String-rectangle has a side-effect: The selected rectangle is overwritten. But no-one would select a rectangle to overwrite with nothing. It takes much too many key strokes to achieve as a side-effect what kill-rectangle can perform directly.

And kill-rectangle has an optional third argument: FILL. Let's wonder what this third argument might do!

--
Greetings

  Pete

If it dies, it's biology.  If it blows up, it's chemistry. If it doesn't work, it's physics.
			– University washroom sgraffito




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

* Re: Using string-rectangle more than once
       [not found]         ` <mailman.5501.1383842734.10748.help-gnu-emacs-mXXj517/zsQ@public.gmane.org>
@ 2013-11-12 20:34           ` Sebastien Vauban
  2013-11-13  0:56             ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Sebastien Vauban @ 2013-11-12 20:34 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs-mXXj517/zsQ

Michael Heerdegen wrote:
> Michael Heerdegen <michael_heerdegen-S0/GAf8tV78@public.gmane.org> writes:
>
>> Without going much into details: in any situation where the empty string
>> is necessarily an available input option, it should be possible to enter
>> it (by hitting RET).
>
> Since I know you're using Helm: in Helm the empty string can be entered
> with <C-return> where appropriate.

Thanks for your answers.

It is clear that I have to use `C-x r k'...

Best regards,
  Seb

-- 
Sebastien Vauban



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

* Re: Using string-rectangle more than once
  2013-11-12 20:34           ` Sebastien Vauban
@ 2013-11-13  0:56             ` Stefan Monnier
  2013-11-14  7:55               ` Suvayu Ali
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-11-13  0:56 UTC (permalink / raw)
  To: help-gnu-emacs

> It is clear that I have to use `C-x r k'...

Or C-x r d which just "deletes" the rectangle, without "killing" it.
On the Emacs trunk, you can do: C-x SPC <..move..around..> DEL to delete
the rectangle and C-x SPC <..move..around..> C-t to invoke string-rectangle.


        Stefan




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

* Re: Using string-rectangle more than once
  2013-11-13  0:56             ` Stefan Monnier
@ 2013-11-14  7:55               ` Suvayu Ali
  2013-11-14 20:06                 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Suvayu Ali @ 2013-11-14  7:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Stefan,

On Tue, Nov 12, 2013 at 07:56:33PM -0500, Stefan Monnier wrote:
> > It is clear that I have to use `C-x r k'...
> 
> Or C-x r d which just "deletes" the rectangle, without "killing" it.
> On the Emacs trunk, you can do: C-x SPC <..move..around..> DEL to delete
> the rectangle and C-x SPC <..move..around..> C-t to invoke string-rectangle.

This does not seem to work for me.  On pressing `C-x SPC' anywhere, I
get backtrace:

  Debugger entered--Lisp error: (void-function gud-break)
    indirect-function(gud-break)
    command-execute(gud-break)

`C-h k C-x SPC' tells me:

  C-x SPC runs the command gud-break, which is an alias for `nil',
  which is not defined.  Please make a bug report.

I do not have any gud related binding in my setup.

Is this a bug?

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Using string-rectangle more than once
  2013-11-14  7:55               ` Suvayu Ali
@ 2013-11-14 20:06                 ` Stefan Monnier
  2013-11-14 23:53                   ` Suvayu Ali
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-11-14 20:06 UTC (permalink / raw)
  To: help-gnu-emacs

> Is this a bug?

Yes a known one (that appears if you've somehow loaded gud.el without
actually using gud).


        Stefan




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

* Re: Using string-rectangle more than once
  2013-11-14 20:06                 ` Stefan Monnier
@ 2013-11-14 23:53                   ` Suvayu Ali
  2013-11-15 13:23                     ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Suvayu Ali @ 2013-11-14 23:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, Nov 14, 2013 at 03:06:10PM -0500, Stefan Monnier wrote:
> > Is this a bug?
> 
> Yes a known one (that appears if you've somehow loaded gud.el without
> actually using gud).

Thanks, I tried in a fresh Emacs session.  The keybindings you posted
worked nicely.  I would like to use them, I run emacs --daemon.  Is
there a way to work around the bug?  I tried unloading gud with
unload-feature, but that did not help.

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Using string-rectangle more than once
  2013-11-14 23:53                   ` Suvayu Ali
@ 2013-11-15 13:23                     ` Stefan Monnier
  2013-11-16 13:28                       ` Suvayu Ali
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-11-15 13:23 UTC (permalink / raw)
  To: help-gnu-emacs

>> > Is this a bug?
>> Yes a known one (that appears if you've somehow loaded gud.el without
>> actually using gud).
> Thanks, I tried in a fresh Emacs session.  The keybindings you posted
> worked nicely.  I would like to use them, I run emacs --daemon.  Is
> there a way to work around the bug?  I tried unloading gud with
> unload-feature, but that did not help.

You can try to update: I fixed the problem yesterday,


        Stefan




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

* Re: Using string-rectangle more than once
  2013-11-15 13:23                     ` Stefan Monnier
@ 2013-11-16 13:28                       ` Suvayu Ali
  0 siblings, 0 replies; 13+ messages in thread
From: Suvayu Ali @ 2013-11-16 13:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Nov 15, 2013 at 08:23:15AM -0500, Stefan Monnier wrote:
> >> > Is this a bug?
> >> Yes a known one (that appears if you've somehow loaded gud.el without
> >> actually using gud).
> > Thanks, I tried in a fresh Emacs session.  The keybindings you posted
> > worked nicely.  I would like to use them, I run emacs --daemon.  Is
> > there a way to work around the bug?  I tried unloading gud with
> > unload-feature, but that did not help.
> 
> You can try to update: I fixed the problem yesterday,

It works, thank you.

:)

-- 
Suvayu

Open source is the future. It sets us free.



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

end of thread, other threads:[~2013-11-16 13:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 15:36 Using string-rectangle more than once Sebastien Vauban
2013-11-07 15:48 ` Michael Heerdegen
     [not found] ` <mailman.5495.1383839347.10748.help-gnu-emacs@gnu.org>
2013-11-07 15:58   ` Sebastien Vauban
2013-11-07 16:36     ` Michael Heerdegen
2013-11-07 16:45       ` Michael Heerdegen
2013-11-07 17:21       ` Peter Dyballa
     [not found]       ` <mailman.5501.1383842734.10748.help-gnu-emacs@gnu.org>
     [not found]         ` <mailman.5501.1383842734.10748.help-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-12 20:34           ` Sebastien Vauban
2013-11-13  0:56             ` Stefan Monnier
2013-11-14  7:55               ` Suvayu Ali
2013-11-14 20:06                 ` Stefan Monnier
2013-11-14 23:53                   ` Suvayu Ali
2013-11-15 13:23                     ` Stefan Monnier
2013-11-16 13:28                       ` Suvayu Ali

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.