- (if (or (eq indent-line-function 'indent-to-left-margin)
- (and (not tab-always-indent)
- (> (current-column) (current-indentation))))
- (insert-tab prefix-arg)
- (funcall indent-line-function)))
-
-(defun insert-tab (&optional prefix-arg)
- (let ((count (prefix-numeric-value prefix-arg)))
+ (cond
+ ((or ;; indent-to-left-margin is only meant for indenting,
+ ;; so we force it to always insert a tab here.
+ (eq indent-line-function 'indent-to-left-margin)
+ (and (not tab-always-indent)
+ (or (> (current-column) (current-indentation))
+ (eq this-command last-command))))
+ (insert-tab arg))
+ ;; Those functions are meant specifically for tabbing and not for
+ ;; indenting, so we can't pass them to indent-according-to-mode.
+ ((memq indent-line-function '(indent-relative indent-relative-maybe))
+ (funcall indent-line-function))
+ (t ;; The normal case.
+ (indent-according-to-mode))))
+
+(defun insert-tab (&optional arg)
+ (let ((count (prefix-numeric-value arg)))