all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* python-mode: do not deactivate mark when shifting
@ 2007-02-19 15:35 David Reitter
  2007-02-20 22:32 ` Kim F. Storm
  0 siblings, 1 reply; 2+ messages in thread
From: David Reitter @ 2007-02-19 15:35 UTC (permalink / raw
  To: emacs- devel

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  <david.reitter@gmail.com>
+
+ 	* 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  <lekktu@gmail.com>

   	* 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: python-mode: do not deactivate mark when shifting
  2007-02-19 15:35 python-mode: do not deactivate mark when shifting David Reitter
@ 2007-02-20 22:32 ` Kim F. Storm
  0 siblings, 0 replies; 2+ messages in thread
From: Kim F. Storm @ 2007-02-20 22:32 UTC (permalink / raw
  To: David Reitter; +Cc: emacs- devel

David Reitter <david.reitter@gmail.com> writes:

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

I cannot comment on the merits of this change (I don't use Python
myself), but I can comment on the patch itself:

Rather than setting deactivate-mark explictly, we usually write it
like this:

         (let (deactivate-mark)
           (indent-rigidly ...))


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-20 22:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-19 15:35 python-mode: do not deactivate mark when shifting David Reitter
2007-02-20 22:32 ` Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.