emacs-devel
[Top][All Lists]
Advanced

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

python-mode: keep mark when shifting [patch]


From: David Reitter
Subject: python-mode: keep mark when shifting [patch]
Date: Thu, 9 Mar 2006 18:31:10 +0000

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.







reply via email to

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