:group 'message-news
:type '(repeat sexp)) ; Fixme: improve this
-(defcustom message-required-headers '((optional . References) From)
+(defcustom message-required-headers '((optional . References)
+ From)
"*Headers to be generated or prompted for when sending a message.
Also see `message-required-news-headers' and
`message-required-mail-headers'."
:group 'message-various
:type 'regexp)
+;; Fixme: Why are all these things autoloaded?
+
;;; marking inserted text
;;;###autoload
;; create a dependence to `gnus.el'.
:type 'sexp)
-(defcustom message-generate-headers-first nil
+;; FIXME: This should be a temporary workaround until someone implements a
+;; proper solution. If a crash happens while replying, the auto-save file
+;; will *not* have a `References:' header if `message-generate-headers-first'
+;; is nil. See: http://article.gmane.org/gmane.emacs.gnus.general/51138
+(defcustom message-generate-headers-first '(references)
"*If non-nil, generate all required headers before composing.
The variables `message-required-news-headers' and
`message-required-mail-headers' specify which headers to generate.
will not have a visible effect for those headers."
:group 'message-headers
:type '(choice (const :tag "None" nil)
+ (const :tag "References" '(references))
(const :tag "All" t)
(repeat (sexp :tag "Header"))))
(defcustom message-use-idna (and (condition-case nil (require 'idna)
(file-error))
- (fboundp 'coding-system-p)
- (coding-system-p 'utf-8)
+ (mm-coding-system-p 'utf-8)
'ask)
"Whether to encode non-ASCII in domain names into ASCII according to IDNA."
:group 'message-headers
(autoload 'gnus-group-name-decode "gnus-group")
(autoload 'gnus-groups-from-server "gnus")
(autoload 'rmail-output "rmailout")
- (autoload 'gnus-delay-article "gnus-delay"))
+ (autoload 'gnus-delay-article "gnus-delay")
+ (autoload 'gnus-make-local-hook "gnus-util"))
\f
(beg 1)
(first t)
quoted elems paren)
- (save-excursion
- (message-set-work-buffer)
+ (with-temp-buffer
+ (mm-enable-multibyte)
(insert header)
(goto-char (point-min))
(while (not (eobp))
(mail-narrow-to-head)
(message-fetch-field header))))
-(defun message-set-work-buffer ()
- (if (get-buffer " *message work*")
- (progn
- (set-buffer " *message work*")
- (erase-buffer))
- (set-buffer (get-buffer-create " *message work*"))
- (kill-all-local-variables)
- (mm-enable-multibyte)))
-
(defun message-functionp (form)
"Return non-nil if FORM is funcallable."
(or (and (symbolp form) (fboundp form))
(set (make-local-variable 'tool-bar-map) (message-tool-bar-map))))
(easy-menu-add message-mode-menu message-mode-map)
(easy-menu-add message-mode-field-menu message-mode-map)
- ;; make-local-hook is harmless though obsolete in Emacs 21.
- ;; Emacs 20 and XEmacs need make-local-hook.
- (make-local-hook 'after-change-functions)
+ (gnus-make-local-hook 'after-change-functions)
;; Mmmm... Forbidden properties...
(add-hook 'after-change-functions 'message-strip-forbidden-properties
nil 'local)
(let ((point (point)))
(message-goto-signature)
(unless (eobp)
- (forward-line -2))
+ (end-of-line -1))
(kill-region point (point))
(unless (bolp)
(insert "\n"))))
(defun message-fill-paragraph (&optional arg)
"Like `fill-paragraph'."
(interactive (list (if current-prefix-arg 'full)))
- (if (and (boundp 'filladapt-mode) filladapt-mode)
+ (if (if (boundp 'filladapt-mode) filladapt-mode)
nil
(message-newline-and-reformat arg t)
t))
(length
(setq to (completing-read
"Followups to (default: no Followup-To header) "
- (mapcar (lambda (g) (list g))
+ (mapcar #'list
(cons "poster"
(message-tokenize-header
newsgroups)))))))))
errors)
(y-or-n-p
(format
- "Really post to %s possibly unknown group%s: %s? "
+ "Really use %s possibly unknown group%s: %s? "
(if (= (length errors) 1) "this" "these")
(if (= (length errors) 1) "" "s")
(mapconcat 'identity errors ", "))))
(lsh (% message-unique-id-char 25) 16)) 4)
(message-number-base36 (+ (nth 1 tm)
(lsh (/ message-unique-id-char 25) 16)) 4)
- ;; Append the newsreader name, because while the generated
- ;; ID is unique to this newsreader, other newsreaders might
- ;; otherwise generate the same ID via another algorithm.
+ ;; Append a given name, because while the generated ID is unique
+ ;; to this newsreader, other newsreaders might otherwise generate
+ ;; the same ID via another algorithm.
".fsf")))
(defun message-number-base36 (num len)
(if (message-functionp message-user-organization)
(funcall message-user-organization)
message-user-organization))))
- (save-excursion
- (message-set-work-buffer)
+ (with-temp-buffer
+ (mm-enable-multibyte)
(cond ((stringp organization)
(insert organization))
((and (eq t organization)
(user-full-name))))
(when (string= fullname "&")
(setq fullname (user-login-name)))
- (save-excursion
- (message-set-work-buffer)
+ (with-temp-buffer
+ (mm-enable-multibyte)
(cond
((or (null style)
(equal fullname ""))
(when message-default-mail-headers
(insert message-default-mail-headers)
(or (bolp) (insert ?\n)))
+ (save-restriction
+ (message-narrow-to-headers)
+ (if message-alternative-emails
+ (message-use-alternative-email-as-from)))
(when message-generate-headers-first
(message-generate-headers
(message-headers-to-generate
(message-insert-signature)
(save-restriction
(message-narrow-to-headers)
- (if message-alternative-emails
- (message-use-alternative-email-as-from))
(run-hooks 'message-header-setup-hook))
(set-buffer-modified-p nil)
(setq buffer-undo-list nil)
(concat "["
(let ((prefix
(or (message-fetch-field "newsgroups")
- (cdr
- (mail-header-parse-address (message-fetch-field "from")))
+ (let ((from (message-fetch-field "from")))
+ (and from
+ (cdr (mail-header-parse-address from))))
"(nowhere)")))
(if message-forward-decoded-p
prefix
(not message-forward-decoded-p))
(insert
(with-temp-buffer
- (mm-disable-multibyte-mule4)
+ (mm-disable-multibyte)
(insert
(with-current-buffer forward-buffer
- (mm-with-unibyte-current-buffer-mule4 (buffer-string))))
- (mm-enable-multibyte-mule4)
+ (mm-with-unibyte-current-buffer (buffer-string))))
+ (mm-enable-multibyte)
(mime-to-mml)
(goto-char (point-min))
(when (looking-at "From ")
(cdr local)))))
locals)))
-;;; Miscellaneous functions
-
-(defsubst message-replace-chars-in-string (string from to)
- (mm-subst-char-in-string from to string))
-
;;;
;;; MIME functions
;;;
(message-next-header)
(let ((begin (point)))
(message-next-header)
- (add-text-properties begin (point)
- '(intangible t invisible t
- message-hidden t))))))))))
+ (add-text-properties
+ begin (point)
+ '(invisible t message-hidden t))))))))))
(defun message-hide-header-p (regexps)
(let ((result nil)