(sorry, further hijacking this thread)
Eric: I made a slight improvement to your code (see the =setq e=) so that
the empty space at the end of the line gets highlighted as in the default
behavior instead of only highlighting the part of the line that contains
text:
#+begin_src emacs-lisp
(defun esf/get-visual-line-range ()
(let (b e)
(save-excursion
(beginning-of-visual-line)
(setq b (point))
(end-of-visual-line)
(setq e (+ 1 (point)))
)
(cons b e)))
#+end_src
--Diego
On Thu, Oct 31, 2019 at 5:03 PM Diego Zamboni <[email protected]> wrote:
> Hi Eric,
>
> Nice! Thanks for the tip :)
>
> --Diego
>
>
> On Thu, Oct 31, 2019 at 4:56 PM Fraga, Eric <[email protected]> wrote:
>
>> On Thursday, 31 Oct 2019 at 08:52, Diego Zamboni wrote:
>> > Since I use =visual-line-mode= as well in my org documents, the effect
>> is
>> > to highlight the whole current paragraph (which is a single line in the
>> > file).
>>
>> In case you find this useful, I found that highlighting the whole
>> paragraph was too much; I want just the actual "physical" line where
>> point is highlighted, whether it continues on or not. I do this:
>>
>> #+begin_src emacs-lisp
>> (defun esf/get-visual-line-range ()
>> (let (b e)
>> (save-excursion
>> (beginning-of-visual-line)
>> (setq b (point))
>> (end-of-visual-line)
>> (setq e (point))
>> )
>> (cons b e)))
>> (setq hl-line-range-function #'esf/get-visual-line-range)
>> #+end_src
>>
>> Of course, this is not what the OP wanted so excuse the diversion.
>>
>> --
>> Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78
>>
>