emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

python-mode: do not deactivate mark when shifting


From: David Reitter
Subject: python-mode: do not deactivate mark when shifting
Date: Mon, 19 Feb 2007 15:35:25 +0000

Shifting the region in python is a common task, and more often than not, the command needs to be repeated on the same region. This patch leaves the region (visually) active rather than deactivating the mark. (Deactivating the mark suggests to transient-mark-mode / cua- mode users that the text needs to be selected again before the command can be repeated.)

Please consider installing this if it's not a "dangerous" change.


*** lisp/ChangeLog      19 Feb 2007 15:25:40 +0000      1.10707
--- lisp/ChangeLog      19 Feb 2007 15:28:53 +0000      
***************
*** 1,3 ****
--- 1,9 ----
+ 2007-02-19  David Reitter  <address@hidden>
+
+       * progmodes/python.el (python-shift-left, python-shift-right): Do
+       not deactivate the mark after shifting region so that the command
+       can be repeated with the region remaining (visually) active.
+
  2007-02-19  Juanma Barranquero  <address@hidden>

        * speedbar.el (speedbar-frame-mode, speedbar-frame-width)
Index: python.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.53
diff -c -r1.53 python.el
*** lisp/progmodes/python.el    21 Jan 2007 03:20:44 -0000      1.53
--- lisp/progmodes/python.el    19 Feb 2007 15:26:01 -0000
***************
*** 1784,1790 ****
                 (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")

--- 1784,1791 ----
                 (not (looking-at "[ \t]*$")))
            (error "Can't shift all lines enough"))
        (forward-line))
!       (indent-rigidly start end (- count))))
!   (setq deactivate-mark nil))

  (add-to-list 'debug-ignored-errors "^Can't shift all lines enough")

***************
*** 1799,1805 ****
    (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.
--- 1800,1807 ----
    (if count
        (setq count (prefix-numeric-value count))
      (setq count python-indent))
!   (indent-rigidly start end count)
!   (setq deactivate-mark nil))

  (defun python-outline-level ()
    "`outline-level' function for Python mode.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]