emacs-devel
[Top][All Lists]
Advanced

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

Re: line-move-down-up


From: Deniz Dogan
Subject: Re: line-move-down-up
Date: Mon, 18 Apr 2011 15:36:07 +0200

2011/4/18 A Soare <address@hidden>:
>
> (defun line-move-down (n)
>  (let ((column (current-column))
>        (line (delete-and-extract-region
>               (prog2 (beginning-of-line) (point))
>               (prog2 (end-of-line) (1+ (point)) ))))
>    (next-line n)
>    (beginning-of-line)
>    (insert-string line)
>    (backward-char)
>    (move-to-column column)
>    'down
>  ))
>
> (define-key global-map [(meta up)] (lambda (&optional n) (interactive "P")
> (line-move-down (if (numberp n) (- n) -1))))
>
> (define-key global-map [(meta down)] (lambda (&optional n) (interactive "P")
> (line-move-down (if (numberp n) n 1))))
>

I'm not sure what this post is all about, but you could
replace (prog2 (beginning-of-line) (point)) with (point-at-bol)
and respectively for the end.

Also, (next-line n) (beginning-of-line) could be replaced
with (beginning-of-line (1+ n)).

-- 
Deniz Dogan



reply via email to

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