Per newsgroup timezone in Date: header

若如初见. 提交于 2019-12-11 12:06:22

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/22271533/per-newsgroup-timezone-in-date-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!