emacs-devel
[Top][All Lists]
Advanced

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

Re: Suggestion: A fringe indicator that shows the last/first line before


From: David De La Harpe Golden
Subject: Re: Suggestion: A fringe indicator that shows the last/first line before scrolling
Date: Fri, 29 Feb 2008 17:57:14 +0000

On 29/02/2008, Stefan Monnier <address@hidden> wrote:
> Not really.  It just means it will only work 99%.
>

Quite different 99% approach sketched below, uses our old friend the
idle timer, to show the window position in the fringe with a 2 sec
lag. Works better than I expected.

I think I'm not quite getting something though: why are fringe marks
"replacing" display properties (i.e. if a character pos has a fringe
display property, the character isn't displayed)? - that leads to my
use of before and after string properties.   I wanted to hide the
fringe marks conditionally while they align with the real window-start
and window-end (they're not useful then), but because the fringe marks
are "replacing", the magic "when" conditional display property is
unsuitable for that.   If before/after-string properties supported
"when" or fringe marks weren't "replacing" display properties....


(defface window-pos-fringe
  '((t (:foreground "cyan")))
  "Window pos fringe face"
  :group 'scrolling)

(defvar show-old-window-pos-overlay
   (make-overlay (window-start) (window-end)))

(overlay-put show-old-window-pos-overlay 'before-string
             (concat
              (propertize "[" 'display
                          (list 'left-fringe 'top-left-angle
                                'window-pos-fringe))
              (propertize "[" 'display
                          (list 'right-fringe 'top-right-angle
                                'window-pos-fringe))))

(overlay-put show-old-window-pos-overlay 'after-string
             (concat
              (propertize "]" 'display
                          (list 'left-fringe 'bottom-left-angle
                                'window-pos-fringe))
              (propertize "]" 'display
                          (list 'right-fringe
                                'bottom-right-angle
                                'window-pos-fringe))))


(defun update-window-pos-overlay  ()
  (move-overlay show-old-window-pos-overlay
                (window-start)
                (- (window-end) 1)
                (window-buffer))
  (redisplay))

(run-with-idle-timer 2 t 'update-window-pos-overlay)




reply via email to

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