Subject: bug#36361: 'hl-line-range-function' as list of choice

From: Howard Melman <[email-masked]>
Date: Tue, 26 Oct 2021 14:48:53 -0400

FWIW, I've been using the following in Emacs 27.2:

#+begin_src elisp
  (defun visual-line-range-function ()
    "Return a cons cell of positions of begining and end 
  of the current line in `visual-line-mode`. Meant to be used
  as the value of `hl-line-range-function`."
    (save-excursion
      (cons (progn (beginning-of-visual-line) (point))
            (progn (beginning-of-visual-line 2) (point)))))

  (defun set-visual-line-range-function ()
    (setq-local hl-line-range-function
                (if visual-line-mode 'visual-line-range-function nil)))

  (add-hook 'visual-line-mode-hook 'set-visual-line-range-function)
#+end_src

but it seems to conflict with the temporary-goal-column in
line-move-visual.  If I have a buffer:

- foo
- bar
- zot

With point just before foo and do C-n twice, the first one moves point
to just before bar, but the second moves point to the beginning of the
3rd line.

Suggestions for an improved version are welcome.

Howard