From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Simon South Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#4354: 23.0.60; delphi-mode: TAB should indent region in Transient Mark mode (with patch) Date: Sun, 06 Sep 2009 00:13:32 -0400 Message-ID: <87pra4lngz.fsf@hamlet.localdomain> Reply-To: Simon South , 4354@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1252259502 13114 80.91.229.12 (6 Sep 2009 17:51:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Sep 2009 17:51:42 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 06 19:51:35 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MkLtn-00078F-2v for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Sep 2009 19:51:35 +0200 Original-Received: from localhost ([127.0.0.1]:32844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MkLtm-0002Pw-HC for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Sep 2009 13:51:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mk9LE-0001Yq-RB for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2009 00:27:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mk9LA-0001VK-S2 for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2009 00:27:04 -0400 Original-Received: from [199.232.76.173] (port=47562 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mk9LA-0001VC-PQ for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2009 00:27:00 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:55300) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mk9LA-0004js-Ae for bug-gnu-emacs@gnu.org; Sun, 06 Sep 2009 00:27:00 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n864QwO6013526; Sat, 5 Sep 2009 21:26:58 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n864K3iB012289; Sat, 5 Sep 2009 21:20:03 -0700 Resent-Date: Sat, 5 Sep 2009 21:20:03 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Simon South Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sun, 06 Sep 2009 04:20:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4354 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.125221042511312 (code B ref -1); Sun, 06 Sep 2009 04:20:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 6 Sep 2009 04:13:45 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n864Dh9T011309 for ; Sat, 5 Sep 2009 21:13:44 -0700 Original-Received: from mx10.gnu.org ([199.232.76.166]:49648) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Mk98I-0001tq-If for emacs-pretest-bug@gnu.org; Sun, 06 Sep 2009 00:13:42 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Mk98G-000178-6z for emacs-pretest-bug@gnu.org; Sun, 06 Sep 2009 00:13:42 -0400 Original-Received: from caiajhbdccah.dreamhost.com ([208.97.132.207]:54983 helo=postalmail-a6.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mk98F-00015s-GB for emacs-pretest-bug@gnu.org; Sun, 06 Sep 2009 00:13:39 -0400 Original-Received: from hamlet.localdomain.slowcomputing.org (CPE0019b90fad23-CM00407b87aa6e.cpe.net.cable.rogers.com [99.238.107.135]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by postalmail-a6.g.dreamhost.com (Postfix) with ESMTP id 84283887A4 for ; Sat, 5 Sep 2009 21:13:36 -0700 (PDT) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Sun, 06 Sep 2009 00:27:04 -0400 X-Mailman-Approved-At: Sun, 06 Sep 2009 13:51:30 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30833 gmane.emacs.pretest.bugs:25014 Archived-At: The patch below makes delphi-mode indent the region when the TAB key is pressed, whenever Transient Mark mode is enabled and the region is active. (This became standard behaviour with Emacs 23.1 but wasn't automatically reflected by delphi-mode as it defines its own TAB-key binding.) I've tested this with different combinations of transient-mark-mode, delphi-tab-always-indents and delphi-newline-always-indents and it appears to work fine. Changes: (delphi-tab): Indent region when Transient Mark mode is enabled and region is active; otherwise indent or insert TAB as usual. (delphi-mode): Update description of TAB-key binding. Index: lisp/progmodes/delphi.el =================================================================== RCS file: /sources/emacs/emacs/lisp/progmodes/delphi.el,v retrieving revision 3.33 diff -c -r3.33 delphi.el *** lisp/progmodes/delphi.el 5 Jan 2009 03:23:27 -0000 3.33 --- lisp/progmodes/delphi.el 6 Sep 2009 03:33:09 -0000 *************** *** 1652,1665 **** (defun delphi-tab () ! "Indent the current line or insert a TAB, depending on the value of ! `delphi-tab-always-indents' and the current line position." (interactive) ! (if (or delphi-tab-always-indents ; We are always indenting ! ;; Or we are before the first non-space character on the line. ! (save-excursion (skip-chars-backward delphi-space-chars) (bolp))) ! (delphi-indent-line) ! (insert "\t"))) (defun delphi-is-directory (path) --- 1652,1674 ---- (defun delphi-tab () ! "Indent the region, when Transient Mark mode is enabled and the region is ! active. Otherwise, indent the current line or insert a TAB, depending on the ! value of `delphi-tab-always-indents' and the current line position." (interactive) ! (cond ((use-region-p) ! ;; If Transient Mark mode is enabled and the region is active, indent ! ;; the entire region. ! (indent-region (region-beginning) (region-end))) ! ((or delphi-tab-always-indents ! (save-excursion (skip-chars-backward delphi-space-chars) (bolp))) ! ;; Otherwise, if we are configured always to indent (regardless of the ! ;; point's position in the line) or we are before the first non-space ! ;; character on the line, indent the line. ! (delphi-indent-line)) ! (t ! ;; Otherwise, insert a tab character. ! (insert "\t")))) (defun delphi-is-directory (path) *************** *** 1935,1941 **** ;;;###autoload (defun delphi-mode (&optional skip-initial-parsing) "Major mode for editing Delphi code. \\ ! \\[delphi-tab]\t- Indents the current line for Delphi code. \\[delphi-find-unit]\t- Search for a Delphi source file. \\[delphi-fill-comment]\t- Fill the current comment. \\[delphi-new-comment-line]\t- If in a // comment, do a new comment line. --- 1944,1951 ---- ;;;###autoload (defun delphi-mode (&optional skip-initial-parsing) "Major mode for editing Delphi code. \\ ! \\[delphi-tab]\t- Indents the current line (or region, if Transient Mark mode ! \t is enabled and the region is active) of Delphi code. \\[delphi-find-unit]\t- Search for a Delphi source file. \\[delphi-fill-comment]\t- Fill the current comment. \\[delphi-new-comment-line]\t- If in a // comment, do a new comment line.