unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* message, can't find basic stuff [Elisp]
@ 2021-02-20  1:12 Emanuel Berg via Users list for the GNU Emacs text editor
  2021-02-20  9:23 ` Philip Kaludercic
  0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-02-20  1:12 UTC (permalink / raw)
  To: help-gnu-emacs

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
  (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")

(defun message-transpose-headers (hdr1 hdr2)
  (interactive "sheader 1: \nsheader 2: ")
  (let ((v1 (message-field-value hdr1))
        (v2 (message-field-value hdr2)))
    (message-set-header hdr1 v2)
    (message-set-header hdr2 v1) ))
;; test:
;; (message-transpose-headers "To" "Subject")

https://dataswamp.org/~incal/emacs-init/gnus/message-incal.el

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-21  4:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-20  1:12 message, can't find basic stuff [Elisp] Emanuel Berg via Users list for the GNU Emacs text editor
2021-02-20  9:23 ` Philip Kaludercic
2021-02-20 18:44   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-02-20 19:04     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-02-21  4:50       ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).