From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.devel Subject: python-mode: keep mark when shifting [patch] Date: Thu, 9 Mar 2006 18:31:10 +0000 Message-ID: <8E0F3F60-B0BA-4F00-AA96-9A776781F331@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1142022061 32587 80.91.229.2 (10 Mar 2006 20:21:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Mar 2006 20:21:01 +0000 (UTC) Cc: Emacs-Devel ' Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 10 21:20:55 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FHo5z-00046S-L2 for ged-emacs-devel@m.gmane.org; Fri, 10 Mar 2006 21:20:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHo5y-00063t-Us for ged-emacs-devel@m.gmane.org; Fri, 10 Mar 2006 15:20:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FHPuv-0002L8-QJ for emacs-devel@gnu.org; Thu, 09 Mar 2006 13:31:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FHPus-0002Ge-QH for emacs-devel@gnu.org; Thu, 09 Mar 2006 13:31:17 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHPus-0002GM-IY for emacs-devel@gnu.org; Thu, 09 Mar 2006 13:31:14 -0500 Original-Received: from [64.233.166.176] (helo=pproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FHPxz-0002Xa-TF for emacs-devel@gnu.org; Thu, 09 Mar 2006 13:34:28 -0500 Original-Received: by pproxy.gmail.com with SMTP id z74so222128pyg for ; Thu, 09 Mar 2006 10:31:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=LPNpN1A0NADTmzjKhHr4PVjIETDLdKvbnmKJkFD2n9EI5qp+IwtHsmCCqWIhc+3GCz9OwIhHvRpzD6mvy2TIDcsSJcFpCuiSGLcvDzjOsALiZI1kMIUuXfIQhnZq4L4wZofb1MK7yrHtxqvAmyBnXtFF33/8xB4UZ9Mllc9TkDg= Original-Received: by 10.65.248.5 with SMTP id a5mr753949qbs; Thu, 09 Mar 2006 10:31:13 -0800 (PST) Original-Received: from ?129.215.174.81? ( [129.215.174.81]) by mx.gmail.com with ESMTP id e14sm993408qba.2006.03.09.10.31.12; Thu, 09 Mar 2006 10:31:13 -0800 (PST) Original-To: Dave Love X-Mailer: Apple Mail (2.746.2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51440 Archived-At: The patch below fixed a behavior of python-mode that I've found somewhat annoying: it deactivates the mark whenever you do C-c < or C- c > to shift a block to the left or right. Because one commonly needs to do this several times in a row (checking visually in between), it's very unhelpful if the mark gets deactivated. Secondly, I was wondering if there is / could be a convention for shifting code horizontally. *** python.el 22 Feb 2006 19:15:41 +0000 1.36 --- python.el 09 Mar 2006 18:24:05 +0000 *************** *** 1532,1544 **** (setq count python-indent)) (when (> count 0) (save-excursion (goto-char start) (while (< (point) end) (if (and (< (current-indentation) count) (not (looking-at "[ \t]*$"))) (error "Can't shift all lines enough")) (forward-line)) ! (indent-rigidly start end (- count))))) (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") --- 1532,1545 ---- (setq count python-indent)) (when (> count 0) (save-excursion + (let ((deactivate-mark)) (goto-char start) (while (< (point) end) (if (and (< (current-indentation) count) (not (looking-at "[ \t]*$"))) (error "Can't shift all lines enough")) (forward-line)) ! (indent-rigidly start end (- count)))))) (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") *************** *** 1553,1559 **** (if count (setq count (prefix-numeric-value count)) (setq count python-indent)) ! (indent-rigidly start end count)) (defun python-outline-level () "`outline-level' function for Python mode. --- 1554,1562 ---- (if count (setq count (prefix-numeric-value count)) (setq count python-indent)) ! ! (let ((deactivate-mark)) ! (indent-rigidly start end count))) (defun python-outline-level () "`outline-level' function for Python mode.