I have added the following definitions to my initialization file in order to make the mark show up as a red highlight:
(defface mmv-face '((t :inherit default :background "red")) "Face used for showing the mark's position.") (defvar mmv-mark-overlay nil "Overlay for showing the mark's position.") (make-variable-buffer-local 'mmv-mark-overlay) ;; The three optional arguments are needed to cover the optional arguments of ;; those functions that this function will modify through `advice-add'. (defun mmv-show-mark (&optional ARG1 ARG2 ARG3) "Make the mark's position stand out by means of a one-character-long overlay." (unless mmv-mark-overlay (setq mmv-mark-overlay (make-overlay 0 0 nil t)) (overlay-put mmv-mark-overlay 'face 'mmv-face)) (let ((mark-position (mark t))) (when mark-position ; Function `mark' returns non-nil only if the buffer's mark is set, so ; doing the following is pointless if `mark-position' is nil. (move-overlay mmv-mark-overlay mark-position (1+ mark-position))))) (advice-add 'set-mark :after #'mmv-show-mark) (advice-add 'pop-mark :after #'mmv-show-mark) (advice-add 'push-mark :after #'mmv-show-mark)
It works well otherwise, except that if the mark is at the end of a line, everything to the right of the mark is also highlighted; see the screenshot below. Why would this be, and how can it be fixed?