GNU bug report logs -
#36361
'hl-line-range-function' as list of choice
Previous Next
To reply to this bug, email your comments to 36361 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36361
; Package
emacs
.
(Mon, 24 Jun 2019 16:31:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sebastian Urban <mrsebastianurban <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 24 Jun 2019 16:31:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Because 'hl-line-mode' highlight logical line instead of screen line
when 'visual-line-mode' is active, and for example 'C-a' and 'C-e'
change behaviour, some people want 'hl-line-mode' to change the
behaviour as well. They usually use 'hl-line-range-function' to
define how it should highlight, but... cannot it be made simpler?
Like by making 'hl-line-range-function' a list of choice:
- nil for default behaviour,
- "Screen line" to change to screen line,
- "Function" for user to write what he wants.
I'm writing this from perspective of "Customize" menu.
S. U.
In GNU Emacs 26.2 (build 1, i686-w64-mingw32)
of 2019-04-13 built on CIRROCUMULUS
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749
Windowing system distributor 'Microsoft Corp.', version 6.1.7601
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36361
; Package
emacs
.
(Mon, 08 Jul 2019 23:52:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 36361 <at> debbugs.gnu.org (full text, mbox):
Sebastian Urban <mrsebastianurban <at> gmail.com> writes:
> Because 'hl-line-mode' highlight logical line instead of screen line
> when 'visual-line-mode' is active, and for example 'C-a' and 'C-e'
> change behaviour, some people want 'hl-line-mode' to change the
> behaviour as well. They usually use 'hl-line-range-function' to
> define how it should highlight, but... cannot it be made simpler?
> Like by making 'hl-line-range-function' a list of choice:
> - nil for default behaviour,
> - "Screen line" to change to screen line,
> - "Function" for user to write what he wants.
I think that makes sense, and I think `visual-line-mode' should adjust
`hl-line-range-function' automatically to do the visual line highlight.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36361
; Package
emacs
.
(Tue, 26 Oct 2021 18:50:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 36361 <at> debbugs.gnu.org (full text, mbox):
FWIW, I've been using the following in Emacs 27.2:
#+begin_src elisp
(defun visual-line-range-function ()
"Return a cons cell of positions of begining and end
of the current line in `visual-line-mode`. Meant to be used
as the value of `hl-line-range-function`."
(save-excursion
(cons (progn (beginning-of-visual-line) (point))
(progn (beginning-of-visual-line 2) (point)))))
(defun set-visual-line-range-function ()
(setq-local hl-line-range-function
(if visual-line-mode 'visual-line-range-function nil)))
(add-hook 'visual-line-mode-hook 'set-visual-line-range-function)
#+end_src
but it seems to conflict with the temporary-goal-column in
line-move-visual. If I have a buffer:
- foo
- bar
- zot
With point just before foo and do C-n twice, the first one moves point
to just before bar, but the second moves point to the beginning of the
3rd line.
Suggestions for an improved version are welcome.
Howard
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36361
; Package
emacs
.
(Tue, 26 Oct 2021 19:12:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 36361 <at> debbugs.gnu.org (full text, mbox):
> From: Howard Melman <hmelman <at> gmail.com>
> Date: Tue, 26 Oct 2021 14:48:53 -0400
>
> FWIW, I've been using the following in Emacs 27.2:
>
> #+begin_src elisp
> (defun visual-line-range-function ()
> "Return a cons cell of positions of begining and end
> of the current line in `visual-line-mode`. Meant to be used
> as the value of `hl-line-range-function`."
> (save-excursion
> (cons (progn (beginning-of-visual-line) (point))
> (progn (beginning-of-visual-line 2) (point)))))
>
> (defun set-visual-line-range-function ()
> (setq-local hl-line-range-function
> (if visual-line-mode 'visual-line-range-function nil)))
>
> (add-hook 'visual-line-mode-hook 'set-visual-line-range-function)
> #+end_src
>
> but it seems to conflict with the temporary-goal-column in
> line-move-visual. If I have a buffer:
>
> - foo
> - bar
> - zot
>
> With point just before foo and do C-n twice, the first one moves point
> to just before bar, but the second moves point to the beginning of the
> 3rd line.
>
> Suggestions for an improved version are welcome.
Try this:
(defun visual-line-range-function ()
"Return a cons cell of positions of begining and end
of the current line in `visual-line-mode`. Meant to be used
as the value of `hl-line-range-function`."
(save-excursion
(cons (progn (vertical-motion 0) (point))
(progn (vertical-motion 1) (point)))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36361
; Package
emacs
.
(Tue, 26 Oct 2021 19:19:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 36361 <at> debbugs.gnu.org (full text, mbox):
> On Oct 26, 2021, at 3:11 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> Try this:
>
> (defun visual-line-range-function ()
> "Return a cons cell of positions of begining and end
> of the current line in `visual-line-mode`. Meant to be used
> as the value of `hl-line-range-function`."
> (save-excursion
> (cons (progn (vertical-motion 0) (point))
> (progn (vertical-motion 1) (point)))))
That does seem to work well. Thanks.
I hope visual-line-mode and hl-line-mode can be made to work
well together out of the box.
Howard
This bug report was last modified 3 years and 235 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.