From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sharon Kimble Subject: Re: how to highlight the background of my current paragraph? Date: Fri, 01 Nov 2019 11:44:45 +0000 Message-ID: <87eeyrhlci.fsf@skimble.plus.com> References: <87lft1tljb.fsf@skimble.plus.com> <8736f8sycr.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:57231) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQVMd-0000f6-Jn for emacs-orgmode@gnu.org; Fri, 01 Nov 2019 07:45:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQVMc-0007iN-7i for emacs-orgmode@gnu.org; Fri, 01 Nov 2019 07:45:11 -0400 Received: from avasout06.plus.net ([212.159.14.18]:51210) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iQVMb-0007dF-Mi for emacs-orgmode@gnu.org; Fri, 01 Nov 2019 07:45:10 -0400 In-Reply-To: (Diego Zamboni's message of "Thu, 31 Oct 2019 17:10:53 +0100") 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: Diego Zamboni Cc: Org-mode , "Fraga, Eric" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Diego Zamboni writes: > (sorry, further hijacking this thread) > > Eric: I made a slight improvement to your code (see the =3Dsetq e=3D) so = that the empty space at the end of the line gets highlighted as in the defa= ult behavior instead of only highlighting the part of the line that contain= s text: > > #+begin_src emacs-lisp > (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 (+ 1 (point))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) > =C2=A0 =C2=A0 =C2=A0 (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 wrote: > > Hi Eric, >=20=20=20=20 > Nice! Thanks for the tip :) >=20=20=20=20 > --Diego > > On Thu, Oct 31, 2019 at 4:56 PM Fraga, Eric wrote: >=20=20=20=20 > 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 effect is > > to highlight the whole current paragraph (which is a single lin= e in the > > file). >=20=20=20=20=20=20=20=20 > 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: >=20=20=20=20=20=20=20=20 > #+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 >=20=20=20=20=20=20=20=20 > Of course, this is not what the OP wanted so excuse the diversion. >=20=20=20=20=20=20=20=20 > -- > Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78 =2D-=20 A taste of linux =3D http://www.sharons.org.uk TGmeds =3D http://www.tgmeds.org.uk DrugFacts =3D https://www.drugfacts.org.uk Debian 10.1, fluxbox 1.3.7, emacs 26.3, org 9.2.6 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl28Gq0ACgkQNoGAGQr4 g1tsGRAAqaNA2ewBrIJ8v7ruf5mAu13AS7nXzj7GhLh6S6XNnnpO2TWSbkzlknQO hXXase/C17ef/yXNsrFP/44FBYG6RoTfKiL8CCe3+SN7GETKJb3WUW+pGzOiWOrv tDvhw+hJYfomuKEKVUVXgoxOCvk9bu0pWkuKR1Miu2ST9gskLiTaZWZn2qP9sszU 6HdQLxRvkRHt9Xk/Tktn+TTw97gHjPlVs7+A7bS+LQM+j2J334q59kNiFKFeI5XS z1Xzw+q4P/g7UEAlu6HTMDMsSLwapEZK1Mw/SGp4MsuAJDJvtEC5ZpOCClkKKRhf DavGGvTz/sppGFQRgkVjpO89YKVtLiv42cY5Zy0OwRuwLE5PIo/wQGzGcWFsWcZG M0+YIB9LCGsOJT8xhWi8Qh3IVXwhsMQdoonkhwktVy596ctniEuP/C0A+Zj68fdJ 0lT2pa3aGX4sCkEYczZODERf6Mr1P3xU8WoiagfflvxVupsq2v7G1I6OiMKUd0kk FhuHYdN1rT0pbl6YSJPqA27PGLtpx4vmAafwy78Anf7x8UIRfMZtq93gaJ8TbNhp ss1hLOXyFki5raLZ40yjs+blxW8uHJJ6x3F4MN61XhZWe01Yr1pADcuVOz9umPWF QGqTRHytga9S74/0+oWxWcl1aVKlKGzp9enI5HAONUSbO0eEAh8= =WD6X -----END PGP SIGNATURE----- --=-=-=--