I'd like to highlight only the text in between the leading and trailing whitespace on each line. For example, I'd only like to highlight the region marked by the double arrow <-->
for the following line:
public static void printSum() {...}
<--------------------------------->
I run Doom Emacs and understand that hl-line-mode
is responsible for highlighting the current line. It appears that if I defined my own hl-line-range-function
to do what I wanted, I could apply this to any major mode (I want it on the dashboard).
It seems that hl-line-range-function
needs to return a cons cell of the starting and ending "positions" of where I'd like to highlight. What is the "position" data type? How is it represented? Can I simply return the value of functions like end-of-visual-line
and back-to-indentation
?
(point)
. And you can wrap the movement and call topoint
in asave-excursion
. On the other hand, maybe there's a function that gives you the position directly. At least the doc of those functions doesn't claim that they do, so even if they might you shouldn't count on that.:extend
attribute of thehl-line
face to nil. When it's set tonil
, the hl-line highlight will only affect positions of the line where characters are located (including whitespace). If you want it to only be effective in the dashboard, you can create a new face and usesetq-local
indashboard-mode
's hook to set that face as the value ofhl-line-face
only in the dashboard buffer.