-;;; 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>
;; 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
(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
(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)
;; 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)
(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