comparison lisp/modes/auto-show.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 43dd3413c7c7
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
4 ;;; Keywords: scroll display minor-mode 4 ;;; Keywords: scroll display minor-mode
5 ;;; Author: Pete Ware <ware@cis.ohio-state.edu> 5 ;;; Author: Pete Ware <ware@cis.ohio-state.edu>
6 ;;; Modified by: Ben Wing <wing@666.com> 6 ;;; Modified by: Ben Wing <wing@666.com>
7 ;;; Maintainer: FSF 7 ;;; Maintainer: FSF
8 8
9 ;;; Synched up with: FSF 19.30. 9 ;; This file is part of XEmacs.
10
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ;; 02111-1307, USA.
25
26 ;;; Synched up with: FSF 19.34 (But starting to deviate).
10 27
11 ;;; Commentary: 28 ;;; Commentary:
12 29
13 ;;; This file provides functions that 30 ;;; This file provides functions that
14 ;;; automatically scroll the window horizontally when the point moves 31 ;;; automatically scroll the window horizontally when the point moves
57 If point is before this column, we try to scroll to make the left margin 74 If point is before this column, we try to scroll to make the left margin
58 visible. Setting this to 0 disables this feature.") 75 visible. Setting this to 0 disables this feature.")
59 76
60 (defun auto-show-truncationp () 77 (defun auto-show-truncationp ()
61 "True if line truncation is enabled for the selected window." 78 "True if line truncation is enabled for the selected window."
79 ;; XEmacs change (use specifiers)
62 ;; ### There should be a more straightforward way to do this from elisp. 80 ;; ### There should be a more straightforward way to do this from elisp.
63 (or truncate-lines 81 (or truncate-lines
64 (and truncate-partial-width-windows 82 (and truncate-partial-width-windows
65 (< (+ (window-width) 83 (< (+ (window-width)
66 (specifier-instance left-margin-width) 84 (specifier-instance left-margin-width)
74 (setq auto-show-mode 92 (setq auto-show-mode
75 (if (null arg) 93 (if (null arg)
76 (not auto-show-mode) 94 (not auto-show-mode)
77 (> (prefix-numeric-value arg) 0)))) 95 (> (prefix-numeric-value arg) 0))))
78 96
97 ;; XEmacs addition:
79 (defvar auto-show-inhibiting-commands 98 (defvar auto-show-inhibiting-commands
80 '(scrollbar-char-left 99 '(scrollbar-char-left
81 scrollbar-char-right 100 scrollbar-char-right
82 scrollbar-page-left 101 scrollbar-page-left
83 scrollbar-page-right 102 scrollbar-page-right
85 scrollbar-to-right 104 scrollbar-to-right
86 scrollbar-horizontal-drag) 105 scrollbar-horizontal-drag)
87 "Commands that inhibit auto-show behavior. 106 "Commands that inhibit auto-show behavior.
88 This normally includes the horizontal scrollbar commands.") 107 This normally includes the horizontal scrollbar commands.")
89 108
109 ;; XEmacs addition:
90 (defun auto-show-should-take-action-p () 110 (defun auto-show-should-take-action-p ()
91 (and auto-show-mode (auto-show-truncationp) 111 (and auto-show-mode (auto-show-truncationp)
92 (equal (window-buffer) (current-buffer)) 112 (equal (window-buffer) (current-buffer))
93 (not (memq this-command auto-show-inhibiting-commands)))) 113 (not (memq this-command auto-show-inhibiting-commands))))
94 114
121 "Scroll horizontally to make point visible, if that is enabled. 141 "Scroll horizontally to make point visible, if that is enabled.
122 This function only does something if `auto-show-mode' is non-nil 142 This function only does something if `auto-show-mode' is non-nil
123 and longlines are being truncated in the selected window. 143 and longlines are being truncated in the selected window.
124 See also the command `auto-show-toggle'." 144 See also the command `auto-show-toggle'."
125 (interactive) 145 (interactive)
146 ;; XEmacs change
126 (if (auto-show-should-take-action-p) 147 (if (auto-show-should-take-action-p)
127 (let* ((col (current-column)) ;column on line point is at 148 (let* ((col (current-column)) ;column on line point is at
128 (scroll (window-hscroll)) ;how far window is scrolled 149 (scroll (window-hscroll)) ;how far window is scrolled
129 (w-width (- (window-width) 150 (w-width (- (window-width)
130 (if (> scroll 0) 151 (if (> scroll 0)