Commit a574edbe authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

Minor rmail fixes.

* mail/rmail.el (rmail-get-coding-function): Variable.
(rmail-get-coding-system): Use it.

* mail/rmail.el	(rmail-make-in-reply-to-field):
Add parens in message-id.

* mail/rmailmm.el (rmail-mime-message-p): Moved to rmail.el.
* mail/rmail.el (rmail-mime-message-p): Moved from rmailmm.el.
(rmail-epa-decrypt): Turn off mime processing.
parent b66b98fe
2014-01-02 Richard Stallman <rms@gnu.org>
* mail/rmailmm.el (rmail-mime-message-p): Moved to rmail.el.
* mail/rmail.el (rmail-mime-message-p): Moved from rmailmm.el.
(rmail-epa-decrypt): Turn off mime processing.
* mail/rmail.el (rmail-make-in-reply-to-field):
Add parens in message-id.
* mail/rmail.el (rmail-get-coding-function): Variable.
(rmail-get-coding-system): Use it.
2014-01-02 Vincent Belaïche <vincentb1@users.sourceforge.net> 2014-01-02 Vincent Belaïche <vincentb1@users.sourceforge.net>
* ses.el (ses-initial-global-parameters-re): New defconst, a * ses.el (ses-initial-global-parameters-re): New defconst, a
......
...@@ -104,6 +104,11 @@ its character representation and its display representation.") ...@@ -104,6 +104,11 @@ its character representation and its display representation.")
"Non-nil if message has been processed by `rmail-show-mime-function'.") "Non-nil if message has been processed by `rmail-show-mime-function'.")
(put 'rmail-mime-decoded 'permanent-local t) ; for rmail-edit (put 'rmail-mime-decoded 'permanent-local t) ; for rmail-edit
(defsubst rmail-mime-message-p ()
"Non-nil if and only if the current message is a MIME."
(or (get-text-property (point) 'rmail-mime-entity)
(get-text-property (point-min) 'rmail-mime-entity)))
(defgroup rmail nil (defgroup rmail nil
"Mail reader for Emacs." "Mail reader for Emacs."
:group 'mail) :group 'mail)
...@@ -686,6 +691,12 @@ Element N specifies the summary line for message N+1.") ...@@ -686,6 +691,12 @@ Element N specifies the summary line for message N+1.")
This is set to nil by default.") This is set to nil by default.")
(defcustom rmail-get-coding-function nil
"Function of no args to try to determine coding system for a message."
:type 'function
:group 'rmail
:version "24.4")
(defcustom rmail-enable-mime t (defcustom rmail-enable-mime t
"If non-nil, RMAIL automatically displays decoded MIME messages. "If non-nil, RMAIL automatically displays decoded MIME messages.
For this to work, the feature specified by `rmail-mime-feature' must For this to work, the feature specified by `rmail-mime-feature' must
...@@ -1029,9 +1040,10 @@ This function also reinitializes local variables used by Rmail." ...@@ -1029,9 +1040,10 @@ This function also reinitializes local variables used by Rmail."
The buffer is expected to be narrowed to just the header of the message." The buffer is expected to be narrowed to just the header of the message."
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(if (re-search-forward rmail-mime-charset-pattern nil t) (or (funcall rmail-get-coding-function)
(coding-system-from-name (match-string 1)) (if (re-search-forward rmail-mime-charset-pattern nil t)
'undecided))) (coding-system-from-name (match-string 1))
'undecided))))
;;; Set up Rmail mode keymaps ;;; Set up Rmail mode keymaps
...@@ -3863,16 +3875,18 @@ which is an element of rmail-msgref-vector." ...@@ -3863,16 +3875,18 @@ which is an element of rmail-msgref-vector."
message-id)) message-id))
;; missing From, or Message-ID is sufficiently informative ;; missing From, or Message-ID is sufficiently informative
message-id message-id
(concat message-id " (" tem ")")) (concat message-id " (" tem ")"))
;; Message has no Message-ID field.
;; Copy TEM, discarding text properties. ;; Copy TEM, discarding text properties.
(setq tem (copy-sequence tem)) (setq tem (copy-sequence tem))
(set-text-properties 0 (length tem) nil tem) (set-text-properties 0 (length tem) nil tem)
(setq tem (copy-sequence tem)) (setq tem (copy-sequence tem))
;; Use prin1 to fake RFC822 quoting ;; Use prin1 to fake RFC822 quoting
(let ((field (prin1-to-string tem))) (let ((field (prin1-to-string tem)))
;; Wrap it in parens to make it a comment according to RFC822
(if date (if date
(concat field "'s message of " date) (concat "(" field "'s message of " date ")")
field))))) (concat "(" field ")"))))))
((let* ((foo "[^][\000-\037()<>@,;:\\\" ]+") ((let* ((foo "[^][\000-\037()<>@,;:\\\" ]+")
(bar "[^][\000-\037()<>@,;:\\\"]+")) (bar "[^][\000-\037()<>@,;:\\\"]+"))
;; These strings both match all non-ASCII characters. ;; These strings both match all non-ASCII characters.
...@@ -3898,7 +3912,8 @@ which is an element of rmail-msgref-vector." ...@@ -3898,7 +3912,8 @@ which is an element of rmail-msgref-vector."
(if message-id (if message-id
;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)" ;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)"
(concat message-id " (" field ")") (concat message-id " (" field ")")
field)))) ;; Wrap in parens to make it a comment, for RFC822.
(concat "(" field ")")))))
(t (t
;; If we can't kludge it simply, do it correctly ;; If we can't kludge it simply, do it correctly
(let ((mail-use-rfc822 t)) (let ((mail-use-rfc822 t))
...@@ -4483,7 +4498,7 @@ encoded string (and the same mask) will decode the string." ...@@ -4483,7 +4498,7 @@ encoded string (and the same mask) will decode the string."
;; There doesn't really seem to be an appropriate menu. ;; There doesn't really seem to be an appropriate menu.
;; Eg the edit command is not in a menu either. ;; Eg the edit command is not in a menu either.
(defun rmail-epa-decrypt () (defun rmail-epa-decrypt ()
"Decrypt OpenPGP armors in current message." "Decrypt GnuPG or OpenPGP armors in current message."
(interactive) (interactive)
;; Save the current buffer here for cleanliness, in case we ;; Save the current buffer here for cleanliness, in case we
...@@ -4493,14 +4508,10 @@ encoded string (and the same mask) will decode the string." ...@@ -4493,14 +4508,10 @@ encoded string (and the same mask) will decode the string."
(let (decrypts) (let (decrypts)
(goto-char (point-min)) (goto-char (point-min))
;; In case the encrypted data is inside a mime attachment, ;; Turn off mime processing.
;; show it. This is a kludge; to be clean, it should not (when (and (rmail-mime-message-p)
;; modify the buffer, but I don't see how to do that. (not (get-text-property (point-min) 'rmail-mime-hidden)))
(when (search-forward "octet-stream" nil t) (rmail-mime))
(beginning-of-line)
(forward-button 1)
(if (looking-at "Show")
(rmail-mime-toggle-hidden)))
;; Now find all armored messages in the buffer ;; Now find all armored messages in the buffer
;; and decrypt them one by one. ;; and decrypt them one by one.
...@@ -4560,6 +4571,7 @@ encoded string (and the same mask) will decode the string." ...@@ -4560,6 +4571,7 @@ encoded string (and the same mask) will decode the string."
(when armor-end (when armor-end
(delete-region armor-start armor-end) (delete-region armor-start armor-end)
(insert-buffer-substring from-buffer (nth 0 d) (nth 1 d))))))))))))) (insert-buffer-substring from-buffer (nth 0 d) (nth 1 d)))))))))))))
;;;; Desktop support ;;;; Desktop support
......
...@@ -230,11 +230,6 @@ TRUNCATED is non-nil if the text of this entity was truncated." ...@@ -230,11 +230,6 @@ TRUNCATED is non-nil if the text of this entity was truncated."
(defsubst rmail-mime-entity-set-truncated (entity truncated) (defsubst rmail-mime-entity-set-truncated (entity truncated)
(aset entity 9 truncated)) (aset entity 9 truncated))
(defsubst rmail-mime-message-p ()
"Non-nil if and only if the current message is a MIME."
(or (get-text-property (point) 'rmail-mime-entity)
(get-text-property (point-min) 'rmail-mime-entity)))
;;; Buttons ;;; Buttons
(defun rmail-mime-save (button) (defun rmail-mime-save (button)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment