comparison lisp/progmodes/python.el @ 102153:603bb57bb542

(python-shift-left, python-shift-right): When the mark is not active shift the current line. (Bug#2381)
author Martin Rudalics <rudalics@gmx.at>
date Fri, 20 Feb 2009 16:30:53 +0000
parents 84b9607bddb0
children 2e0765155e47
comparison
equal deleted inserted replaced
102152:c526d585a715 102153:603bb57bb542
2006 "Shift lines in region COUNT (the prefix arg) columns to the left. 2006 "Shift lines in region COUNT (the prefix arg) columns to the left.
2007 COUNT defaults to `python-indent'. If region isn't active, just shift 2007 COUNT defaults to `python-indent'. If region isn't active, just shift
2008 current line. The region shifted includes the lines in which START and 2008 current line. The region shifted includes the lines in which START and
2009 END lie. It is an error if any lines in the region are indented less than 2009 END lie. It is an error if any lines in the region are indented less than
2010 COUNT columns." 2010 COUNT columns."
2011 (interactive (if mark-active 2011 (interactive
2012 (list (region-beginning) (region-end) current-prefix-arg) 2012 (if mark-active
2013 (list (point) (point) current-prefix-arg))) 2013 (list (region-beginning) (region-end) current-prefix-arg)
2014 (list (line-beginning-position) (line-end-position) current-prefix-arg)))
2014 (if count 2015 (if count
2015 (setq count (prefix-numeric-value count)) 2016 (setq count (prefix-numeric-value count))
2016 (setq count python-indent)) 2017 (setq count python-indent))
2017 (when (> count 0) 2018 (when (> count 0)
2018 (save-excursion 2019 (save-excursion
2029 (defun python-shift-right (start end &optional count) 2030 (defun python-shift-right (start end &optional count)
2030 "Shift lines in region COUNT (the prefix arg) columns to the right. 2031 "Shift lines in region COUNT (the prefix arg) columns to the right.
2031 COUNT defaults to `python-indent'. If region isn't active, just shift 2032 COUNT defaults to `python-indent'. If region isn't active, just shift
2032 current line. The region shifted includes the lines in which START and 2033 current line. The region shifted includes the lines in which START and
2033 END lie." 2034 END lie."
2034 (interactive (if mark-active 2035 (interactive
2035 (list (region-beginning) (region-end) current-prefix-arg) 2036 (if mark-active
2036 (list (point) (point) current-prefix-arg))) 2037 (list (region-beginning) (region-end) current-prefix-arg)
2038 (list (line-beginning-position) (line-end-position) current-prefix-arg)))
2037 (if count 2039 (if count
2038 (setq count (prefix-numeric-value count)) 2040 (setq count (prefix-numeric-value count))
2039 (setq count python-indent)) 2041 (setq count python-indent))
2040 (indent-rigidly start end count)) 2042 (indent-rigidly start end count))
2041 2043