]> code.delx.au - gnu-emacs/blobdiff - lisp/emulation/tpu-extras.el
(Abbrevs): A @node line without explicit Prev, Next, and Up links.
[gnu-emacs] / lisp / emulation / tpu-extras.el
index abc8d1a9c176704ab9957fefba6eaec95d3bbbbf..2aed6f464d5abc5c15a2c516aba1fc1f8378a255 100644 (file)
@@ -1,6 +1,7 @@
-;;; tpu-extras.el --- Scroll margins and free cursor mode for TPU-edt
+;;; tpu-extras.el --- scroll margins and free cursor mode for TPU-edt
 
-;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 2000, 2002, 2003, 2004,
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
@@ -19,8 +20,9 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 
 ;;;  Customization variables
 
-(defconst tpu-top-scroll-margin 0
+(defcustom tpu-top-scroll-margin 0
   "*Scroll margin at the top of the screen.
-Interpreted as a percent of the current window size.")
-(defconst tpu-bottom-scroll-margin 0
+Interpreted as a percent of the current window size."
+  :type 'integer
+  :group 'tpu)
+(defcustom tpu-bottom-scroll-margin 0
   "*Scroll margin at the bottom of the screen.
-Interpreted as a percent of the current window size.")
+Interpreted as a percent of the current window size."
+  :type 'integer
+  :group 'tpu)
 
-(defvar tpu-backward-char-like-tpu t
+(defcustom tpu-backward-char-like-tpu t
   "*If non-nil, in free cursor mode backward-char (left-arrow) works
 just like TPU/edt.  Otherwise, backward-char will move to the end of
-the previous line when starting from a line beginning.")
+the previous line when starting from a line beginning."
+  :type 'boolean
+  :group 'tpu)
 
 
 ;;;  Global variables
@@ -135,11 +143,11 @@ the previous line when starting from a line beginning.")
 
 (defun tpu-write-file-hook nil
   "Eliminate whitespace at ends of lines, if the cursor is free."
-  (if (and (buffer-modified-p) tpu-cursor-free) (picture-clean)))
+  (if (and (buffer-modified-p) tpu-cursor-free) (tpu-trim-line-ends)))
 
-(or (memq 'tpu-write-file-hook write-file-hooks)
-    (setq write-file-hooks
-         (cons 'tpu-write-file-hook write-file-hooks)))
+(or (memq 'tpu-write-file-hook write-file-functions)
+    (setq write-file-functions
+         (cons 'tpu-write-file-hook write-file-functions)))
 
 
 ;;;  Utility routines for implementing scroll margins
@@ -209,7 +217,7 @@ Accepts a prefix argument for the number of lines to move."
   (interactive "p")
   (let ((beg (tpu-current-line)))
     (backward-char 1)
-    (forward-line (- 1 num))
+    (forward-visible-line (- 1 num))
     (tpu-top-check beg num)))
 
 (defun tpu-next-end-of-line (num)
@@ -433,16 +441,16 @@ version that respects the bottom scroll margin."
   ;; set top scroll margin
   (or (string= top "")
       (if (string= "%" (substring top -1))
-         (setq tpu-top-scroll-margin (string-to-int top))
+         (setq tpu-top-scroll-margin (string-to-number top))
        (setq tpu-top-scroll-margin
-             (/ (1- (+ (* (string-to-int top) 100) (window-height)))
+             (/ (1- (+ (* (string-to-number top) 100) (window-height)))
                 (window-height)))))
   ;; set bottom scroll margin
   (or (string= bottom "")
       (if (string= "%" (substring bottom -1))
-         (setq tpu-bottom-scroll-margin (string-to-int bottom))
+         (setq tpu-bottom-scroll-margin (string-to-number bottom))
        (setq tpu-bottom-scroll-margin
-             (/ (1- (+ (* (string-to-int bottom) 100) (window-height)))
+             (/ (1- (+ (* (string-to-number bottom) 100) (window-height)))
                 (window-height)))))
   ;; report scroll margin settings if running interactively
   (and (interactive-p)
@@ -466,11 +474,12 @@ version that respects the bottom scroll margin."
 (defun tpu-set-cursor-bound nil
   "Constrain the cursor to the flow of the text."
   (interactive)
-  (picture-clean)
+  (tpu-trim-line-ends)
   (setq tpu-cursor-free nil)
   (substitute-key-definition 'tpu-set-cursor-bound
                             'tpu-set-cursor-free
                             GOLD-map)
   (message "The cursor is now bound to the flow of your text."))
 
+;;; arch-tag: 89676fa4-33ec-48cb-9135-6f3bf230ab1a
 ;;; tpu-extras.el ends here