mickey avatar mickey committed 3ecc212 Merge

Merge

Comments (0)

Files changed (1)

   ;;; Code loosely based off code snarfed from Andreas Politz on
   ;;; `gnu.emacs.help'.
   (progn
+    ;; if there's no region active we should act on the entire line
+    ;; instead. That avoids the uncomfortable situation where mark is
+    ;; *somewhere* in the buffer and shifting the region would move
+    ;; the region from point to mark.
+    (unless (region-active-p)
+      (set-mark
+       (save-excursion
+         (forward-line 0)
+         (point)))
+      (end-of-line)
+      ;; we must have this or we won't include the newline.
+      (forward-char)
+      (activate-mark))
     (if (> (point) (mark))
         (exchange-point-and-mark))
     (let ((column (current-column))
       (if (eq subr 'smart)
           (progn
             (indent-rigidly (point) (mark)
-                            ;;; the inner-most block indentation level
-                            ;;; is what we're after. Subtract the
-                            ;;; current indentation at point (the
-                            ;;; top-most line in the region) from it
-                            ;;; to get the amount we need to rigidly
-                            ;;; indent by.
+                            ;; the inner-most block indentation level
+                            ;; is what we're after. Subtract the
+                            ;; current indentation at point (the
+                            ;; top-most line in the region) from it
+                            ;; to get the amount we need to rigidly
+                            ;; indent by.
                             (- (caar (last (python-indentation-levels)))
                                (python-mp-indentation-at-point (point))))))
       (setq deactivate-mark nil))))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.