GNU bug report logs - #16108
24.3; Add optional arg to indent-region

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Wed, 11 Dec 2013 01:20:01 UTC

Severity: wishlist

Tags: patch

Found in version 24.3

Done: Leo Liu <sdl.web <at> gmail.com>

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 16108 in the body.
You can then email your comments to 16108 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#16108; Package emacs. (Wed, 11 Dec 2013 01:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Wed, 11 Dec 2013 01:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Add optional arg to indent-region
Date: Wed, 11 Dec 2013 09:18:34 +0800
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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16108; Package emacs. (Wed, 11 Dec 2013 14:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 16108 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 16108 <at> debbugs.gnu.org
Subject: Re: bug#16108: 24.3; Add optional arg to indent-region
Date: Wed, 11 Dec 2013 09:51:31 -0500
> I use indent-region non-interactively and the progress report gets in
> the way. So I propose make it possible to suppress it.  Objections?

I'm not really opposed, but I'd like to understand in which way it "gets
in the way".  Can you give more details?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16108; Package emacs. (Thu, 12 Dec 2013 00:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 16108 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 16108 <at> debbugs.gnu.org
Subject: Re: bug#16108: 24.3; Add optional arg to indent-region
Date: Thu, 12 Dec 2013 08:18:33 +0800
On 2013-12-11 22:51 +0800, Stefan Monnier wrote:
> I'm not really opposed, but I'd like to understand in which way it "gets
> in the way".  Can you give more details?

I advise yank to indent the pasted text. so when yank into minibuffer
instead of seeing the yanked text I am seeing the progress messages. I
just realised another solution is to opt out indentation in minibuffer
in my case.

However it seems this NOMSG arg is still useful. Programmaticly one can
disable progress reporter for small regions.

So should I go ahead and install it?

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16108; Package emacs. (Thu, 12 Dec 2013 18:35:01 GMT) Full text and rfc822 format available.

Message #14 received at 16108 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 16108 <at> debbugs.gnu.org
Subject: Re: bug#16108: 24.3; Add optional arg to indent-region
Date: Thu, 12 Dec 2013 13:34:34 -0500
>> I'm not really opposed, but I'd like to understand in which way it "gets
>> in the way".  Can you give more details?
> I advise yank to indent the pasted text. so when yank into minibuffer
> instead of seeing the yanked text I am seeing the progress messages.

Good point.  We shouldn't emit such messages when we're in the
minibuffer (or we should emit them differently, so as not to hide
the minibuffer text, e.g. like minibuffer-message does).

> So should I go ahead and install it?

Let's first silence (unconditionally) the messages when in
the minibuffer.  We'll see later if messages still need to be silenced,
and in which cases.


        Stefan




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Fri, 13 Dec 2013 01:58:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Fri, 13 Dec 2013 01:58:02 GMT) Full text and rfc822 format available.

Message #19 received at 16108-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 16108-done <at> debbugs.gnu.org
Subject: Re: bug#16108: 24.3; Add optional arg to indent-region
Date: Fri, 13 Dec 2013 09:57:41 +0800
Fixed in 24.4

On 2013-12-13 02:34 +0800, Stefan Monnier wrote:
> Let's first silence (unconditionally) the messages when in
> the minibuffer.  We'll see later if messages still need to be silenced,
> and in which cases.

Sounds good.

Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Jan 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.