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 17:23:09 +0200

Emanuel Berg <moasen@zoho.com> writes:

> Robert Pluim wrote:
>
>>> (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 here, point is already at the beginning of
> the line.

Iʼm saying you donʼt need to move point, since

(point-at-bol)

tells you the right value. But micro-optimising something for which a
built-in function already exists is not really necessary.

Robert



reply via email to

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