aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-08-18 15:03:37 +0000
committerRichard M. Stallman2005-08-18 15:03:37 +0000
commit94396ace8242eefeee0103070cdb8be412a0b1ef (patch)
tree2761d1f7814c5b2d76b3f502cefd484ae5abc141
parent25d98a97feea849754498f9035cb93aa3c7b1b61 (diff)
downloademacs-94396ace8242eefeee0103070cdb8be412a0b1ef.tar.gz
emacs-94396ace8242eefeee0103070cdb8be412a0b1ef.zip
*** empty log message ***
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/scroll-lock.el130
-rw-r--r--man/ChangeLog15
4 files changed, 155 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 0d4b2b30882..14414e9bd1b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1747,6 +1747,12 @@ recognized.
1747--- 1747---
1748** The TCL package tcl-mode.el was replaced by tcl.el. 1748** The TCL package tcl-mode.el was replaced by tcl.el.
1749This was actually done in Emacs-21.1, and was not documented. 1749This was actually done in Emacs-21.1, and was not documented.
1750
1751** The new package scroll-lock.el provides the Scroll Lock minor mode
1752for pager-like scrolling. Keys which normally move point by line or
1753paragraph will scroll the buffer by the respective amount of lines
1754instead and point will be kept vertically fixed relative to window
1755boundaries during scrolling.
1750 1756
1751* Changes in Specialized Modes and Packages in Emacs 22.1: 1757* Changes in Specialized Modes and Packages in Emacs 22.1:
1752 1758
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0caf88a7861..ef16c694cd1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12005-08-18 Richard M. Stallman <rms@gnu.org>
2
3 * scroll-lock.el: New file.
4
12005-08-18 Thien-Thi Nguyen <ttn@gnu.org> 52005-08-18 Thien-Thi Nguyen <ttn@gnu.org>
2 6
3 * dired.el (dired-move-to-end-of-filename): 7 * dired.el (dired-move-to-end-of-filename):
diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el
new file mode 100644
index 00000000000..7b2beb54b85
--- /dev/null
+++ b/lisp/scroll-lock.el
@@ -0,0 +1,130 @@
1;;; scroll-lock.el --- Scroll lock scrolling.
2
3;; Copyright (C) 2005 Free Software Foundation, Inc.
4
5;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
6;; Maintainer: FSF
7;; Created: 2005-06-18
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with this program; see the file COPYING. If not, write to
23;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;; By activating Scroll Lock mode, keys for moving point by line or
29;; paragraph will scroll the buffer by the respective amount of lines
30;; instead. Point will be kept vertically fixed relative to window
31;; boundaries.
32
33;;; Code:
34
35(defvar scroll-lock-mode-map
36 (let ((map (make-sparse-keymap)))
37 (define-key map [remap next-line] 'scroll-lock-next-line)
38 (define-key map [remap previous-line] 'scroll-lock-previous-line)
39 (define-key map [remap forward-paragraph] 'scroll-lock-forward-paragrap=
40h)
41 (define-key map [remap backward-paragraph] 'scroll-lock-backward-paragr=
42aph)
43 map)
44 "Keymap for Scroll Lock mode.")
45
46(defvar scroll-lock-preserve-screen-pos-save scroll-preserve-screen-position
47 "Used for saving the state of `scroll-preserve-screen-position'.")
48(make-variable-buffer-local 'scroll-lock-preserve-screen-pos-save)
49
50(defvar scroll-lock-temporary-goal-column 0
51 "Like `temporary-goal-column' but for scroll-lock-* commands.")
52
53;;;###autoload
54(define-minor-mode scroll-lock-mode
55 "Minor mode for pager-like scrolling.
56Keys which normally move point by line or paragraph will scroll
57the buffer by the respective amount of lines instead and point
58will be kept vertically fixed relative to window boundaries
59during scrolling."
60 :lighter " ScrLck"
61 :keymap scroll-lock-mode-map
62 (if scroll-lock-mode
63 (progn
64 (setq scroll-lock-preserve-screen-pos-save
65 scroll-preserve-screen-position)
66 (set (make-local-variable 'scroll-preserve-screen-position) 'always))
67 (setq scroll-preserve-screen-position
68 scroll-lock-preserve-screen-pos-save)))
69
70(defun scroll-lock-update-goal-column ()
71 "Update `scroll-lock-temporary-goal-column' if necessary."
72 (unless (memq last-command '(scroll-lock-next-line
73 scroll-lock-previous-line
74 scroll-lock-forward-paragraph
75 scroll-lock-backward-paragraph))
76 (setq scroll-lock-temporary-goal-column (current-column))))
77
78(defun scroll-lock-move-to-column (column)
79 "Like `move-to-column' but cater for wrapped lines."
80 (if (or (bolp)
81 ;; Start of a screen line.
82 (not (zerop (mod (- (point) (line-beginning-position))
83 (window-width)))))
84 (move-to-column column)
85 (forward-char (min column (- (line-end-position) (point))))))
86
87(defun scroll-lock-next-line (&optional arg)
88 "Scroll up ARG lines keeping point fixed."
89 (interactive "p")
90 (or arg (setq arg 1))
91 (scroll-lock-update-goal-column)
92 (if (pos-visible-in-window-p (point-max))
93 (next-line arg)
94 (scroll-up arg))
95 (scroll-lock-move-to-column scroll-lock-temporary-goal-column))
96
97(defun scroll-lock-previous-line (&optional arg)
98 "Scroll up ARG lines keeping point fixed."
99 (interactive "p")
100 (or arg (setq arg 1))
101 (scroll-lock-update-goal-column)
102 (condition-case nil
103 (scroll-down arg)
104 (beginning-of-buffer (previous-line arg)))
105 (scroll-lock-move-to-column scroll-lock-temporary-goal-column))
106
107(defun scroll-lock-forward-paragraph (&optional arg)
108 "Scroll down ARG paragraphs keeping point fixed."
109 (interactive "p")
110 (or arg (setq arg 1))
111 (scroll-lock-update-goal-column)
112 (scroll-up (count-screen-lines (point) (save-excursion
113 (forward-paragraph arg)
114 (point))))
115 (scroll-lock-move-to-column scroll-lock-temporary-goal-column))
116
117(defun scroll-lock-backward-paragraph (&optional arg)
118 "Scroll up ARG paragraphs keeping point fixed."
119 (interactive "p")
120 (or arg (setq arg 1))
121 (scroll-lock-update-goal-column)
122 (let ((goal (save-excursion (backward-paragraph arg) (point))))
123 (condition-case nil
124 (scroll-down (count-screen-lines goal (point)))
125 (beginning-of-buffer (goto-char goal))))
126 (scroll-lock-move-to-column scroll-lock-temporary-goal-column))
127
128(provide 'scroll-lock)
129
130;;; scroll-lock.el ends here
diff --git a/man/ChangeLog b/man/ChangeLog
index b36f6c10a6e..1375018a4a5 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,18 @@
12005-08-18 Richard M. Stallman <rms@gnu.org>
2
3 * trouble.texi (Unasked-for Search): Delete xref to Keyboard Translations.
4
5 * glossary.texi (Glossary): Delete xref.
6
7 * faq.texi (Swapping keys): Xref for normal-erase-is-backspace-mode,
8 not keyboard-translate.
9
10 * custom.texi (Minor Modes): Say that the list here is not complete.
11 (Keyboard Translations): Node deleted.
12 (Disabling): Delete xref to it.
13 (Customization Groups): Fix Custom buffer example.
14 (Hooks): Mention remove-hooks.
15
12005-08-17 Luc Teirlinck <teirllm@auburn.edu> 162005-08-17 Luc Teirlinck <teirllm@auburn.edu>
2 17
3 * building.texi (GDB Graphical Interface): Improve filling of menu 18 * building.texi (GDB Graphical Interface): Improve filling of menu