emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hl-line and visual-line


From: David Reitter
Subject: Hl-line and visual-line
Date: Thu, 20 May 2010 16:30:59 -0400

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  <address@hidden>
+
+       * simple.el (visual-line-line-range): Define.
+       (visual-line-mode): Use for hl-line-range-function.
+
 2010-05-07  Chong Yidong  <address@hidden>
 
        * 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: PGP.sig
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]