From: Karl Heuer Date: Fri, 4 Jun 1999 18:40:43 +0000 (+0000) Subject: Don't change hooks on loading. X-Git-Tag: emacs-20.4~137 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=adb643d36c075e405fb230f0429595ddad4d79eb;p=emacs.git Don't change hooks on loading. (auto-show-mode): Autoload. Default to nil. Add :set &c. (auto-show-mode): Add to hooks here. --- 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 @@ ;;; 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 ;;; Maintainer: FSF @@ -41,13 +41,19 @@ "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)