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

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

Re: Newline and copy above line's indentation


From: Robert Pluim
Subject: Re: Newline and copy above line's indentation
Date: Tue, 03 Jul 2018 16:49:30 +0200

Emanuel Berg <moasen@zoho.com> writes:

> (defun copy-whitespace-above-and-indent-2 ()
>   (interactive)
>   (let ((start)
>         (stop) )
>     (save-excursion
>       (forward-line -1)
>       (setq start (point))
>       (beginning-of-line-text)
>       (setq stop  (point)) )
>     (insert "\n" (buffer-substring start stop)) ))

start == (point-at-bol). But it would be easier to just use
'indent-relative', which lots of modes already do.

Robert



reply via email to

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