unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Provide numerical argument to indent-rigidly-right
@ 2021-11-11 11:17 Andreas Röhler
  2021-11-13 10:03 ` Robert Pluim
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Röhler @ 2021-11-11 11:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

what about providing a numerical argument to indent-rigidly-right

Like this:

(defun ar-indent-rigidly-right (beg end times)
   "Indent all lines between BEG and END rightward by TIMES space(s)."
   (interactive "r\np")
   (dotimes (i times nil)
     (progn (indent-rigidly
         beg end
         (if (eq (current-bidi-paragraph-direction) 'right-to-left) -1 
1)))))

Best,

Andreas




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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-11 11:17 Provide numerical argument to indent-rigidly-right Andreas Röhler
@ 2021-11-13 10:03 ` Robert Pluim
  2021-11-13 12:18   ` Andreas Röhler
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2021-11-13 10:03 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

>>>>> On Thu, 11 Nov 2021 12:17:45 +0100, Andreas Röhler <andreas.roehler@easy-emacs.de> said:

    Andreas> Hi,
    Andreas> what about providing a numerical argument to indent-rigidly-right

What's wrong with `indent-rigidly'?

Robert
-- 



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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 10:03 ` Robert Pluim
@ 2021-11-13 12:18   ` Andreas Röhler
  2021-11-13 12:38     ` Robert Pluim
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Röhler @ 2021-11-13 12:18 UTC (permalink / raw)
  To: Robert Pluim; +Cc: help-gnu-emacs


Am 13.11.21 um 11:03 schrieb Robert Pluim:
>>>>>> On Thu, 11 Nov 2021 12:17:45 +0100, Andreas Röhler <andreas.roehler@easy-emacs.de> said:
>      Andreas> Hi,
>      Andreas> what about providing a numerical argument to indent-rigidly-right
>
> What's wrong with `indent-rigidly'?
>
> Robert


Here M-x indent-rigidly RET doesn't indent at all, but sends a message:

Indent region with <left>, <right>, S-<left>, or S-<right>.


That's not as simple as it could be.

Also, if once selected right, not being asked next time. How to indent 
left then?

Probably there is a docu...

However, IMO a command indenting left or right should not need much 
docu, it should just do it.

Thus indent-rigidly seems not first choice as a caller.


Andreas

being at GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
2.24.32, cairo version 1.16.0) of 2021-10-14






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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 12:18   ` Andreas Röhler
@ 2021-11-13 12:38     ` Robert Pluim
  2021-11-13 13:50       ` Andreas Röhler
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2021-11-13 12:38 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: Help GNU Emacs

Try calling it with a prefix arg (including a negative one)

Robert

On Sat, Nov 13, 2021, 13:18 Andreas Röhler <andreas.roehler@easy-emacs.de>
wrote:

>
> Am 13.11.21 um 11:03 schrieb Robert Pluim:
> >>>>>> On Thu, 11 Nov 2021 12:17:45 +0100, Andreas Röhler <
> andreas.roehler@easy-emacs.de> said:
> >      Andreas> Hi,
> >      Andreas> what about providing a numerical argument to
> indent-rigidly-right
> >
> > What's wrong with `indent-rigidly'?
> >
> > Robert
>
>
> Here M-x indent-rigidly RET doesn't indent at all, but sends a message:
>
> Indent region with <left>, <right>, S-<left>, or S-<right>.
>
>
> That's not as simple as it could be.
>
> Also, if once selected right, not being asked next time. How to indent
> left then?
>
> Probably there is a docu...
>
> However, IMO a command indenting left or right should not need much
> docu, it should just do it.
>
> Thus indent-rigidly seems not first choice as a caller.
>
>
> Andreas
>
> being at GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 2.24.32, cairo version 1.16.0) of 2021-10-14
>
>
>
>


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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 12:38     ` Robert Pluim
@ 2021-11-13 13:50       ` Andreas Röhler
  2021-11-13 16:54         ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-11-13 18:13         ` [External] : " Drew Adams
  0 siblings, 2 replies; 11+ messages in thread
From: Andreas Röhler @ 2021-11-13 13:50 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Help GNU Emacs


Am 13.11.21 um 13:38 schrieb Robert Pluim:
> Try calling it with a prefix arg (including a negative one)
>
> Robert
>
Calling with negative arg

M-- 4 indent-rigidly RET has no effect here. Bug?

Also

docstring says:


If called interactively with no prefix argument, activate a
transient mode in which the indentation can be adjusted interactively
by typing <left>, <right>, S-<left>, or S-<right>.
Typing any other key exits this mode, and this key is then
acted upon as normally.


That's too complex for such a simple thing.


Andreas

> On Sat, Nov 13, 2021, 13:18 Andreas Röhler 
> <andreas.roehler@easy-emacs.de <mailto:andreas.roehler@easy-emacs.de>> 
> wrote:
>
>
>     Am 13.11.21 um 11:03 schrieb Robert Pluim:
>     >>>>>> On Thu, 11 Nov 2021 12:17:45 +0100, Andreas Röhler
>     <andreas.roehler@easy-emacs.de
>     <mailto:andreas.roehler@easy-emacs.de>> said:
>     >      Andreas> Hi,
>     >      Andreas> what about providing a numerical argument to
>     indent-rigidly-right
>     >
>     > What's wrong with `indent-rigidly'?
>     >
>     > Robert
>
>
>     Here M-x indent-rigidly RET doesn't indent at all, but sends a
>     message:
>
>     Indent region with <left>, <right>, S-<left>, or S-<right>.
>
>
>     That's not as simple as it could be.
>
>     Also, if once selected right, not being asked next time. How to
>     indent
>     left then?
>
>     Probably there is a docu...
>
>     However, IMO a command indenting left or right should not need much
>     docu, it should just do it.
>
>     Thus indent-rigidly seems not first choice as a caller.
>
>
>     Andreas
>
>     being at GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+
>     Version
>     2.24.32, cairo version 1.16.0) of 2021-10-14
>
>
>


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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 13:50       ` Andreas Röhler
@ 2021-11-13 16:54         ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-11-13 18:36           ` Eli Zaretskii
  2021-11-14  9:07           ` Andreas Röhler
  2021-11-13 18:13         ` [External] : " Drew Adams
  1 sibling, 2 replies; 11+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-11-13 16:54 UTC (permalink / raw)
  To: help-gnu-emacs

