It's quite badly broken in the case where it's using fields to mark
prompts: it goes straight to the start of the entire input area, rather
than to the start of the current line if there's more than one. In
particular, this confuses IELM, which uses `comint-bol' to decide
whether to indent when you press TAB.
Fix this bogosity.
(and mdw-auto-indent
(indent-for-tab-command)))
(and mdw-auto-indent
(indent-for-tab-command)))
+(defadvice comint-line-beginning-position
+ (around mdw-calculate-it-properly () activate compile)
+ "Calculate the actual line start for multi-line input."
+ (if (or comint-use-prompt-regexp
+ (eq (field-at-pos (point)) 'output))
+ ad-do-it
+ (setq ad-return-value
+ (constrain-to-field (line-beginning-position) (point)))))
+
(defun mdw-setup-m4 ()
;; Inexplicably, Emacs doesn't match braces in m4 mode. This is very
(defun mdw-setup-m4 ()
;; Inexplicably, Emacs doesn't match braces in m4 mode. This is very