From: Leo Liu <sdl.web@gmail.com>
To: 16108@debbugs.gnu.org
Subject: bug#16108: 24.3; Add optional arg to indent-region
Date: Wed, 11 Dec 2013 09:18:34 +0800 [thread overview]
Message-ID: <m161qwp4lx.fsf@gmail.com> (raw)
I use indent-region non-interactively and the progress report gets in
the way. So I propose make it possible to suppress it. Objections?
=== modified file 'lisp/indent.el'
--- lisp/indent.el 2013-10-17 19:31:11 +0000
+++ lisp/indent.el 2013-12-11 01:14:31 +0000
@@ -427,7 +427,7 @@
"Short cut function to indent region using `indent-according-to-mode'.
A value of nil means really run `indent-according-to-mode' on each line.")
-(defun indent-region (start end &optional column)
+(defun indent-region (start end &optional column nomsg)
"Indent each nonblank line in the region.
A numeric prefix argument specifies a column: indent each line to that column.
@@ -443,7 +443,8 @@
Called from a program, START and END specify the region to indent.
If the third argument COLUMN is an integer, it specifies the
-column to indent to; if it is nil, use one of the three methods above."
+column to indent to; if it is nil, use one of the three methods above.
+If NOMSG is non-nil, do not report progress."
(interactive "r\nP")
(cond
;; If a numeric prefix is given, indent to that column.
@@ -481,13 +482,14 @@
(save-excursion
(setq end (copy-marker end))
(goto-char start)
- (let ((pr (make-progress-reporter "Indenting region..." (point) end)))
- (while (< (point) end)
- (or (and (bolp) (eolp))
- (indent-according-to-mode))
+ (let ((pr (unless nomsg
+ (make-progress-reporter "Indenting region..." (point) end))))
+ (while (< (point) end)
+ (or (and (bolp) (eolp))
+ (indent-according-to-mode))
(forward-line 1)
- (progress-reporter-update pr (point)))
- (progress-reporter-done pr)
+ (and pr (progress-reporter-update pr (point))))
+ (and pr (progress-reporter-done pr))
(move-marker end nil)))))
;; In most cases, reindenting modifies the buffer, but it may also
;; leave it unmodified, in which case we have to deactivate the mark
next reply other threads:[~2013-12-11 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 1:18 Leo Liu [this message]
2013-12-11 14:51 ` bug#16108: 24.3; Add optional arg to indent-region Stefan Monnier
2013-12-12 0:18 ` Leo Liu
2013-12-12 18:34 ` Stefan Monnier
2013-12-13 1:57 ` Leo Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m161qwp4lx.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=16108@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.