[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible to set a "goal column" for 'beginning-of-line'?
From: |
rgb |
Subject: |
Re: Is it possible to set a "goal column" for 'beginning-of-line'? |
Date: |
22 Nov 2005 10:29:30 -0800 |
User-agent: |
G2/0.2 |
Herbert Euler wrote:
> Hello everyone,
>
> The command 'beginning-of-line' moves point to column 0
> by default. Is it possible to set a "goal column," so that
> this command moves point to that column, e.g. column 7,
> rather than 0? The content before such column will become
> irreachable in this situation (but it might still be displayed).
>
> In another word, is there a vertical version of narrowing
> (but perhaps don't try to hide something)?
This would do what you want globally.
I tried it and it seems dangerous.
(defun avoid-columns-1-7 ()
(when (< (current-column) 7)
(move-to-column 7 t)))
(add-hook 'post-command-hook 'avoid-columns-1-7)
You probably want to limit it to a mode by using a more
restrictive `when' condition like this:
(and (string= mode-name "FOO") (< (current-column) 7))
Or maybe having it look at some variable that you can toggle.