Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.06; 'python': 0.08; 'content-type:multipart/signed': 0.09; 'reactivate': 0.09; '(lambda': 0.16; 'content-type:application /pgp-signature': 0.16; 'emacs': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname piece:signature': 0.16; 'filename:fname:signature.asc': 0.16; 'guess': 0.19; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'sfxlen:0': 0.23; 'fix': 0.23; 'skip:b 20': 0.23; 'code': 0.24; '(and': 0.25; 'moving': 0.26; 'comfortable': 0.29; 'skip:( 20': 0.30; "skip:' 10": 0.32; 'to:addr:python-list': 0.33; 'quite': 0.36; 'charset:us-ascii': 0.36; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'your': 0.60; 'cause': 0.67; 'loose': 0.67; 'region': 0.67; 'received:93': 0.80; '(let': 0.84 Date: Sat, 11 Jun 2011 22:43:11 +0200 From: Bastian Ballmann To: python-list@python.org Subject: Emacs Python indention X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.4; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/by1cgmtcYSLGoIwBpMM0=ff"; protocol="application/pgp-signature" X-Virus-Scanned: Debian amavisd-new at lucy.chaostal.de Cc: help-gnu-emacs@gnu.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 69 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307825044 news.xs4all.nl 49047 [::ffff:82.94.164.166]:44963 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7461 --Sig_/by1cgmtcYSLGoIwBpMM0=ff Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Emacs / Python coders, moving a region of python code for more than one indention in Emacs is quite annoying, cause the python-shift-left and -right functions always loose the mark and one has to reactivate it with \C-x \C-x or guess how many indentions one want to make and do a \C-u \C-c > That were the only solutions I found on the net and well both are not very comfortable so here's a fix for that. With the following code you can use \C-c left and right to move your Python code to the left and to the right :) HF Basti (defun balle-python-shift-left () (interactive) (let (start end bds) (if (and transient-mark-mode mark-active) (setq start (region-beginning) end (region-end)) (progn (setq bds (bounds-of-thing-at-point 'line)) (setq start (car bds) end (cdr bds)))) (python-shift-left start end)) (setq deactivate-mark nil) ) = =20 (defun balle-python-shift-right () (interactive) (let (start end bds) (if (and transient-mark-mode mark-active) (setq start (region-beginning) end (region-end)) (progn (setq bds (bounds-of-thing-at-point 'line)) (setq start (car bds) end (cdr bds)))) (python-shift-right start end)) (setq deactivate-mark nil) ) = =20 (add-hook 'python-mode-hook=20 (lambda () (define-key python-mode-map (kbd "C-c ") 'balle-python-shift-right)=20 (define-key python-mode-map (kbd "C-c ") 'balle-python-shift-left) ) ) --Sig_/by1cgmtcYSLGoIwBpMM0=ff Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk3z018ACgkQEQHD8bvs9q2ZRACghM3mUvcs+tH2TeBvayl9D33H CukAni70S83RJsIFoin8LY1xH6a0yIlz =vNJo -----END PGP SIGNATURE----- --Sig_/by1cgmtcYSLGoIwBpMM0=ff--