From: Mark Wooding Date: Fri, 13 Sep 2019 16:09:34 +0000 (+0100) Subject: el/dot-emacs.el (comint-...): Lift out into utilities. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/41a1f4fa1d4585563360c989c27501cb4fee255e el/dot-emacs.el (comint-...): Lift out into utilities. They didn't really have much to do with Lisp. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 0f4d086..b30a963 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -979,6 +979,21 @@ (defun mdw-auto-revert () (let ((auto-revert-check-vc-info t)) (auto-revert-buffers))) +(defun comint-send-and-indent () + (interactive) + (comint-send-input) + (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))))) + ;;;-------------------------------------------------------------------------- ;;; Dired hacking. @@ -3955,21 +3970,6 @@ (defun mdw-fontify-lispy () (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face))))) -(defun comint-send-and-indent () - (interactive) - (comint-send-input) - (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