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

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

message, can't find basic stuff [Elisp]


From: Emanuel Berg
Subject: message, can't find basic stuff [Elisp]
Date: Sat, 20 Feb 2021 02:12:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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




reply via email to

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