From: Mark Wooding Date: Sat, 5 Aug 2017 23:52:05 +0000 (+0100) Subject: el/dot-emacs.el: Hack on `comint-line-beginning-position'. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/29e4917e95cfadfa2504082eb63b0ac45a2fb06e el/dot-emacs.el: Hack on `comint-line-beginning-position'. 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. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 37bd96a..8195411 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -3770,6 +3770,15 @@ (defun comint-send-and-indent () (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