From 4c4ad8084872937776783bc1e59908114ec8f44c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 29 Oct 2017 12:05:28 -0600 Subject: [PATCH] Fix mthml submode lighting at end of buffer * lisp/textmodes/mhtml-mode.el (mhtml--submode-lighter): Handle end of buffer correctly. --- lisp/textmodes/mhtml-mode.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el index 05d5e52225d..2c1b26d571c 100644 --- a/lisp/textmodes/mhtml-mode.el +++ b/lisp/textmodes/mhtml-mode.el @@ -149,7 +149,12 @@ code(); (defun mhtml--submode-lighter () "Mode-line lighter indicating the current submode." - (let ((submode (get-text-property (point) 'mhtml-submode))) + ;; The end of the buffer has no text properties, so in this case + ;; back up one character, if possible. + (let* ((where (if (and (eobp) (not (bobp))) + (1- (point)) + (point))) + (submode (get-text-property where 'mhtml-submode))) (if submode (mhtml--submode-name submode) ""))) -- 2.39.2