1

How to configure emacs/gnus to use per newsgroup time zone in posted messages?

I would like to use CET time zone in pl.* newsgroups and UCT in general newsgroups.

AnFi
  • 10,493
  • 3
  • 23
  • 47

1 Answers1

0

I would use message-header-setup-hook or message-send-hook with this function:

(defvar date-rewrite-rules
  '(("pl" . return-time-string-in-CET)
    ("." . return-time-string-in-UTC)))
(defun rewrite-date-based-on-newsgroup ()
  (save-excursion
    (save-restriction
      (widen)
      (goto-char 0)
      (narrow-to-region 0 (search-forward mail-header-separator))
      (goto-char 0)
      (search-forward-regexp "^Newsgroup: ")
      (let ((date-f nil)
            (tail date-rewrite-rules))
        (while (and (null date-f)
                    tail)
          (let ((rule (pop tail)))
            (when (looking-at (car rule))
              (setq date-f (cdr rule)))))
        (when date-f
          (goto-char 0)
          (search-forward-regexp "^Date: ")
          (delete-region (point) (line-end-position))
          (insert (funcall date-f)))))))

NB: the code is untested, this is merely a starting point from which you should develop your solution.

sds
  • 58,617
  • 29
  • 161
  • 278
  • It produce error `save-restriction: Args out of range: 0, 498` - where 498 is equal to number of chars/bytes in headers and mail-header-separator. – AnFi Jul 19 '15 at 12:45
  • this is merely a starting point from which you should develop your solution – sds Jul 19 '15 at 13:49