(require 'cl-lib) (defvar-local 21468-region-overlays nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (defun 21468-update-hunk-region (start end window rol) (mapc #'delete-overlay 21468-region-overlays) (cl-flet ((ov (start end &rest args) (let ((ov (make-overlay start end nil t))) (while args (overlay-put ov (pop args) (pop args))) (push ov 21468-region-overlays) ov))) (let* ((align (list 'space :align-to `(+ ,(window-hscroll) (0 . right)))) (rend-line (save-excursion (goto-char end) (cons (line-beginning-position) (line-end-position)))) (face (list :underline (face-background 'highlight nil t)))) (message "align = %S" align) (ov (car rend-line) (cdr rend-line) 'face face 'after-string (propertize "\s" 'face face 'display align 'cursor t))))) (setq-local redisplay-highlight-region-function '21468-update-hunk-region) (setq-local redisplay-unhighlight-region-function (lambda (rol) (mapc #'delete-overlay 21468-region-overlays))) (setq-local truncate-lines t)