From mboxrd@z Thu Jan 1 00:00:00 1970 From: Diego Zamboni Subject: Re: how to highlight the background of my current paragraph? Date: Thu, 31 Oct 2019 17:03:16 +0100 Message-ID: References: <87lft1tljb.fsf@skimble.plus.com> <8736f8sycr.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000006a6e95059636fd3c" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34975) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQCv6-0004MN-HZ for emacs-orgmode@gnu.org; Thu, 31 Oct 2019 12:03:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQCv4-0005F4-Na for emacs-orgmode@gnu.org; Thu, 31 Oct 2019 12:03:32 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:52644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iQCv3-0005Cy-8k for emacs-orgmode@gnu.org; Thu, 31 Oct 2019 12:03:30 -0400 Received: by mail-wm1-x329.google.com with SMTP id p21so6509963wmg.2 for ; Thu, 31 Oct 2019 09:03:28 -0700 (PDT) In-Reply-To: <8736f8sycr.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Fraga, Eric" Cc: Org-mode , Sharon Kimble --0000000000006a6e95059636fd3c Content-Type: text/plain; charset="UTF-8" Hi Eric, Nice! Thanks for the tip :) --Diego On Thu, Oct 31, 2019 at 4:56 PM Fraga, Eric 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 > --0000000000006a6e95059636fd3c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Eric,

Nice! Thanks for the tip :)

--Diego


On Thu, Oct 31, 2019 at = 4:56 PM Fraga, Eric <e.fraga@ucl.ac= .uk> wrote:
On Thursday, 31 Oct 2019 at 08:52, Diego Zamboni wrote:
> Since I use =3Dvisual-line-mode=3D as well in my org documents, the ef= fect is
> to highlight the whole current paragraph (which is a single line in th= e
> file).

In case you find this useful, I found that highlighting the whole
paragraph was too much; I want just the actual "physical" line wh= ere
point is highlighted, whether it continues on or not.=C2=A0 I do this:

#+begin_src emacs-lisp
=C2=A0 (defun esf/get-visual-line-range ()
=C2=A0 =C2=A0 (let (b e)
=C2=A0 =C2=A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (beginning-of-visual-line)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq b (point))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (end-of-visual-line)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq e (point))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 =C2=A0 (cons b e)))
=C2=A0 (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
--0000000000006a6e95059636fd3c--