GNU bug report logs -
#18977
25.0.50; Enhance (fix) incremental `indent-rigidly'
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Thu, 6 Nov 2014 18:38:02 UTC
Severity: wishlist
Found in version 25.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18977 in the body.
You can then email your comments to 18977 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18977
; Package
emacs
.
(Thu, 06 Nov 2014 18:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 06 Nov 2014 18:38:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
1. Please consider adding this binding, so you can simply do `C-x TAB
TAB...': (define-key indent-rigidly-map "\t" 'indent-rigidly-right).
And update the doc string and prompt, of course.
2. You cannot currently provide a numeric prefix arg to `indent-rigidly'
for incremental use. The incremental indentation you get is either 1
column (for <right>) or to the next tab stop (for <S-right>).
It would be good to be able to use a numeric prefix arg interactively to
indent not only once, but each time you hit <right>.
Ironically, this was possible before the Emacs 24.4 change to
`indent-rigidly' which provided for incremental indenting, by just doing
something like this:
(defun repeat-command (command)
"Repeat COMMAND."
(let ((repeat-message-function 'ignore))
(setq last-repeatable-command command)
(repeat nil)))
(defun indent-rigidly-repeat (start end arg &optional interactive)
"Indent all lines that start in the region.
You can repeat this by hitting the last key (e.g., `TAB') again...
A numeric prefix arg you provide to the command is used as the
indentation increment."
(interactive "r\nP\np")
(require 'repeat nil t)
(repeat-command 'indent-rigidly))
(global-set-key [remap indent-rigidly] 'indent-rigidly-repeat)
Then `C-3 C-x TAB TAB...' indents 3 columns each time you hit `TAB';
`C-x TAB TAB...' indents 1 column for each `TAB'; and `C- 2 C-x TAB
TAB...' outdents 2 columns for each `TAB'. Very handy.
This design is simple, and it lets you use the same key, `TAB', to
indent or outdent incrementally (outdent by using a negative prefix
arg).
As written above, this does not, however, provide the useful feature of
a single undo for all repeated indenting, as does the current
implementation of `indent-rigidly'. And it does not provide for
indentation to tab stops. I am not proposing such a simple
implementation as a replacement for the current one.
This is the request: Could you please adapt `indent-rigidly' to provide
similar behavior to that shown above: Instead of using a numeric prefix
arg *only* for a single indentation, let users repeat indenting (or
outdenting) in prefix-arg steps.
3. A related improvement would be to provide also the other advantage of
the above code: Indenting/outdenting is *immediate* for `C-x TAB'.
Currently, no indentation is done until you hit <right> (or you use a
prefix arg, which turns off incremental indenting). This means that
currently you must hit at least 3 keys, `C-x TAB <right>' or `C-1 C-x
TAB', to indent. You cannot hit just `C-x TAB', as you could prior to
Emacs 24.4. (This is thus a minor regression in behavior.)
The best behavior is for `C-x TAB' to indent by the numerical prefix
number of columns, and to continue to do so as long as you continue to
hit <right> or `TAB'. <left> should similarly outdent by the prefix
arg. A negative prefix arg, and Bidi, should of course flip the
direction.
(Yes, if `C-x TAB' itself indents immediately then you will need to hit
<left> twice to outdent once. Not a big deal, IMO - outweighed by the
convenience of not needing to hit 3 keys for the common case of
indenting.)
I started to take a stab at this myself, but I found no good way to
propagate the prefix arg using the current implementation, which does
(set-transient-map indent-rigidly-map t).
In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
of 2014-10-20 on LEG570
Bzr revision: 118168 rgm <at> gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18977
; Package
emacs
.
(Thu, 12 May 2022 01:12:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18977 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
> 1. Please consider adding this binding, so you can simply do `C-x TAB
> TAB...': (define-key indent-rigidly-map "\t" 'indent-rigidly-right).
> And update the doc string and prompt, of course.
Makes sense; I've now added this to Emacs 29. (But not changed the
prompt.)
> 2. You cannot currently provide a numeric prefix arg to `indent-rigidly'
> for incremental use. The incremental indentation you get is either 1
> column (for <right>) or to the next tab stop (for <S-right>).
>
> It would be good to be able to use a numeric prefix arg interactively to
> indent not only once, but each time you hit <right>.
I don't think that makes much sense -- if you've decided to indent X
columns (by using the prefix), then you don't want to enter the
transient map thing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
18977 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 12 May 2022 01:12:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18977
; Package
emacs
.
(Thu, 12 May 2022 15:59:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 18977 <at> debbugs.gnu.org (full text, mbox):
> > 2. You cannot currently provide a numeric prefix arg to `indent-
> rigidly'
> > for incremental use. The incremental indentation you get is either 1
> > column (for <right>) or to the next tab stop (for <S-right>).
> >
> > It would be good to be able to use a numeric prefix arg interactively
> to
> > indent not only once, but each time you hit <right>.
>
> I don't think that makes much sense -- if you've decided to indent X
> columns (by using the prefix), then you don't want to enter the
> transient map thing.
So...another "wont-fix".
I hope you're simply misunderstanding.
This would let each incremental key press move by
that increment, instead of an increment of just 1.
It boosts the incrementation.
An increment is exactly that: a given amount to
increase (likewise, decrement/decrease).
Think incf and decf, if that helps you understand.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 10 Jun 2022 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.