diff options
| author | Gerd Moellmann | 1999-09-06 16:01:22 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-09-06 16:01:22 +0000 |
| commit | 317f4819a40a3a047e97a28be4ee8fb8a5d3170c (patch) | |
| tree | ab6a9e813364cb43d7f65b85fe57bed3914a74af | |
| parent | 0248680a42f0220d3b6a94c4c9a17253760abe37 (diff) | |
| download | emacs-317f4819a40a3a047e97a28be4ee8fb8a5d3170c.tar.gz emacs-317f4819a40a3a047e97a28be4ee8fb8a5d3170c.zip | |
Remove all code, keep interface.
| -rw-r--r-- | lisp/auto-show.el | 101 |
1 files changed, 12 insertions, 89 deletions
diff --git a/lisp/auto-show.el b/lisp/auto-show.el index 64f39919daf..2eff65ef687 100644 --- a/lisp/auto-show.el +++ b/lisp/auto-show.el | |||
| @@ -7,119 +7,42 @@ | |||
| 7 | 7 | ||
| 8 | ;;; Commentary: | 8 | ;;; Commentary: |
| 9 | 9 | ||
| 10 | ;;; This file provides functions that | 10 | ;; This file contains dummy variables and functions only because Emacs |
| 11 | ;;; automatically scroll the window horizontally when the point moves | 11 | ;; does hscrolling automatically, now. |
| 12 | ;;; off the left or right side of the window. | ||
| 13 | |||
| 14 | ;;; Once this library is loaded, automatic horizontal scrolling | ||
| 15 | ;;; occurs whenever long lines are being truncated. | ||
| 16 | ;;; To request truncation of long lines, set the variable | ||
| 17 | ;;; Setting the variable `truncate-lines' to non-nil. | ||
| 18 | ;;; You can do this for all buffers as follows: | ||
| 19 | ;;; | ||
| 20 | ;;; (set-default 'truncate-lines t) | ||
| 21 | |||
| 22 | ;;; Here is how to do it for C mode only: | ||
| 23 | ;;; | ||
| 24 | ;;; (set-default 'truncate-lines nil) ; this is the original value | ||
| 25 | ;;; (defun my-c-mode-hook () | ||
| 26 | ;;; "Run when C-mode starts up. Changes ..." | ||
| 27 | ;;; ... set various personal preferences ... | ||
| 28 | ;;; (setq truncate-lines t)) | ||
| 29 | ;;; (add-hook 'c-mode-hook 'my-c-mode-hook) | ||
| 30 | ;;; | ||
| 31 | ;;; | ||
| 32 | ;;; As a finer level of control, you can still have truncated lines but | ||
| 33 | ;;; without the automatic horizontal scrolling by setting the buffer | ||
| 34 | ;;; local variable `auto-show-mode' to nil. The default value is t. | ||
| 35 | ;;; The command `auto-show-mode' toggles the value of the variable | ||
| 36 | ;;; `auto-show-mode'. | ||
| 37 | 12 | ||
| 38 | ;;; Code: | 13 | ;;; Code: |
| 39 | 14 | ||
| 40 | (defgroup auto-show nil | 15 | (defgroup auto-show nil |
| 41 | "Perform automatic horizontal scrolling as point moves." | 16 | "This customization group is kept for compatibilry only. |
| 17 | Emacs now does hscrolling automatically. Please remove references | ||
| 18 | to hscroll from your init file and code." | ||
| 42 | :group 'editing) | 19 | :group 'editing) |
| 43 | 20 | ||
| 44 | ;;;###autoload | 21 | ;;;###autoload |
| 45 | (defcustom auto-show-mode nil | 22 | (defcustom auto-show-mode nil |
| 46 | "Non-nil means do automatic horizontal scrolling, when lines are truncated. | 23 | "Obsolete." |
| 47 | |||
| 48 | This variable is automatically local in each buffer where it is set. | ||
| 49 | |||
| 50 | Setting this variable directly does not take effect; | ||
| 51 | use either \\[customize] or the function `auto-show-mode'." | ||
| 52 | :set (lambda (symbol value) (auto-show-mode (if value 1 0))) | ||
| 53 | :require 'auto-show | ||
| 54 | :initialize 'custom-initialize-default | ||
| 55 | :link '(emacs-commentary-link "auto-show.el") | ||
| 56 | :version "20.4" | 24 | :version "20.4" |
| 57 | :type 'boolean | 25 | :type 'boolean |
| 58 | :group 'auto-show) | 26 | :group 'auto-show) |
| 59 | 27 | ||
| 60 | (make-variable-buffer-local 'auto-show-mode) | ||
| 61 | |||
| 62 | (defcustom auto-show-shift-amount 8 | 28 | (defcustom auto-show-shift-amount 8 |
| 63 | "*Extra columns to scroll. for automatic horizontal scrolling." | 29 | "*Obsolete." |
| 64 | :type 'integer | 30 | :type 'integer |
| 65 | :group 'auto-show) | 31 | :group 'auto-show) |
| 66 | 32 | ||
| 67 | (defcustom auto-show-show-left-margin-threshold 50 | 33 | (defcustom auto-show-show-left-margin-threshold 50 |
| 68 | "*Threshold column for automatic horizontal scrolling to the right. | 34 | "*Obsolete." |
| 69 | If point is before this column, we try to scroll to make the left margin | ||
| 70 | visible. Setting this to 0 disables this feature." | ||
| 71 | :type 'integer | 35 | :type 'integer |
| 72 | :group 'auto-show) | 36 | :group 'auto-show) |
| 73 | 37 | ||
| 74 | (defun auto-show-truncationp () | ||
| 75 | "True if line truncation is enabled for the selected window." | ||
| 76 | (or truncate-lines | ||
| 77 | (and truncate-partial-width-windows | ||
| 78 | (< (window-width) (frame-width))))) | ||
| 79 | |||
| 80 | ;;;###autoload | 38 | ;;;###autoload |
| 81 | (defun auto-show-mode (arg) | 39 | (defun auto-show-mode (arg) |
| 82 | "Turn automatic horizontal scroll mode on or off. | 40 | "This functino is obsolete." |
| 83 | With arg, turn auto scrolling on if arg is positive, off otherwise. | 41 | (interactive "P")) |
| 84 | This mode is enabled or disabled for each buffer individually. | ||
| 85 | It takes effect only when `truncate-lines' is non-nil." | ||
| 86 | (interactive "P") | ||
| 87 | (setq auto-show-mode | ||
| 88 | (if (null arg) | ||
| 89 | (not auto-show-mode) | ||
| 90 | (> (prefix-numeric-value arg) 0))) | ||
| 91 | (when auto-show-mode | ||
| 92 | ;; Do auto-scrolling after commands. | ||
| 93 | (add-hook 'post-command-hook 'auto-show-make-point-visible) | ||
| 94 | ;; Do auto-scrolling in comint buffers after process output also. | ||
| 95 | (add-hook 'comint-output-filter-functions | ||
| 96 | 'auto-show-make-point-visible t))) | ||
| 97 | 42 | ||
| 98 | (defun auto-show-make-point-visible (&optional ignore-arg) | 43 | (defun auto-show-make-point-visible (&optional ignore-arg) |
| 99 | "Scroll horizontally to make point visible, if that is enabled. | 44 | "This functino is obsolete." |
| 100 | This function only does something if `auto-show-mode' is non-nil | 45 | (interactive)) |
| 101 | and longlines are being truncated in the selected window. | ||
| 102 | See also the command `auto-show-mode'." | ||
| 103 | (interactive) | ||
| 104 | (if (and auto-show-mode (auto-show-truncationp) | ||
| 105 | (equal (window-buffer) (current-buffer))) | ||
| 106 | (let* ((col (current-column)) ;column on line point is at | ||
| 107 | (scroll (window-hscroll)) ;how far window is scrolled | ||
| 108 | (w-width (- (window-width) | ||
| 109 | (if (> scroll 0) | ||
| 110 | 2 1))) ;how wide window is on the screen | ||
| 111 | (right-col (+ scroll w-width))) | ||
| 112 | (if (and (< col auto-show-show-left-margin-threshold) | ||
| 113 | (< col (window-width)) | ||
| 114 | (> scroll 0)) | ||
| 115 | (scroll-right scroll) | ||
| 116 | (if (< col scroll) ;to the left of the screen | ||
| 117 | (scroll-right (+ (- scroll col) auto-show-shift-amount)) | ||
| 118 | (if (or (> col right-col) ;to the right of the screen | ||
| 119 | (and (= col right-col) | ||
| 120 | (not (eolp)))) | ||
| 121 | (scroll-left (+ auto-show-shift-amount | ||
| 122 | (- col (+ scroll w-width)))))))))) | ||
| 123 | 46 | ||
| 124 | (provide 'auto-show) | 47 | (provide 'auto-show) |
| 125 | 48 | ||