aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1999-06-04 18:40:43 +0000
committerKarl Heuer1999-06-04 18:40:43 +0000
commitadb643d36c075e405fb230f0429595ddad4d79eb (patch)
treecc1eebb19f3fab04428a913594f5c2a60c2cb957
parent1fc4747e4ee6594bfd5ac6bdede9036c4a72ac10 (diff)
downloademacs-adb643d36c075e405fb230f0429595ddad4d79eb.tar.gz
emacs-adb643d36c075e405fb230f0429595ddad4d79eb.zip
Don't change hooks on loading.
(auto-show-mode): Autoload. Default to nil. Add :set &c. (auto-show-mode): Add to hooks here.
-rw-r--r--lisp/auto-show.el44
1 files changed, 22 insertions, 22 deletions
diff --git a/lisp/auto-show.el b/lisp/auto-show.el
index 34b8ae75ad7..67d712b0796 100644
--- a/lisp/auto-show.el
+++ b/lisp/auto-show.el
@@ -1,7 +1,7 @@
1;;; auto-show.el --- perform automatic horizontal scrolling as point moves 1;;; auto-show.el --- perform automatic horizontal scrolling as point moves
2;;; This file is in the public domain. 2;;; This file is in the public domain.
3 3
4;;; Keywords: scroll display minor-mode 4;;; Keywords: scroll display convenience
5;;; Author: Pete Ware <ware@cis.ohio-state.edu> 5;;; Author: Pete Ware <ware@cis.ohio-state.edu>
6;;; Maintainer: FSF 6;;; Maintainer: FSF
7 7
@@ -41,13 +41,19 @@
41 "Perform automatic horizontal scrolling as point moves." 41 "Perform automatic horizontal scrolling as point moves."
42 :group 'editing) 42 :group 'editing)
43 43
44(defcustom auto-show-mode t 44;;;###autoload
45 "*Non-nil enables automatic horizontal scrolling, when lines are truncated. 45(defcustom auto-show-mode nil
46The default value is t. To change the default, do this: 46 "Non-nil means do automatic horizontal scrolling, when lines are truncated.
47 (set-default 'auto-show-mode nil) 47
48See also command `auto-show-mode'. 48This variable is automatically local in each buffer where it is set.
49This variable has no effect when lines are not being truncated. 49
50This variable is automatically local in each buffer where it is set." 50Setting this variable directly does not take effect;
51use either \\[customize] or the function `auto-show-mode'."
52 :set (lambda (symbol value) (auto-show mode value))
53 :require 'auto-show
54 :initialize 'custom-initialize-default
55 :link '(emacs-commentary-link "auto-show.el")
56 :version "20.4"
51 :type 'boolean 57 :type 'boolean
52 :group 'auto-show) 58 :group 'auto-show)
53 59
@@ -81,7 +87,13 @@ It takes effect only when `truncate-lines' is non-nil."
81 (setq auto-show-mode 87 (setq auto-show-mode
82 (if (null arg) 88 (if (null arg)
83 (not auto-show-mode) 89 (not auto-show-mode)
84 (> (prefix-numeric-value arg) 0)))) 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)))
85 97
86(defun auto-show-make-point-visible (&optional ignore-arg) 98(defun auto-show-make-point-visible (&optional ignore-arg)
87 "Scroll horizontally to make point visible, if that is enabled. 99 "Scroll horizontally to make point visible, if that is enabled.
@@ -107,19 +119,7 @@ See also the command `auto-show-mode'."
107 (and (= col right-col) 119 (and (= col right-col)
108 (not (eolp)))) 120 (not (eolp))))
109 (scroll-left (+ auto-show-shift-amount 121 (scroll-left (+ auto-show-shift-amount
110 (- col (+ scroll w-width)))) 122 (- col (+ scroll w-width))))))))))
111 )
112 )
113 )
114 )
115 )
116 )
117
118;; Do auto-scrolling after commands.
119(add-hook 'post-command-hook 'auto-show-make-point-visible)
120
121;; Do auto-scrolling in comint buffers after process output also.
122(add-hook 'comint-output-filter-functions 'auto-show-make-point-visible t)
123 123
124(provide 'auto-show) 124(provide 'auto-show)
125 125