Mercurial > hg > xemacs-beta
comparison lisp/modes/auto-show.el @ 167:85ec50267440 r20-3b10
Import from CVS: tag r20-3b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:45:46 +0200 |
parents | 43dd3413c7c7 |
children |
comparison
equal
deleted
inserted
replaced
166:7a77eb660975 | 167:85ec50267440 |
---|---|
56 ;; The command `auto-show-mode' toggles the value of the variable | 56 ;; The command `auto-show-mode' toggles the value of the variable |
57 ;; `auto-show-mode'. | 57 ;; `auto-show-mode'. |
58 | 58 |
59 ;;; Code: | 59 ;;; Code: |
60 | 60 |
61 (defvar auto-show-mode t | 61 (defgroup auto-show nil |
62 "Perform automatic horizontal scrolling as point moves." | |
63 :group 'display | |
64 :group 'extensions) | |
65 | |
66 ;; This is preloaded, so we don't need special :set, :require, etc. | |
67 (defcustom auto-show-mode t | |
62 "*Non-nil enables automatic horizontal scrolling, when lines are truncated. | 68 "*Non-nil enables automatic horizontal scrolling, when lines are truncated. |
63 The default value is t. To change the default, do this: | 69 The default value is t. To change the default, do this: |
64 (set-default 'auto-show-mode nil) | 70 (set-default 'auto-show-mode nil) |
65 See also command `auto-show-mode'. | 71 See also command `auto-show-mode'. |
66 This variable has no effect when lines are not being truncated. | 72 This variable has no effect when lines are not being truncated. |
67 This variable is automatically local in each buffer where it is set.") | 73 This variable is automatically local in each buffer where it is set." |
74 :type 'boolean | |
75 :group 'auto-show) | |
68 | 76 |
69 (make-variable-buffer-local 'auto-show-mode) | 77 (make-variable-buffer-local 'auto-show-mode) |
70 | 78 |
71 (defvar auto-show-shift-amount 8 | 79 (defcustom auto-show-shift-amount 8 |
72 "*Extra columns to scroll. for automatic horizontal scrolling.") | 80 "*Extra columns to scroll. for automatic horizontal scrolling." |
81 :type 'integer | |
82 :group 'auto-show) | |
73 | 83 |
74 (defvar auto-show-show-left-margin-threshold 50 | 84 (defcustom auto-show-show-left-margin-threshold 50 |
75 "*Threshold column for automatic horizontal scrolling to the right. | 85 "*Threshold column for automatic horizontal scrolling to the right. |
76 If point is before this column, we try to scroll to make the left margin | 86 If point is before this column, we try to scroll to make the left margin |
77 visible. Setting this to 0 disables this feature.") | 87 visible. Setting this to 0 disables this feature." |
88 :type 'number | |
89 :group 'auto-show) | |
78 | 90 |
79 (defun auto-show-truncationp () | 91 (defun auto-show-truncationp () |
80 "True if line truncation is enabled for the selected window." | 92 "True if line truncation is enabled for the selected window." |
81 ;; XEmacs change (use specifiers) | 93 ;; XEmacs change (use specifiers) |
82 ;; ### There should be a more straightforward way to do this from elisp. | 94 ;; ### There should be a more straightforward way to do this from elisp. |
163 (scroll-right (+ (- scroll col) auto-show-shift-amount)) | 175 (scroll-right (+ (- scroll col) auto-show-shift-amount)) |
164 (if (or (> col right-col) ;to the right of the screen | 176 (if (or (> col right-col) ;to the right of the screen |
165 (and (= col right-col) | 177 (and (= col right-col) |
166 (not (eolp)))) | 178 (not (eolp)))) |
167 (scroll-left (+ auto-show-shift-amount | 179 (scroll-left (+ auto-show-shift-amount |
168 (- col (+ scroll w-width)))) | 180 (- col (+ scroll w-width)))))))))) |
169 ) | |
170 ) | |
171 ) | |
172 ) | |
173 ) | |
174 ) | |
175 | 181 |
176 ;; XEmacs change: | 182 ;; XEmacs change: |
177 ;; #### instead of this, we kludgily call it from the C code, to make sure | 183 ;; #### instead of this, we kludgily call it from the C code, to make sure |
178 ;; that it's done after any other things on post-command-hook (which might | 184 ;; that it's done after any other things on post-command-hook (which might |
179 ;; move point). | 185 ;; move point). |