From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#16108: 24.3; Add optional arg to indent-region Date: Wed, 11 Dec 2013 09:18:34 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386724819 7141 80.91.229.3 (11 Dec 2013 01:20:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Dec 2013 01:20:19 +0000 (UTC) To: 16108@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 11 02:20:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VqYTP-0001br-Kv for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Dec 2013 02:20:24 +0100 Original-Received: from localhost ([::1]:52113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYTP-0005ia-6j for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Dec 2013 20:20:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYTE-0005gE-2p for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2013 20:20:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqYT5-0004Xj-Lq for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2013 20:20:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYT5-0004Wg-IF for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2013 20:20:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VqYT4-0001rT-1h; Tue, 10 Dec 2013 20:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Dec 2013 01:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16108 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.13867247547081 (code B ref -1); Wed, 11 Dec 2013 01:20:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Dec 2013 01:19:14 +0000 Original-Received: from localhost ([127.0.0.1]:42528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VqYSH-0001q9-Rb for submit@debbugs.gnu.org; Tue, 10 Dec 2013 20:19:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49833) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VqYSF-0001pt-AQ for submit@debbugs.gnu.org; Tue, 10 Dec 2013 20:19:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqYS6-0004Jg-Hs for submit@debbugs.gnu.org; Tue, 10 Dec 2013 20:19:10 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYS6-0004Jc-Ej for submit@debbugs.gnu.org; Tue, 10 Dec 2013 20:19:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYRx-0005Ib-Vx for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2013 20:19:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqYRk-0004GV-EX for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2013 20:18:53 -0500 Original-Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]:53117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYRk-0004GJ-5Z for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2013 20:18:40 -0500 Original-Received: by mail-pd0-f172.google.com with SMTP id g10so8447235pdj.31 for ; Tue, 10 Dec 2013 17:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=X+I5Iw1okzzVrt3e27Msm2QeWcMm2ELmBaHoQizTY+U=; b=0TfY7jaxhr766pbAHCqP0dJPkZfN8sSMlqK/NWd9QS2EEEaW+XMdwlrqnn/ZxGxUuV EDwtSLgPf+RzvMjf2OkiY8mmaew8iX9/PY9rOnKDDJ7gA1zb3f7KI9GUEZDI6WK/+7w8 z37Eibn5XnepiecH+3zK13U6qGOuxp6GXpiQT7Lw6d2My44JPvbhCb5FvrdvLFE0Sf/D ZoeU85KEr8/7Ey86QbqUPU26gG8sZcb4XpdMC6Jk6LVMT4U4UHTlhOfHefgPzeUmxWpq AaGl8oHkjjQWl+heAFtLwZkP48qOQ5MAmEQFhgm+Viw7gMC9eIhdk2X4p/y5Kz5UMJOQ 4UNw== X-Received: by 10.68.178.197 with SMTP id da5mr31066324pbc.28.1386724719157; Tue, 10 Dec 2013 17:18:39 -0800 (PST) Original-Received: from localhost ([222.130.178.133]) by mx.google.com with ESMTPSA id gv10sm28599645pbd.0.2013.12.10.17.18.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2013 17:18:38 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81736 Archived-At: 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