aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1999-08-10 17:38:19 +0000
committerDave Love1999-08-10 17:38:19 +0000
commit86a4c778b507e9ae178d8fbbf56b664e8149dddc (patch)
treede07526f372942d4bdcd55f578b4ea53cea966ed
parent7f5d1df85e8914cea03348a651c359d0551ddd29 (diff)
downloademacs-86a4c778b507e9ae178d8fbbf56b664e8149dddc.tar.gz
emacs-86a4c778b507e9ae178d8fbbf56b664e8149dddc.zip
(hscroll-step, hscroll-point-visible, hscroll-window-column): Remove
now we have the mentioned real horizontal autoscrolling.
-rw-r--r--lisp/simple.el106
1 files changed, 0 insertions, 106 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 183f1bb2df9..a3118855351 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2412,112 +2412,6 @@ The goal column is stored in the variable `goal-column'."
2412 goal-column)) 2412 goal-column))
2413 nil) 2413 nil)
2414 2414
2415;;; Partial support for horizontal autoscrolling. Someday, this feature
2416;;; will be built into the C level and all the (hscroll-point-visible) calls
2417;;; will go away.
2418
2419(defcustom hscroll-step 0
2420 "*The number of columns to try scrolling a window by when point moves out.
2421If that fails to bring point back on frame, point is centered instead.
2422If this is zero, point is always centered after it moves off frame."
2423 :type '(choice (const :tag "Alway Center" 0)
2424 (integer :format "%v" 1))
2425 :group 'editing-basics)
2426
2427(defun hscroll-point-visible ()
2428 "Scrolls the selected window horizontally to make point visible."
2429 (save-excursion
2430 (set-buffer (window-buffer))
2431 (if (not (or truncate-lines
2432 (> (window-hscroll) 0)
2433 (and truncate-partial-width-windows
2434 (< (window-width) (frame-width)))))
2435 ;; Point is always visible when lines are wrapped.
2436 ()
2437 ;; If point is on the invisible part of the line before window-start,
2438 ;; then hscrolling can't bring it back, so reset window-start first.
2439 (and (< (point) (window-start))
2440 (let ((ws-bol (save-excursion
2441 (goto-char (window-start))
2442 (beginning-of-line)
2443 (point))))
2444 (and (>= (point) ws-bol)
2445 (set-window-start nil ws-bol))))
2446 (let* ((here (hscroll-window-column))
2447 (left (min (window-hscroll) 1))
2448 (right (1- (window-width))))
2449 ;; Allow for the truncation glyph, if we're not exactly at eol.
2450 (if (not (and (= here right)
2451 (= (following-char) ?\n)))
2452 (setq right (1- right)))
2453 (cond
2454 ;; If too far away, just recenter. But don't show too much
2455 ;; white space off the end of the line.
2456 ((or (< here (- left hscroll-step))
2457 (> here (+ right hscroll-step)))
2458 (let ((eol (save-excursion (end-of-line) (hscroll-window-column))))
2459 (scroll-left (min (- here (/ (window-width) 2))
2460 (- eol (window-width) -5)))))
2461 ;; Within range. Scroll by one step (or maybe not at all).
2462 ((< here left)
2463 (scroll-right hscroll-step))
2464 ((> here right)
2465 (scroll-left hscroll-step)))))))
2466
2467;; This function returns the window's idea of the display column of point,
2468;; assuming that the window is already known to be truncated rather than
2469;; wrapped, and that we've already handled the case where point is on the
2470;; part of the line before window-start. We ignore window-width; if point
2471;; is beyond the right margin, we want to know how far. The return value
2472;; includes the effects of window-hscroll, window-start, and the prompt
2473;; string in the minibuffer. It may be negative due to hscroll.
2474(defun hscroll-window-column ()
2475 (let* ((hscroll (window-hscroll))
2476 (startpos (save-excursion
2477 (beginning-of-line)
2478 (if (= (point) (save-excursion
2479 (goto-char (window-start))
2480 (beginning-of-line)
2481 (point)))
2482 (goto-char (window-start)))
2483 (point)))
2484 (hpos (+ (if (and (eq (selected-window) (minibuffer-window))
2485 (= 1 (window-start))
2486 (= startpos (point-min)))
2487 (minibuffer-prompt-width)
2488 0)
2489 (min 0 (- 1 hscroll))))
2490 val)
2491 (car (cdr (compute-motion startpos (cons hpos 0)
2492 (point) (cons 0 1)
2493 1000000 (cons hscroll 0) nil)))))
2494
2495
2496;; rms: (1) The definitions of arrow keys should not simply restate
2497;; what keys they are. The arrow keys should run the ordinary commands.
2498;; (2) The arrow keys are just one of many common ways of moving point
2499;; within a line. Real horizontal autoscrolling would be a good feature,
2500;; but supporting it only for arrow keys is too incomplete to be desirable.
2501
2502;;;;; Make arrow keys do the right thing for improved terminal support
2503;;;;; When we implement true horizontal autoscrolling, right-arrow and
2504;;;;; left-arrow can lose the (if truncate-lines ...) clause and become
2505;;;;; aliases. These functions are bound to the corresponding keyboard
2506;;;;; events in loaddefs.el.
2507
2508;;(defun right-arrow (arg)
2509;; "Move right one character on the screen (with prefix ARG, that many chars).
2510;;Scroll right if needed to keep point horizontally onscreen."
2511;; (interactive "P")
2512;; (forward-char arg)
2513;; (hscroll-point-visible))
2514
2515;;(defun left-arrow (arg)
2516;; "Move left one character on the screen (with prefix ARG, that many chars).
2517;;Scroll left if needed to keep point horizontally onscreen."
2518;; (interactive "P")
2519;; (backward-char arg)
2520;; (hscroll-point-visible))
2521 2415
2522(defun scroll-other-window-down (lines) 2416(defun scroll-other-window-down (lines)
2523 "Scroll the \"other window\" down. 2417 "Scroll the \"other window\" down.