unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Hl-line and visual-line
@ 2010-05-20 20:30 David Reitter
  2010-05-20 21:02 ` Eli Zaretskii
  0 siblings, 1 reply; 28+ messages in thread
From: David Reitter @ 2010-05-20 20:30 UTC (permalink / raw)
  To: Emacs-Devel devel

[-- 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 --]

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2010-05-24 23:03 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-20 20:30 Hl-line and visual-line David Reitter
2010-05-20 21:02 ` 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

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).