]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't change hooks on loading.
authorKarl Heuer <kwzh@gnu.org>
Fri, 4 Jun 1999 18:40:43 +0000 (18:40 +0000)
committerKarl Heuer <kwzh@gnu.org>
Fri, 4 Jun 1999 18:40:43 +0000 (18:40 +0000)
(auto-show-mode): Autoload.  Default to nil.  Add :set &c.
(auto-show-mode): Add to hooks here.

lisp/auto-show.el

index 34b8ae75ad7fb009465ba93db711c01cef0a3e2d..67d712b07964ee23dd2227a9b069c02be686bd92 100644 (file)
@@ -1,7 +1,7 @@
 ;;; auto-show.el --- perform automatic horizontal scrolling as point moves
 ;;; This file is in the public domain.
 
-;;; Keywords: scroll display minor-mode
+;;; Keywords: scroll display convenience
 ;;; Author: Pete Ware <ware@cis.ohio-state.edu>
 ;;; Maintainer: FSF
 
   "Perform automatic horizontal scrolling as point moves."
   :group 'editing)
 
-(defcustom auto-show-mode t
-  "*Non-nil enables automatic horizontal scrolling, when lines are truncated.
-The default value is t.  To change the default, do this:
-       (set-default 'auto-show-mode nil)
-See also command `auto-show-mode'.
-This variable has no effect when lines are not being truncated.
-This variable is automatically local in each buffer where it is set."
+;;;###autoload
+(defcustom auto-show-mode nil
+  "Non-nil means do automatic horizontal scrolling, when lines are truncated.
+
+This variable is automatically local in each buffer where it is set.
+
+Setting this variable directly does not take effect;
+use either \\[customize] or the function `auto-show-mode'."
+  :set (lambda (symbol value) (auto-show mode value))
+  :require 'auto-show
+  :initialize 'custom-initialize-default
+  :link '(emacs-commentary-link "auto-show.el")
+  :version "20.4"
   :type 'boolean
   :group 'auto-show)
 
@@ -81,7 +87,13 @@ It takes effect only when `truncate-lines' is non-nil."
   (setq auto-show-mode
        (if (null arg)
            (not auto-show-mode)
-         (> (prefix-numeric-value arg) 0))))
+         (> (prefix-numeric-value arg) 0)))
+  (when auto-show-mode
+    ;; Do auto-scrolling after commands.
+    (add-hook 'post-command-hook 'auto-show-make-point-visible)
+    ;; Do auto-scrolling in comint buffers after process output also.
+    (add-hook 'comint-output-filter-functions
+             'auto-show-make-point-visible t)))
   
 (defun auto-show-make-point-visible (&optional ignore-arg)
   "Scroll horizontally to make point visible, if that is enabled.
@@ -107,19 +119,7 @@ See also the command `auto-show-mode'."
                    (and (= col right-col)
                         (not (eolp))))
                (scroll-left (+ auto-show-shift-amount 
-                               (- col (+ scroll w-width))))
-             )
-           )
-         )
-       )
-    )
-  )
-
-;; Do auto-scrolling after commands.
-(add-hook 'post-command-hook 'auto-show-make-point-visible)
-
-;; Do auto-scrolling in comint buffers after process output also.
-(add-hook 'comint-output-filter-functions 'auto-show-make-point-visible t)
+                               (- col (+ scroll w-width))))))))))
 
 (provide 'auto-show)