comparison lisp/scroll-all.el @ 17598:b3016633740a

Renamed from scroll-lock.el. All functions renamed. (scroll-all-mode): Variable renamed from is-scroll-lock.
author Richard M. Stallman <rms@gnu.org>
date Tue, 29 Apr 1997 21:06:16 +0000
parents a60da52b8ea2
children 2d0bece94ee7
comparison
equal deleted inserted replaced
17597:a60da52b8ea2 17598:b3016633740a
1 ;; scroll-lock.el -- scroll-locking minor mode 1 ;; scroll-all.el -- scroll all buffers together minor mode
2 2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4 4
5 ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com> 5 ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com>
6 ;; Keywords: scroll crisp brief lock 6 ;; Keywords: scroll crisp brief lock
29 ;; potential scrolling commands and if we're locked, mirrors them in all 29 ;; potential scrolling commands and if we're locked, mirrors them in all
30 ;; windows. This allows us to grab line-at-a-time scrolling as well as 30 ;; windows. This allows us to grab line-at-a-time scrolling as well as
31 ;; screen-at-a-time scrolling, and doesn't remap any of the keyboard 31 ;; screen-at-a-time scrolling, and doesn't remap any of the keyboard
32 ;; commands to do it. 32 ;; commands to do it.
33 33
34 ;; You can disable autoloading of this package by placing 34 ;; You can enable and disable this mode with the 'scroll-all-mode' command.
35 ;; (setq crisp-load-scroll-lock nil) in your .emacs before loading
36 ;; the crisp package. If you want to use this package by itself,
37 ;; you can enable it by placing the following in your .emacs:
38
39 ;; (require 'scroll-lock)
40
41 ;; In the first (autoloaded) case, meta-f1 is bound to the command to
42 ;; toggle the scroll-lock mode. In the second (non-autoloaded) case,
43 ;; you can enable and disable it with the 'scroll-lock-mode' command.
44 35
45 ;; Suggestions/ideas from: 36 ;; Suggestions/ideas from:
46 ;; Rick Macdonald <rickm@vsl.com> 37 ;; Rick Macdonald <rickm@vsl.com>
47 ;; Anders Lindgren <andersl@csd.uu.se> 38 ;; Anders Lindgren <andersl@csd.uu.se>
48 39
49 (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) 40 (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
50 (defvar is-scroll-locked nil 41 (defvar scroll-all-mode nil
51 "Track status of scroll locking.") 42 "Track status of scroll locking.")
52 (if running-xemacs 43 (if running-xemacs
53 (add-minor-mode 'is-scroll-locked " *SL*") 44 (add-minor-mode 'scroll-all-mode " *SL*")
54 (or (assq 'is-scroll-locked-mode minor-mode-alist) 45 (or (assq 'scroll-all-mode-mode minor-mode-alist)
55 (setq minor-mode-alist 46 (setq minor-mode-alist
56 (cons '(is-scroll-locked-mode " *SL*") minor-mode-alist)))) 47 (cons '(scroll-all-mode-mode " *SL*") minor-mode-alist))))
57 48
58 (defun scroll-lock-scroll-down-all (arg) 49 (defun scroll-all-scroll-down-all (arg)
59 "Scroll-down all visible windows." 50 "Scroll down all visible windows."
60 (interactive "P") 51 (interactive "P")
61 (let ((num-windows (count-windows)) 52 (let ((num-windows (count-windows))
62 (count 1)) 53 (count 1))
63 (if (> num-windows 1) 54 (if (> num-windows 1)
64 ( progn (other-window 1) 55 ( progn (other-window 1)
66 (if (not (eq (point) (point-max))) 57 (if (not (eq (point) (point-max)))
67 (progn (call-interactively 'next-line))) 58 (progn (call-interactively 'next-line)))
68 (other-window 1) 59 (other-window 1)
69 (setq count (1+ count))))))) 60 (setq count (1+ count)))))))
70 61
71 (defun scroll-lock-scroll-up-all (arg) 62 (defun scroll-all-scroll-up-all (arg)
72 "Scroll-up all visible windows." 63 "Scroll up all visible windows."
73 (interactive "P") 64 (interactive "P")
74 (let ((num-windows (count-windows)) 65 (let ((num-windows (count-windows))
75 (count 1)) 66 (count 1))
76 (if (> num-windows 1) 67 (if (> num-windows 1)
77 ( progn (other-window 1) 68 ( progn (other-window 1)
79 (if (not (eq (point) (point-min))) 70 (if (not (eq (point) (point-min)))
80 (progn (call-interactively 'previous-line))) 71 (progn (call-interactively 'previous-line)))
81 (other-window 1) 72 (other-window 1)
82 (setq count (1+ count))))))) 73 (setq count (1+ count)))))))
83 74
84 (defun scroll-lock-page-down-all (arg) 75 (defun scroll-all-page-down-all (arg)
85 "Page-down all visible windows." 76 "Page down in all visible windows."
86 (interactive "P") 77 (interactive "P")
87 (let ((num-windows (count-windows)) 78 (let ((num-windows (count-windows))
88 (count 1)) 79 (count 1))
89 (if (> num-windows 1) 80 (if (> num-windows 1)
90 (progn (other-window 1) 81 (progn (other-window 1)
91 (while (< count num-windows) 82 (while (< count num-windows)
92 (call-interactively 'fkey-scroll-up) 83 (call-interactively 'fkey-scroll-up)
93 (other-window 1) 84 (other-window 1)
94 (setq count (1+ count))))))) 85 (setq count (1+ count)))))))
95 86
96 (defun scroll-lock-page-up-all (arg) 87 (defun scroll-all-page-up-all (arg)
97 "Page-up all visible windows." 88 "Page up in all visible windows."
98 (interactive "P") 89 (interactive "P")
99 (let ((num-windows (count-windows)) 90 (let ((num-windows (count-windows))
100 (count 1)) 91 (count 1))
101 (if (> num-windows 1) 92 (if (> num-windows 1)
102 (progn (other-window 1) 93 (progn (other-window 1)
104 (call-interactively 'fkey-scroll-down) 95 (call-interactively 'fkey-scroll-down)
105 (other-window 1) 96 (other-window 1)
106 (setq count (1+ count))))))) 97 (setq count (1+ count)))))))
107 98
108 99
109 (defun scroll-lock-check-to-scroll () 100 (defun scroll-all-check-to-scroll ()
110 "Check last-command to see if a scroll was done." 101 "Check `last-command' to see if a scroll was done."
111 (if (eq this-command 'next-line) 102 (if (eq this-command 'next-line)
112 (call-interactively 'scroll-lock-scroll-down-all)) 103 (call-interactively 'scroll-all-scroll-down-all))
113 (if (eq this-command 'previous-line) 104 (if (eq this-command 'previous-line)
114 (call-interactively 'scroll-lock-scroll-up-all)) 105 (call-interactively 'scroll-all-scroll-up-all))
115 (if (eq this-command 'fkey-scroll-up) 106 (if (eq this-command 'fkey-scroll-up)
116 (call-interactively 'scroll-lock-page-down-all)) 107 (call-interactively 'scroll-all-page-down-all))
117 (if (eq this-command 'fkey-scroll-down) 108 (if (eq this-command 'fkey-scroll-down)
118 (call-interactively 'scroll-lock-page-up-all))) 109 (call-interactively 'scroll-all-page-up-all)))
119 110
120 111
121 (defun scroll-lock-mode (arg) 112 (defun scroll-all-mode (arg)
122 "Toggle scroll-lock minor mode." 113 "Toggle Scroll-All minor mode."
123 (interactive "P") 114 (interactive "P")
124 (setq is-scroll-locked (not is-scroll-locked)) 115 (setq scroll-all-mode (not scroll-all-mode))
125 (cond 116 (cond
126 ((eq is-scroll-locked 't) 117 ((eq scroll-all-mode 't)
127 (add-hook 'post-command-hook 'scroll-lock-check-to-scroll)) 118 (add-hook 'post-command-hook 'scroll-all-check-to-scroll))
128 ((eq is-scroll-locked 'nil) 119 ((eq scroll-all-mode 'nil)
129 (remove-hook 'post-command-hook 'scroll-lock-check-to-scroll)))) 120 (remove-hook 'post-command-hook 'scroll-all-check-to-scroll))))
130 121
131 (provide 'scroll-lock) 122 (provide 'scroll-all)
132 123
133 ;; scroll-all.el ends here 124 ;; scroll-all.el ends here