From: David Reitter <david.reitter@gmail.com>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Hl-line and visual-line
Date: Thu, 20 May 2010 16:30:59 -0400 [thread overview]
Message-ID: <45790724-63FC-4B80-A70D-8CD49A92FEE3@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]
Hl-line highlights the buffer line rather than the visual line even in `visual-line-mode': I don't think that makes sense.
So I think this little change would be good upstream as well.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ebb21c4..4b6d07d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-20 David Reitter <david.reitter@gmail.com>
+
+ * simple.el (visual-line-line-range): Define.
+ (visual-line-mode): Use for hl-line-range-function.
+
2010-05-07 Chong Yidong <cyd@stupidchicken.com>
* Version 23.2 released.
diff --git a/lisp/simple.el b/lisp/simple.el
index 28ed4ef..b7f2646 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4697,6 +4697,11 @@ other purposes."
(copy-tree fringe-indicator-alist)))))))
(set-default symbol value)))
+(defun visual-line-line-range ()
+ (save-excursion
+ (cons (progn (vertical-motion 0) (point))
+ (progn (vertical-motion 1) (point)))))
+
(defvar visual-line--saved-state nil)
(define-minor-mode visual-line-mode
@@ -4712,7 +4717,8 @@ This also turns on `word-wrap' in the buffer."
;; visual-line-mode is turned off.
(dolist (var '(line-move-visual truncate-lines
truncate-partial-width-windows
- word-wrap fringe-indicator-alist))
+ word-wrap fringe-indicator-alist
+ hl-line-range-function))
(if (local-variable-p var)
(push (cons var (symbol-value var))
visual-line--saved-state)))
@@ -4722,12 +4728,14 @@ This also turns on `word-wrap' in the buffer."
word-wrap t
fringe-indicator-alist
(cons (cons 'continuation visual-line-fringe-indicators)
- fringe-indicator-alist)))
+ fringe-indicator-alist))
+ (set (make-local-variable 'hl-line-range-function) #'visual-line-line-range))
(kill-local-variable 'line-move-visual)
(kill-local-variable 'word-wrap)
(kill-local-variable 'truncate-lines)
(kill-local-variable 'truncate-partial-width-windows)
(kill-local-variable 'fringe-indicator-alist)
+ (kill-local-variable 'hl-line-range-function)
(dolist (saved visual-line--saved-state)
(set (make-local-variable (car saved)) (cdr saved)))
(kill-local-variable 'visual-line--saved-state)))
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 203 bytes --]
next reply other threads:[~2010-05-20 20:30 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-20 20:30 David Reitter [this message]
2010-05-20 21:02 ` Hl-line and visual-line Eli Zaretskii
2010-05-21 2:35 ` David Reitter
2010-05-21 6:34 ` Tassilo Horn
2010-05-21 8:17 ` Eli Zaretskii
2010-05-21 10:16 ` Tassilo Horn
2010-05-21 14:22 ` David Reitter
2010-05-21 14:57 ` Eli Zaretskii
2010-05-23 17:26 ` Eli Zaretskii
2010-05-23 19:13 ` David Reitter
2010-05-23 20:33 ` Eli Zaretskii
2010-05-23 23:04 ` David Reitter
2010-05-24 18:16 ` Eli Zaretskii
2010-05-24 18:46 ` Stefan Monnier
2010-05-24 19:06 ` Lennart Borgman
2010-05-24 22:24 ` Eli Zaretskii
2010-05-24 22:37 ` Lennart Borgman
2010-05-24 22:47 ` David Reitter
2010-05-24 23:03 ` Lennart Borgman
2010-05-21 16:54 ` Lennart Borgman
2010-05-21 17:39 ` Eli Zaretskii
2010-05-21 20:24 ` Stefan Monnier
2010-05-21 22:31 ` Lennart Borgman
2010-05-22 0:18 ` Stefan Monnier
2010-05-22 2:35 ` Lennart Borgman
2010-05-22 13:10 ` Lennart Borgman
2010-05-22 17:04 ` Lennart Borgman
2010-05-21 6:36 ` Eli Zaretskii
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45790724-63FC-4B80-A70D-8CD49A92FEE3@gmail.com \
--to=david.reitter@gmail.com \
--cc=emacs-devel@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.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).