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

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

Re: How to delete all text from beginning of buffer to mark


From: Kaushal Modi
Subject: Re: How to delete all text from beginning of buffer to mark
Date: Tue, 09 May 2017 03:07:40 +0000

>
> However it can be interesting to discuss
> a function:
>
>     (defun delete-to-point ()
>       (interactive)
>       (let ((start 1)
>             (end   (point)))
>         (delete-region start end) ))
>

For safety, I would set the start to (point-min) instead of 1. Then if the
user has narrowed the buffer, the deletion will begin only from the
beginning of the narrowed region, instead of the actual beginning of the
buffer.

> --

Kaushal Modi


reply via email to

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