emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 02/03: [gnugo frolic] Sync column headers w/ buffer text; handle


From: Thien-Thi Nguyen
Subject: [elpa] 02/03: [gnugo frolic] Sync column headers w/ buffer text; handle offsets.
Date: Wed, 09 Apr 2014 12:17:14 +0000

ttn pushed a commit to branch master
in repository elpa.

commit ec2e2bb8e2cb7d5776a94b4ea4643551e11c965e
Author: Thien-Thi Nguyen <address@hidden>
Date:   Wed Apr 9 14:17:59 2014 +0200

    [gnugo frolic] Sync column headers w/ buffer text; handle offsets.
    
    * packages/gnugo/gnugo.el (gnugo-frolic-in-the-leaves):
    For ‘header-line-format’, replace constant string
    with ‘(:eval ...)’ form that handles left scroll bar,
    left fringe, and horizontal scrolling margin, if any.
---
 packages/gnugo/gnugo.el |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index f042e7a..d19a195 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -829,11 +829,34 @@ are dimmed.  Type \\[describe-mode] in that buffer for 
details."
       (gnugo-frolic-mode)
       (erase-buffer)
       (setq header-line-format
-            (concat (make-string 11 ?\s)
-                    (mapconcat (lambda (n)
-                                 (format "%-5s" n))
-                               lanes
-                               " ")))
+            (lexical-let ((full (concat
+                                 (make-string 11 ?\s)
+                                 (mapconcat (lambda (n)
+                                              (format "%-5s" n))
+                                            lanes
+                                            " "))))
+              `((:eval
+                 (funcall
+                  ,(lambda ()
+                     (cl-flet
+                         ((sp (w) (propertize
+                                   " " 'display
+                                   `(space :width ,w))))
+                       (concat
+                        (when (eq 'left scroll-bar-mode)
+                          (let ((w (or scroll-bar-width
+                                       (frame-parameter
+                                        nil 'scroll-bar-width)))
+                                (cw (frame-char-width)))
+                            (sp (if w
+                                    (/ w cw)
+                                  2))))
+                        (let ((fc (fringe-columns 'left t)))
+                          (unless (zerop fc)
+                            (sp fc)))
+                        (condition-case nil
+                            (substring full (window-hscroll))
+                          (error ""))))))))))
       (set (make-local-variable 'gnugo-frolic-parent-buffer) from)
       (set (make-local-variable 'gnugo-state)
            (buffer-local-value 'gnugo-state from))



reply via email to

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