all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Newline and copy above line's indentation
Date: Tue, 03 Jul 2018 17:23:09 +0200	[thread overview]
Message-ID: <87a7r8qr6q.fsf@gmail.com> (raw)
In-Reply-To: <86po04gyg6.fsf@zoho.com> (Emanuel Berg's message of "Tue, 03 Jul 2018 16:56:25 +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	other threads:[~2018-07-03 15:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3005.1530624947.1292.help-gnu-emacs@gnu.org>
2018-07-03 14:03 ` Newline and copy above line's indentation Emanuel Berg
2018-07-03 14:37   ` Emanuel Berg
2018-07-03 14:49     ` Robert Pluim
     [not found]     ` <mailman.3009.1530629379.1292.help-gnu-emacs@gnu.org>
2018-07-03 14:56       ` Emanuel Berg
2018-07-03 15:23         ` Robert Pluim [this message]
     [not found]         ` <mailman.3013.1530631400.1292.help-gnu-emacs@gnu.org>
2018-07-03 17:44           ` Emanuel Berg
2018-07-03 16:03 ` HASM
2018-07-03 17:45   ` Emanuel Berg
2018-07-03 21:07     ` HASM
2018-07-03 21:39       ` Emanuel Berg
2018-07-03 22:16         ` HASM
2018-07-04  0:25           ` Dan Espen
2018-07-04  0:58             ` HASM
2018-07-04 13:45               ` Dan Espen
2018-07-04 15:26                 ` HASM
2018-07-23 23:32   ` Stefan Monnier
2018-07-03 12:40 Vas Vas
2018-07-03 14:21 ` Robert Pluim
2018-07-03 18:59 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7r8qr6q.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.