bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

automatic-hscrolling versus auto-show-mode in emacs 21


From: Roland Winkler
Subject: automatic-hscrolling versus auto-show-mode in emacs 21
Date: Fri, 8 Feb 2002 18:24:08 +0100

In GNU Emacs 21.1.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-02-01 on tfkp12
configured using `configure  --prefix=/nfs/common --libexecdir=/nfs/common/lib 
--bindir=/nfs/common/lib/emacs/21.1/bin/i686-Linux 
--mandir=/nfs/common/share/man --infodir=/nfs/common/share/info --with-gcc 
--with-pop --with-x --with-x-toolkit=athena i386-pc-linux'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: nil

The following is in between a bug report and a feature request:

In emacs 20 I was using auto-show-mode. This has been declared
obsolete in emacs 21. But as far as I could find out, in emacs 21
there is no variable equivalent to the old variable
auto-show-shift-amount. (hscroll-mode, that has likewise been
declared obsolete, gave the same functionality by means of the
variable hscroll-margin.) For example, when I jump to the end of a
long line using end-of-line, auto-show-shift-amount gave me control
over the right margin. With automatic-hscrolling the end of the line
is always in the middle of the window which is often annoying
because it's wasting display width.

A related thing:

I am using extensively a function for horizontal centering (see
below). This function tries not to waste display width, consistent
with the old auto-show-mode and auto-show-shift-amount. I'd like to
suggest that the new automatic-hscrolling should provide such a
facility for horizontal centering.

Thanks a lot.

Roland


(defun my-hrecenter ()
  "Center point in window horizontally."
  (interactive)
  (if truncate-lines
      (let ((eol (save-excursion (end-of-line) (current-column)))
            (col (current-column))
            (ww  (window-width)))
        (when (> eol ww)
          (scroll-right eol)
          (cond ((< (- eol col (/ ww 2)) 0)
                 (scroll-left (- (+ eol auto-show-shift-amount 1) ww)))
                ((> col (/ ww 2))
                 (scroll-left (- col (/ ww 2) -1)))
                )))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]