# HG changeset patch # User Chong Yidong # Date 1133308487 0 # Node ID 818361523ce879e504cf5c0bef930646353fcbbb # Parent 51e8cdc7d8a82e556a4765ffaa4e292708dfe307 * longlines.el (longlines-mode): Add mail-setup-hook. * mail/mailheader.el, mail/sendmail.el: Revert 2005-11-17 changes. * simple.el (sendmail-user-agent-compose, next-line): Conditionally use hard-newline. diff -r 51e8cdc7d8a8 -r 818361523ce8 lisp/ChangeLog --- a/lisp/ChangeLog Tue Nov 29 23:52:59 2005 +0000 +++ b/lisp/ChangeLog Tue Nov 29 23:54:47 2005 +0000 @@ -11,6 +11,13 @@ (hi-lock-face-phrase-buffer): Use hi-yellow face. (hi-lock-write-interactive-patterns): Use comment-region. + * longlines.el (longlines-mode): Add mail-setup-hook. + + * mail/mailheader.el, mail/sendmail.el: Revert 2005-11-17 changes. + + * simple.el (sendmail-user-agent-compose, next-line): + Conditionally use hard-newline. + 2005-11-29 Reiner Steib * international/latexenc.el (latex-inputenc-coding-alist): Reword diff -r 51e8cdc7d8a8 -r 818361523ce8 lisp/longlines.el --- a/lisp/longlines.el Tue Nov 29 23:52:59 2005 +0000 +++ b/lisp/longlines.el Tue Nov 29 23:54:47 2005 +0000 @@ -136,6 +136,7 @@ ;; Hacks to make longlines play nice with various modes. (cond ((eq major-mode 'mail-mode) + (add-hook 'mail-setup-hook 'longlines-decode-buffer nil t) (or mail-citation-hook (add-hook 'mail-citation-hook 'mail-indent-citation nil t)) (add-hook 'mail-citation-hook 'longlines-decode-region nil t)) diff -r 51e8cdc7d8a8 -r 818361523ce8 lisp/mail/mailheader.el --- a/lisp/mail/mailheader.el Tue Nov 29 23:52:59 2005 +0000 +++ b/lisp/mail/mailheader.el Tue Nov 29 23:54:47 2005 +0000 @@ -146,7 +146,7 @@ (insert (capitalize (symbol-name header)) ": " (if (consp value) (car value) value) - hard-newline))) + "\n"))) (defun mail-header-format (format-rules headers) "Use FORMAT-RULES to format HEADERS and insert into current buffer. @@ -187,7 +187,7 @@ (if (cdr rule) (funcall (cdr rule) header value) (funcall mail-header-format-function header value)))))) - (insert hard-newline))) + (insert "\n"))) (provide 'mailheader) diff -r 51e8cdc7d8a8 -r 818361523ce8 lisp/mail/sendmail.el --- a/lisp/mail/sendmail.el Tue Nov 29 23:52:59 2005 +0000 +++ b/lisp/mail/sendmail.el Tue Nov 29 23:54:47 2005 +0000 @@ -446,7 +446,7 @@ ;; has been called and has done so. (let ((fill-prefix "\t") (address-start (point))) - (insert to hard-newline) + (insert to "\n") (fill-region-as-paragraph address-start (point-max)) (goto-char (point-max)) (unless (bolp) @@ -455,7 +455,7 @@ (if cc (let ((fill-prefix "\t") (address-start (progn (insert "CC: ") (point)))) - (insert cc hard-newline) + (insert cc "\n") (fill-region-as-paragraph address-start (point-max)) (goto-char (point-max)) (unless (bolp) @@ -464,23 +464,23 @@ (let ((fill-prefix "\t") (fill-column 78) (address-start (point))) - (insert "In-reply-to: " in-reply-to hard-newline) + (insert "In-reply-to: " in-reply-to "\n") (fill-region-as-paragraph address-start (point-max)) (goto-char (point-max)) (unless (bolp) (newline)))) - (insert "Subject: " (or subject "") hard-newline) + (insert "Subject: " (or subject "") "\n") (if mail-default-headers (insert mail-default-headers)) (if mail-default-reply-to - (insert "Reply-to: " mail-default-reply-to hard-newline)) + (insert "Reply-to: " mail-default-reply-to "\n")) (if mail-self-blind - (insert "BCC: " user-mail-address hard-newline)) + (insert "BCC: " user-mail-address "\n")) (if mail-archive-file-name - (insert "FCC: " mail-archive-file-name hard-newline)) + (insert "FCC: " mail-archive-file-name "\n")) (put-text-property (point) (progn - (insert mail-header-separator hard-newline) + (insert mail-header-separator "\n") (1- (point))) 'category 'mail-header-separator) ;; Insert the signature. But remember the beginning of the message. @@ -488,7 +488,7 @@ (cond ((eq mail-signature t) (if (file-exists-p mail-signature-file) (progn - (insert hard-newline hard-newline "-- " hard-newline) + (insert "\n\n-- \n") (insert-file-contents mail-signature-file)))) ((stringp mail-signature) (insert mail-signature)) @@ -835,14 +835,14 @@ (split-string new-header-values ",[[:space:]]+" t)) (mapconcat 'identity l ", ")) - hard-newline)) + "\n")) ;; Add Mail-Reply-To if none yet (unless (mail-fetch-field "mail-reply-to") (goto-char (mail-header-end)) (insert "Mail-Reply-To: " (or (mail-fetch-field "reply-to") user-mail-address) - hard-newline)))))) + "\n")))))) (unless (memq mail-send-nonascii '(t mime)) (goto-char (point-min)) (skip-chars-forward "\0-\177") @@ -931,7 +931,7 @@ fullname-end 1) (replace-match "\\\\\\&" t)) (insert "\"")))) - (insert " <" login ">" hard-newline)) + (insert " <" login ">\n")) ((eq mail-from-style 'parens) (insert "From: " login " (") (let ((fullname-start (point))) @@ -955,9 +955,9 @@ fullname-end 1) (replace-match "\\1(\\3)" t) (goto-char fullname-start)))) - (insert ")" hard-newline)) + (insert ")\n")) ((null mail-from-style) - (insert "From: " login hard-newline)) + (insert "From: " login "\n")) ((eq mail-from-style 'system-default) nil) (t (error "Invalid value for `mail-from-style'"))))) @@ -996,7 +996,7 @@ (goto-char (point-max)) ;; require one newline at the end. (or (= (preceding-char) ?\n) - (insert hard-newline)) + (insert ?\n)) ;; Change header-delimiter to be what sendmail expects. (goto-char (mail-header-end)) (delete-region (point) (progn (end-of-line) (point))) @@ -1008,7 +1008,7 @@ ;; Ignore any blank lines in the header (while (and (re-search-forward "\n\n\n*" delimline t) (< (point) delimline)) - (replace-match hard-newline)) + (replace-match "\n")) (goto-char (point-min)) ;; Look for Resent- headers. They require sending ;; the message specially. @@ -1070,10 +1070,10 @@ (setq charset (coding-system-get selected-coding 'mime-charset)) (goto-char delimline) - (insert "MIME-version: 1.0" hard-newline + (insert "MIME-version: 1.0\n" "Content-type: text/plain; charset=" - (symbol-name charset) hard-newline - "Content-Transfer-Encoding: 8bit" hard-newline))) + (symbol-name charset) + "\nContent-Transfer-Encoding: 8bit\n"))) ;; Insert an extra newline if we need it to work around ;; Sun's bug that swallows newlines. (goto-char (1+ delimline)) @@ -1167,8 +1167,8 @@ (set-buffer tembuf) (erase-buffer) ;; This initial newline is written out if the fcc file already exists. - (insert hard-newline "From " (user-login-name) " " - (current-time-string time) hard-newline) + (insert "\nFrom " (user-login-name) " " + (current-time-string time) "\n") ;; Insert the time zone before the year. (forward-char -1) (forward-word -1) @@ -1178,7 +1178,7 @@ (insert-buffer-substring rmailbuf) ;; Make sure messages are separated. (goto-char (point-max)) - (insert hard-newline) + (insert ?\n) (goto-char 2) ;; ``Quote'' "^From " as ">From " ;; (note that this isn't really quoting, as there is no requirement @@ -1220,11 +1220,10 @@ (rmail-maybe-set-message-counters) (widen) (narrow-to-region (point-max) (point-max)) - (insert "\C-l" hard-newline "0, unseen,," - hard-newline "*** EOOH ***" hard-newline - "Date: " (mail-rfc822-date) hard-newline) + (insert "\C-l\n0, unseen,,\n*** EOOH ***\n" + "Date: " (mail-rfc822-date) "\n") (insert-buffer-substring curbuf beg2 end) - (insert hard-newline "\C-_") + (insert "\n\C-_") (goto-char (point-min)) (widen) (search-backward "\n\^_") @@ -1262,11 +1261,10 @@ (set-buffer (get-buffer-create " mail-temp")) (setq buffer-read-only nil) (erase-buffer) - (insert "\C-l" hard-newline "0, unseen,," hard-newline - "*** EOOH ***" hard-newline "Date: " - (mail-rfc822-date) hard-newline) + (insert "\C-l\n0, unseen,,\n*** EOOH ***\nDate: " + (mail-rfc822-date) "\n") (insert-buffer-substring curbuf beg2 end) - (insert hard-newline "\C-_") + (insert "\n\C-_") (write-region (point-min) (point-max) (car fcc-list) t) (erase-buffer))) (write-region @@ -1318,7 +1316,7 @@ (expand-abbrev) (or (mail-position-on-field "cc" t) (progn (mail-position-on-field "to") - (insert hard-newline "CC: ")))) + (insert "\nCC: ")))) (defun mail-bcc () "Move point to end of BCC-field. Create a BCC field if none." @@ -1326,7 +1324,7 @@ (expand-abbrev) (or (mail-position-on-field "bcc" t) (progn (mail-position-on-field "to") - (insert hard-newline "BCC: ")))) + (insert "\nBCC: ")))) (defun mail-fcc (folder) "Add a new FCC field, with file name completion." @@ -1334,7 +1332,7 @@ (expand-abbrev) (or (mail-position-on-field "fcc" t) ;Put new field after exiting FCC. (mail-position-on-field "to")) - (insert hard-newline "FCC: " folder)) + (insert "\nFCC: " folder)) (defun mail-reply-to () "Move point to end of Reply-To-field. Create a Reply-To field if none." @@ -1349,7 +1347,7 @@ (expand-abbrev) (or (mail-position-on-field "mail-reply-to" t) (progn (mail-position-on-field "to") - (insert hard-newline "Mail-Reply-To: ")))) + (insert "\nMail-Reply-To: ")))) (defun mail-mail-followup-to () "Move point to end of Mail-Followup-To field. @@ -1358,7 +1356,7 @@ (expand-abbrev) (or (mail-position-on-field "mail-followup-to" t) (progn (mail-position-on-field "to") - (insert hard-newline "Mail-Followup-To: ")))) + (insert "\nMail-Followup-To: ")))) (defun mail-position-on-field (field &optional soft) (let (end @@ -1373,7 +1371,7 @@ t) (or soft (progn (goto-char end) - (insert field ": " hard-newline) + (insert field ": \n") (skip-chars-backward "\n"))) nil))) @@ -1396,7 +1394,7 @@ (delete-region (point) (point-max))) (if (stringp mail-signature) (insert mail-signature) - (insert hard-newline hard-newline "-- " hard-newline) + (insert "\n\n-- \n") (insert-file-contents (expand-file-name mail-signature-file))))) (defun mail-fill-yanked-message (&optional justifyp) @@ -1482,7 +1480,7 @@ ;; loop would deactivate the mark because we inserted text. (goto-char (prog1 (mark t) (set-marker (mark-marker) (point) (current-buffer)))) - (if (not (eolp)) (insert hard-newline))))) + (if (not (eolp)) (insert ?\n))))) (defun mail-yank-clear-headers (start end) (if (< end start) @@ -1566,8 +1564,7 @@ (insert-char ?= (max 0 (- 60 (current-column)))) (newline) (setq middle (point)) - (insert "============================================================" - hard-newline) + (insert "============================================================\n") (push-mark) (goto-char middle) (insert-file-contents file) diff -r 51e8cdc7d8a8 -r 818361523ce8 lisp/simple.el --- a/lisp/simple.el Tue Nov 29 23:52:59 2005 +0000 +++ b/lisp/simple.el Tue Nov 29 23:54:47 2005 +0000 @@ -3326,7 +3326,7 @@ ;; When adding a newline, don't expand an abbrev. (let ((abbrev-mode nil)) (end-of-line) - (insert hard-newline)) + (insert (if use-hard-newlines hard-newline "\n"))) (line-move arg nil nil try-vscroll)) (if (interactive-p) (condition-case nil @@ -4515,7 +4515,8 @@ (unless (member-ignore-case (car (car other-headers)) '("in-reply-to" "cc" "body")) (insert (car (car other-headers)) ": " - (cdr (car other-headers)) hard-newline)) + (cdr (car other-headers)) + (if use-hard-newlines hard-newline "\n"))) (setq other-headers (cdr other-headers))) (when body (forward-line 1)