From: "David De La Harpe Golden" <david.delaharpe.golden@gmail.com>
To: "Stefan Monnier" <monnier@iro.umontreal.ca>,
"Tassilo Horn" <tassilo@member.fsf.org>
Cc: David O'Toole <dto@gnu.org>,
"Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>,
emacs-devel@gnu.org
Subject: Re: Suggestion: A fringe indicator that shows the last/first line before scrolling
Date: Fri, 29 Feb 2008 21:04:38 +0000 [thread overview]
Message-ID: <8e24944a0802291304m281c72efx9e00a8923ace862a@mail.gmail.com> (raw)
In-Reply-To: <8e24944a0802290957i12765c67y8433cae9e8a8f242@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]
> I wanted to hide the
> fringe marks conditionally while they align with the real window-start
> and window-end (they're not useful then),
Huh. Of course, what's an apparently viable workaround? Another idle
timer! Yay!
Version 2 attached - made it a global minor mode.
Probably lots of issues, most major apart from previous mail's
"am I using fringes and overlays right" question:
really should use separate overlay for each window (maybe weak hash
table needed, or is there a way to hang things off windows I've
missed?), right now, only shows in current window, which is a pity
because it'd probably be particularly nice for scroll-other-window
situations.
nongui terminals and gui terminals without fringes, could use
alternate highlighting strategies I guess.
If you scroll fast, then what's fringe marked is of course not the
immediately preceding window position, but the one from when emacs was
last idle. This is both desirable and undesirable, depending on
whether you consider a series of consecutive scroll commands as one
overall scroll operation or separate scroll operations, so not sure if
should be fixed, maybe a post-command-hook could be used so that
depending on user prefs, page-scrolling could fringe mark anew each
time while scroll-bar-scrolling only after the lag, or whatever makes
sense.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: show-old-window-pos.el --]
[-- Type: text/x-emacs-lisp; name=show-old-window-pos.el, Size: 2602 bytes --]
;;; show-old-window-pos.el --- Show old window position in buffer after changes.
;; Version: 2
(defgroup show-old-window-pos nil
"Indicate the old window position for a bit when scrolling."
:version "23.1"
:group 'windows)
(defface show-old-window-pos-fringe
'((t (:foreground "cyan")))
"Face for old window position fringe mark."
:group 'show-old-window-pos
:version "23.1")
(defcustom show-old-window-pos-linger-time 2
"How long the fringe marks showing old window position should be visible for."
:type 'integer
:group 'show-old-window-pos
:version "23.1")
(defvar show-old-window-pos-overlay nil)
(defun show-old-window-pos-overlay-update-pos ()
(or show-old-window-pos-overlay
(setq show-old-window-pos-overlay
(make-overlay
(window-start)
(- (window-end) 1)
(window-buffer))))
(move-overlay show-old-window-pos-overlay
(window-start)
(- (window-end) 1)
(window-buffer))
(show-old-window-pos-overlay-showhide)
(redisplay))
(defun show-old-window-pos-overlay-showhide ()
(when show-old-window-pos-overlay
(if (equal (window-start) (overlay-start show-old-window-pos-overlay))
(overlay-put show-old-window-pos-overlay 'before-string nil)
(overlay-put show-old-window-pos-overlay 'before-string
(concat
(propertize "[" 'display
(list 'left-fringe 'top-left-angle
'show-old-window-pos-fringe))
(propertize "[" 'display
(list 'right-fringe 'top-right-angle
'show-old-window-pos-fringe)))))
(if (equal (- (window-end) 1) (overlay-end show-old-window-pos-overlay))
(overlay-put show-old-window-pos-overlay 'after-string nil)
(overlay-put show-old-window-pos-overlay 'after-string
(concat
(propertize "]" 'display
(list 'left-fringe 'bottom-left-angle
'show-old-window-pos-fringe))
(propertize "]" 'display
(list 'right-fringe
'bottom-right-angle
'show-old-window-pos-fringe)))))))
(define-minor-mode show-old-window-pos-mode
"Toggle show-old-window-pos-mode"
:global t
:group 'show-old-window-pos
:init-value nil
(if show-old-window-pos-mode
(progn
(run-with-idle-timer 0 t 'show-old-window-pos-overlay-showhide)
(run-with-idle-timer show-old-window-pos-linger-time
t 'show-old-window-pos-overlay-update-pos))
(cancel-function-timers 'show-old-window-pos-overlay-showhide)
(cancel-function-timers 'show-old-window-pos-overlay-update-pos)
(and show-old-window-pos-overlay
(delete-overlay show-old-window-pos-overlay))))
(provide 'show-old-window-pos)
next prev parent reply other threads:[~2008-02-29 21:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-28 11:48 Suggestion: A fringe indicator that shows the last/first line before scrolling Tassilo Horn
2008-02-28 13:55 ` David O'Toole
2008-02-28 15:46 ` Lennart Borgman (gmail)
2008-02-28 16:34 ` David De La Harpe Golden
2008-02-28 17:52 ` Lennart Borgman (gmail)
2008-02-28 18:01 ` David De La Harpe Golden
2008-02-28 18:12 ` Lennart Borgman (gmail)
2008-02-28 18:18 ` David De La Harpe Golden
2008-02-28 18:34 ` Lennart Borgman (gmail)
2008-02-28 23:18 ` David De La Harpe Golden
2008-02-29 1:55 ` Stefan Monnier
2008-02-29 2:50 ` David De La Harpe Golden
2008-02-29 4:33 ` Stefan Monnier
2008-02-29 17:57 ` David De La Harpe Golden
2008-02-29 21:04 ` David De La Harpe Golden [this message]
2008-02-29 21:12 ` David De La Harpe Golden
2008-02-29 21:33 ` Lennart Borgman (gmail)
2008-02-29 23:16 ` David De La Harpe Golden
2008-02-29 23:29 ` Lennart Borgman (gmail)
2008-02-29 23:59 ` David De La Harpe Golden
2008-03-01 0:05 ` David De La Harpe Golden
2008-03-01 0:10 ` Lennart Borgman (gmail)
2008-03-01 3:28 ` David De La Harpe Golden
2008-03-01 3:39 ` Miles Bader
2008-03-01 3:59 ` David De La Harpe Golden
2008-03-02 3:00 ` David De La Harpe Golden
2008-03-01 3:44 ` David De La Harpe Golden
2008-02-28 17:19 ` Stefan Monnier
2008-02-28 17:39 ` Tassilo Horn
2008-02-28 18:16 ` Stefan Monnier
2008-02-29 1:40 ` Richard Stallman
2008-02-29 8:02 ` Tassilo Horn
2008-02-29 19:54 ` Richard Stallman
2008-03-01 9:28 ` Tassilo Horn
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e24944a0802291304m281c72efx9e00a8923ace862a@mail.gmail.com \
--to=david.delaharpe.golden@gmail.com \
--cc=dto@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=tassilo@member.fsf.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.