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

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

Re: sending a buffer by mail


From: Eric Abrahamsen
Subject: Re: sending a buffer by mail
Date: Wed, 30 Aug 2017 19:04:29 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

John Mastro <john.b.mastro@gmail.com> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>>> Well, that sounds like a very thin wrapper around insert-buffer:
>>>
>>> (defun send-buffer-as-mail ()
>>>   (interactive)
>>>   (let ((str (buffer-string)))
>>>     (compose-mail)
>>>     (message-goto-body)
>>>     (insert str)))
>>
>> This will be nicer:
>>
>> (defun send-buffer-as-mail ()
>>   (interactive)
>>   (let ((str (buffer-string)))
>>     (compose-mail)
>>     (save-excursion
>>       (message-goto-body)
>>       (insert str))))
>
> The difference is likely irrelevant, but you can still use
> `insert-buffer' rather than consing a string of the buffer's contents:
>
> (defun send-buffer-as-mail ()
>   (interactive)
>   (let ((buf (current-buffer)))
>     (compose-mail)
>     (save-excursion
>       (message-goto-body)
>       (insert-buffer buf))))

insert-buffer is still the way to go!




reply via email to

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