]> code.delx.au - gnu-emacs/blobdiff - lisp/indent.el
Customize.
[gnu-emacs] / lisp / indent.el
index 89c75472bc39d0ad742bd55064348cfa775297ab..5b69fab958a702dcbea973b5ed2473f0527420ea 100644 (file)
@@ -43,17 +43,18 @@ Function to indent current line.")
   "Indent line in proper way for current major mode."
   (interactive "P")
   (if (eq indent-line-function 'indent-to-left-margin)
-      (insert-tab)
+      (insert-tab prefix-arg)
     (if prefix-arg
        (funcall indent-line-function prefix-arg)
       (funcall indent-line-function))))
 
-(defun insert-tab ()
-  (if abbrev-mode
-      (expand-abbrev))
-  (if indent-tabs-mode
-      (insert ?\t)
-    (indent-to (* tab-width (1+ (/ (current-column) tab-width))))))
+(defun insert-tab (&optional prefix-arg)
+  (let ((count (prefix-numeric-value prefix-arg)))
+    (if abbrev-mode
+       (expand-abbrev))
+    (if indent-tabs-mode
+       (insert-char ?\t count)
+      (indent-to (* tab-width (+ count (/ (current-column) tab-width)))))))
 
 (defun indent-rigidly (start end arg)
   "Indent all lines starting in the region sideways by ARG columns.
@@ -83,7 +84,7 @@ only if necessary.  It leaves point at end of indentation."
   (back-to-indentation)
   (let ((cur-col (current-column)))
     (cond ((< cur-col column)
-          (if (> (- column (* (/ cur-col tab-width) tab-width)) tab-width)
+          (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width)
               (delete-region (point)
                              (progn (skip-chars-backward " ") (point))))
           (indent-to column))