> M-- 4 M-x indent-rigidly RET has no effect here. Bug?

Sounds like it: it should strip (upto) 4 spaces from the beginning of
each line in the region.

`M-x report-emacs-bug` if it doesn't.


        Stefan




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

* RE: [External] : Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 13:50       ` Andreas Röhler
  2021-11-13 16:54         ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-11-13 18:13         ` Drew Adams
  1 sibling, 0 replies; 11+ messages in thread
From: Drew Adams @ 2021-11-13 18:13 UTC (permalink / raw)
  To: Andreas Röhler, Robert Pluim; +Cc: Help GNU Emacs

> Calling with negative arg
> M-- 4 indent-rigidly RET has no effect here. Bug?

Did you select the text to outdent (i.e., active
region)?  Did you use `M-- 4 C-x TAB'?

If not, there's your problem.
If yes, `M-x report-emacs-bug'.

> If called interactively with no prefix argument, activate a
> transient mode in which the indentation can be adjusted interactively
> by typing <left>, <right>, S-<left>, or S-<right>.
> Typing any other key exits this mode, and this key is then
> acted upon as normally.
> 
> That's too complex for such a simple thing.

Is using a prefix arg too complex?  You're not
obliged to use incremental indenting/outdenting.

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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 16:54         ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-11-13 18:36           ` Eli Zaretskii
  2021-11-13 20:00             ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-11-14  9:07           ` Andreas Röhler
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2021-11-13 18:36 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 13 Nov 2021 11:54:53 -0500
> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> > M-- 4 M-x indent-rigidly RET has no effect here. Bug?
> 
> Sounds like it: it should strip (upto) 4 spaces from the beginning of
> each line in the region.

Only if there are spaces at the beginning of each line.



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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 18:36           ` Eli Zaretskii
@ 2021-11-13 20:00             ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-11-13 20:17               ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-11-13 20:00 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii [2021-11-13 20:36:26] wrote:
>> Date: Sat, 13 Nov 2021 11:54:53 -0500
>> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>> > M-- 4 M-x indent-rigidly RET has no effect here. Bug?
>> Sounds like it: it should strip (upto) 4 spaces from the beginning of
>> each line in the region.
> Only if there are spaces at the beginning of each line.

That's what I meant by "upto", indeed.


        Stefan




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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 20:00             ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-11-13 20:17               ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2021-11-13 20:17 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 13 Nov 2021 15:00:35 -0500
> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> Eli Zaretskii [2021-11-13 20:36:26] wrote:
> >> Date: Sat, 13 Nov 2021 11:54:53 -0500
> >> From:  Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> >> > M-- 4 M-x indent-rigidly RET has no effect here. Bug?
> >> Sounds like it: it should strip (upto) 4 spaces from the beginning of
> >> each line in the region.
> > Only if there are spaces at the beginning of each line.
> 
> That's what I meant by "upto", indeed.

Well, if "upto" yields zero spaces, then the OP will think that
"nothing happened".



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

* Re: Provide numerical argument to indent-rigidly-right
  2021-11-13 16:54         ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-11-13 18:36           ` Eli Zaretskii
@ 2021-11-14  9:07           ` Andreas Röhler
  1 sibling, 0 replies; 11+ messages in thread
From: Andreas Röhler @ 2021-11-14  9:07 UTC (permalink / raw)
  To: help-gnu-emacs


Am 13.11.21 um 17:54 schrieb Stefan Monnier via Users list for the GNU 
Emacs text editor:
>> M-- 4 M-x indent-rigidly RET has no effect here. Bug?
> Sounds like it: it should strip (upto) 4 spaces from the beginning of
> each line in the region.
>
> `M-x report-emacs-bug` if it doesn't.
>
>
>          Stefan
>
>

Works fine in emacs -Q

Turns out had a bad key-setting in my init, which blocked all negative 
prefixing:

Bad: (global-set-key [(meta ?-)] 'some-command)


Thanks all,

Andreas




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

end of thread, other threads:[~2021-11-14  9:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-11 11:17 Provide numerical argument to indent-rigidly-right Andreas Röhler
2021-11-13 10:03 ` Robert Pluim
2021-11-13 12:18   ` Andreas Röhler
2021-11-13 12:38     ` Robert Pluim
2021-11-13 13:50       ` Andreas Röhler
2021-11-13 16:54         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-13 18:36           ` Eli Zaretskii
2021-11-13 20:00             ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-13 20:17               ` Eli Zaretskii
2021-11-14  9:07           ` Andreas Röhler
2021-11-13 18:13         ` [External] : " Drew Adams

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).