Diego Zamboni <di...@zzamboni.org> writes: > (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
Thanks Eric and Diego. I've used Diego's script from above with a slight adjustment to achieve my need for the highlighted line to show as 'gray' in the face-background line. #+begin_src emacs-lisp (defun esf/get-visual-line-range () (set-face-background 'hl-line "gray30") (let (b e) (save-excursion (beginning-of-visual-line) (setq b (point)) (end-of-visual-line) (setq e (+ 1 (point))) ) (cons b e))) (setq hl-line-range-function #'esf/get-visual-line-range) #+end_src Thanks both. Sharon. > > --Diego > > On Thu, Oct 31, 2019 at 5:03 PM Diego Zamboni <di...@zzamboni.org> wrote: > > Hi Eric, > > Nice! Thanks for the tip :) > > --Diego > > On Thu, Oct 31, 2019 at 4:56 PM Fraga, Eric <e.fr...@ucl.ac.uk> 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 -- A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk DrugFacts = https://www.drugfacts.org.uk Debian 10.1, fluxbox 1.3.7, emacs 26.3, org 9.2.6
signature.asc
Description: PGP signature