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

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

Re: pin the right edge of the text to the right edge of the monitor


From: Roland Winkler
Subject: Re: pin the right edge of the text to the right edge of the monitor
Date: 02 Feb 2004 11:04:15 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <mailman.1622.1075480427.928.bug-gnu-emacs@gnu.org>,
>  Dan Jacobson <jidanni@jidanni.org> wrote:
> 
> > A C-a gets the left edge of the text nicely fixed to the left edge of
> > the monitor, but no consideration is given to us right-wingers.
> 
> Since you know the column that you want to be at the right edge, give a 
> numeric argument to C-x <.

I use the following piece of code in order to let emacs calculate
the numeric argument of scroll-left and scroll-right


(setq auto-show-shift-amount 4)
(defun my-recenter ()
  "Center point in window horizontally and vertically."
  (interactive)
  (recenter)
  (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)))
                )))))

(global-set-key "\C-l" 'my-recenter)




reply via email to

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