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

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

Re: message, can't find basic stuff [Elisp]


From: Philip Kaludercic
Subject: Re: message, can't find basic stuff [Elisp]
Date: Sat, 20 Feb 2021 10:23:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> I just answered a question on gmane.emacs.gnus.general but had
> to write a lot more code than I thought.
>
> Is there really no - argh, just read the code, the questions
> are in the comments :)
>
> (require 'message)
>
> ;; is there really no function like this already?
> (defun message-set-header (hdr val)
>   (interactive "sheader: \nsvalue: ")
>   ;; check here if there _is_ such a header - how?
>   ;; also a must-have, super-simple building-block from the holster
>   ;; but can't find it either

Perhaps message-fetch-field? It returns the value or nil if not found.

>   (message-position-on-field hdr)
>   (message-beginning-of-line)
>   (delete-region (point) (point-at-eol))
>   (insert val) )
> ;; test: 
> ;; (message-set-header "Subject" "Lara loves YOU")

All I know of is message-add-header, but pass it an entire line, not a
header-value pair.

-- 
        Philip K.

Attachment: signature.asc
Description: PGP signature


reply via email to

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