From: Diego Zamboni <diego@zzamboni.org>
To: "Fraga, Eric" <e.fraga@ucl.ac.uk>
Cc: Org-mode <emacs-orgmode@gnu.org>,
Sharon Kimble <boudiccas@skimble.plus.com>
Subject: Re: how to highlight the background of my current paragraph?
Date: Thu, 31 Oct 2019 17:10:53 +0100 [thread overview]
Message-ID: <CAGY83EfDsf=3vHKJ9H7o343Wf4_GFSLL6Jgjh-VQPSb8k4RNrA@mail.gmail.com> (raw)
In-Reply-To: <CAGY83Edm=KBqA1YUTDigThxB90cmSZmOw7HKZRCpeTdCNV0mgw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]
(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 <diego@zzamboni.org> wrote:
> 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 =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
>>
>
[-- Attachment #2: Type: text/html, Size: 2573 bytes --]
next prev parent reply other threads:[~2019-10-31 16:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-31 7:35 how to highlight the background of my current paragraph? Sharon Kimble
2019-10-31 7:52 ` Diego Zamboni
2019-10-31 15:56 ` Fraga, Eric
2019-10-31 16:03 ` Diego Zamboni
2019-10-31 16:10 ` Diego Zamboni [this message]
2019-10-31 16:22 ` Fraga, Eric
2019-10-31 16:43 ` Fraga, Eric
2019-11-01 11:44 ` Sharon Kimble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGY83EfDsf=3vHKJ9H7o343Wf4_GFSLL6Jgjh-VQPSb8k4RNrA@mail.gmail.com' \
--to=diego@zzamboni.org \
--cc=boudiccas@skimble.plus.com \
--cc=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).