Mercurial > emacs
comparison lisp/emulation/tpu-extras.el @ 12687:e7e04fe05a17
(tpu-backward-line): Only move to BOL if not already there.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 27 Jul 1995 07:37:53 +0000 |
parents | ddef149290ed |
children | 83f275dcd93a |
comparison
equal
deleted
inserted
replaced
12686:8a11e11d3365 | 12687:e7e04fe05a17 |
---|---|
21 ;; You should have received a copy of the GNU General Public License | 21 ;; You should have received a copy of the GNU General Public License |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to |
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
24 | 24 |
25 ;;; Commentary: | 25 ;;; Commentary: |
26 | |
27 ;; Use the functions defined here to customize TPU-edt to your tastes by | |
28 ;; setting scroll margins and/or turning on free cursor mode. Here's an | |
29 ;; example for your .emacs file. | |
30 | |
31 ;; (tpu-set-cursor-free) ; Set cursor free. | |
32 ;; (tpu-set-scroll-margins "10%" "15%") ; Set scroll margins. | |
33 | |
34 ;; Scroll margins and cursor binding can be changed from within emacs using | |
35 ;; the following commands: | |
36 | |
37 ;; tpu-set-scroll-margins or set scroll margins | |
38 ;; tpu-set-cursor-bound or set cursor bound | |
39 ;; tpu-set-cursor-free or set cursor free | |
40 | |
41 ;; Additionally, Gold-F toggles between bound and free cursor modes. | |
42 | |
43 ;; Note that switching out of free cursor mode or exiting TPU-edt while in | |
44 ;; free cursor mode strips trailing whitespace from every line in the file. | |
45 | |
46 | |
47 ;;; Details: | |
26 | 48 |
27 ;; The functions contained in this file implement scroll margins and free | 49 ;; The functions contained in this file implement scroll margins and free |
28 ;; cursor mode. The following keys and commands are affected. | 50 ;; cursor mode. The following keys and commands are affected. |
29 | 51 |
30 ;; key/command function scroll cursor | 52 ;; key/command function scroll cursor |
65 ;; for their normal operation and part of the display function. There | 87 ;; for their normal operation and part of the display function. There |
66 ;; is a possibility that this display overhead could adversely affect the | 88 ;; is a possibility that this display overhead could adversely affect the |
67 ;; performance of TPU-edt on slower computers. In order to support the | 89 ;; performance of TPU-edt on slower computers. In order to support the |
68 ;; widest range of computers, scroll margin support is optional. | 90 ;; widest range of computers, scroll margin support is optional. |
69 | 91 |
70 ;; I don't know for a fact that the overhead associated with scroll | 92 ;; It's actually not known whether the overhead associated with scroll |
71 ;; margin support is significant. If you find that it is, please send me | 93 ;; margin support is significant. If you find that it is, please send |
72 ;; a note describing the extent of the performance degradation. Be sure | 94 ;; a note describing the extent of the performance degradation. Be sure |
73 ;; to include a description of the platform where you're running TPU-edt. | 95 ;; to include a description of the platform where you're running TPU-edt. |
74 ;; Send your note to the address provided by Gold-V. | 96 ;; Send your note to the address provided by Gold-V. |
75 | 97 |
76 ;; Even with these differences and limitations, these functions implement | 98 ;; Even with these differences and limitations, these functions implement |
77 ;; important aspects of the real TPU/edt. Those who miss free cursor mode | 99 ;; important aspects of the real TPU/edt. Those who miss free cursor mode |
78 ;; and/or scroll margins will appreciate these implementations. | 100 ;; and/or scroll margins will appreciate these implementations. |
79 | |
80 ;;; Usage: | |
81 | |
82 ;; To use this file, simply load it after loading TPU-edt. After that, | |
83 ;; customize TPU-edt to your tastes by setting scroll margins and/or | |
84 ;; turning on free cursor mode. Here's an example for your .emacs file. | |
85 | |
86 ;; (load "tpu-edt") ; Load the base TPU-edt | |
87 ;; (load "tpu-extras") ; and the extras. | |
88 ;; (tpu-set-scroll-margins "10%" "15%") ; Set scroll margins. | |
89 | |
90 ;; Once the extras are loaded, scroll margins and cursor binding can be | |
91 ;; changed with the following commands: | |
92 | |
93 ;; tpu-set-scroll-margins or set scroll margins | |
94 ;; tpu-set-cursor-bound or set cursor bound | |
95 ;; tpu-set-cursor-free or set cursor free | |
96 | |
97 ;; Additionally, Gold-F toggles between bound and free cursor modes. | |
98 | |
99 ;; Note that switching out of free cursor mode or exiting TPU-edt while in | |
100 ;; free cursor mode strips trailing whitespace from every line in the file. | |
101 | 101 |
102 ;;; Code: | 102 ;;; Code: |
103 | 103 |
104 | 104 |
105 ;;; Gotta have tpu-edt | 105 ;;; Gotta have tpu-edt |
257 (defun tpu-backward-line (num) | 257 (defun tpu-backward-line (num) |
258 "Move to beginning of previous line. | 258 "Move to beginning of previous line. |
259 Prefix argument serves as repeat count." | 259 Prefix argument serves as repeat count." |
260 (interactive "p") | 260 (interactive "p") |
261 (let ((beg (tpu-current-line))) | 261 (let ((beg (tpu-current-line))) |
262 (or (bolp) (>= 0 num) (setq num (- num 1))) | |
262 (next-line-internal (- num)) | 263 (next-line-internal (- num)) |
263 (tpu-top-check beg num) | 264 (tpu-top-check beg num) |
264 (beginning-of-line))) | 265 (beginning-of-line))) |
265 | 266 |
266 | 267 |