aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2012-09-17 07:39:41 -0400
committerRichard M. Stallman2012-09-17 07:39:41 -0400
commit2e8efb2f47b90edd393bde33bf048333b3bde279 (patch)
tree88c52b0f7c465adfb4c958dd0929b12f219c31d7
parentbb7dce392f6d9d5fc4b9d7de09ff920a52f07669 (diff)
downloademacs-2e8efb2f47b90edd393bde33bf048333b3bde279.tar.gz
emacs-2e8efb2f47b90edd393bde33bf048333b3bde279.zip
Handle Mail mode correctly. Some code cleanup.
-rw-r--r--lisp/gnus/ChangeLog9
-rw-r--r--lisp/gnus/mml.el68
2 files changed, 49 insertions, 28 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 69f0025b524..924e8ea95d8 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,12 @@
12012-09-17 Richard Stallman <rms@gnu.org>
2
3 * mml.el (mml-attach-file): Doc fix.
4 (mml-attach-external, mml-attach-buffer, mml-attach-file):
5 Set mail-encode-mml when in Mail mode.
6 Simplify code to set HEAD and move back to HEAD.
7 (mml-insert-multipart, mml-insert-part):
8 Set mail-encode-mml when in Mail mode.
9
12012-09-13 Katsumi Yamaoka <yamaoka@jpl.org> 102012-09-13 Katsumi Yamaoka <yamaoka@jpl.org>
2 11
3 * gnus-util.el (gnus-timer--function): New function. 12 * gnus-util.el (gnus-timer--function): New function.
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index cc1aedf1b97..a72962aae0d 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -1305,7 +1305,8 @@ to specify options."
1305(defun mml-attach-file (file &optional type description disposition) 1305(defun mml-attach-file (file &optional type description disposition)
1306 "Attach a file to the outgoing MIME message. 1306 "Attach a file to the outgoing MIME message.
1307The file is not inserted or encoded until you send the message with 1307The file is not inserted or encoded until you send the message with
1308`\\[message-send-and-exit]' or `\\[message-send]'. 1308`\\[message-send-and-exit]' or `\\[message-send]' in Message mode,
1309or `\\[mail-send-and-exit]' or `\\[mail-send]' in Mail mode.
1309 1310
1310FILE is the name of the file to attach. TYPE is its 1311FILE is the name of the file to attach. TYPE is its
1311content-type, a string of the form \"type/subtype\". DESCRIPTION 1312content-type, a string of the form \"type/subtype\". DESCRIPTION
@@ -1319,11 +1320,9 @@ body) or \"attachment\" (separate from the body)."
1319 (description (mml-minibuffer-read-description)) 1320 (description (mml-minibuffer-read-description))
1320 (disposition (mml-minibuffer-read-disposition type nil file))) 1321 (disposition (mml-minibuffer-read-disposition type nil file)))
1321 (list file type description disposition))) 1322 (list file type description disposition)))
1322 ;; Don't move point if this command is invoked inside the message header. 1323 ;; If in the message header, attach at the end and leave point unchanged.
1323 (let ((head (unless (message-in-body-p) 1324 (let ((head (unless (message-in-body-p) (point))))
1324 (prog1 1325 (if head (goto-char (point-max)))
1325 (point)
1326 (goto-char (point-max))))))
1327 (mml-insert-empty-tag 'part 1326 (mml-insert-empty-tag 'part
1328 'type type 1327 'type type
1329 ;; icicles redefines read-file-name and returns a 1328 ;; icicles redefines read-file-name and returns a
@@ -1331,12 +1330,15 @@ body) or \"attachment\" (separate from the body)."
1331 'filename (mm-substring-no-properties file) 1330 'filename (mm-substring-no-properties file)
1332 'disposition (or disposition "attachment") 1331 'disposition (or disposition "attachment")
1333 'description description) 1332 'description description)
1333 ;; When using Mail mode, make sure it does the mime encoding
1334 ;; when you send the message.
1335 (or (eq mail-user-agent 'message-user-agent)
1336 (setq mail-encode-mml t))
1334 (when head 1337 (when head
1335 (unless (prog1 1338 (unless (pos-visible-in-window-p)
1336 (pos-visible-in-window-p)
1337 (goto-char head))
1338 (message "The file \"%s\" has been attached at the end of the message" 1339 (message "The file \"%s\" has been attached at the end of the message"
1339 (file-name-nondirectory file)))))) 1340 (file-name-nondirectory file)))
1341 (goto-char head))))
1340 1342
1341(defun mml-dnd-attach-file (uri action) 1343(defun mml-dnd-attach-file (uri action)
1342 "Attach a drag and drop file. 1344 "Attach a drag and drop file.
@@ -1372,21 +1374,22 @@ BUFFER is the name of the buffer to attach. See
1372 (description (mml-minibuffer-read-description)) 1374 (description (mml-minibuffer-read-description))
1373 (disposition (mml-minibuffer-read-disposition type nil))) 1375 (disposition (mml-minibuffer-read-disposition type nil)))
1374 (list buffer type description disposition))) 1376 (list buffer type description disposition)))
1375 ;; Don't move point if this command is invoked inside the message header. 1377 ;; If in the message header, attach at the end and leave point unchanged.
1376 (let ((head (unless (message-in-body-p) 1378 (let ((head (unless (message-in-body-p) (point))))
1377 (prog1 1379 (if head (goto-char (point-max)))
1378 (point)
1379 (goto-char (point-max))))))
1380 (mml-insert-empty-tag 'part 'type type 'buffer buffer 1380 (mml-insert-empty-tag 'part 'type type 'buffer buffer
1381 'disposition disposition 1381 'disposition disposition
1382 'description description) 1382 'description description)
1383 ;; When using Mail mode, make sure it does the mime encoding
1384 ;; when you send the message.
1385 (or (eq mail-user-agent 'message-user-agent)
1386 (setq mail-encode-mml t))
1383 (when head 1387 (when head
1384 (unless (prog1 1388 (unless (pos-visible-in-window-p)
1385 (pos-visible-in-window-p)
1386 (goto-char head))
1387 (message 1389 (message
1388 "The buffer \"%s\" has been attached at the end of the message" 1390 "The buffer \"%s\" has been attached at the end of the message"
1389 buffer))))) 1391 buffer))
1392 (goto-char head))))
1390 1393
1391(defun mml-attach-external (file &optional type description) 1394(defun mml-attach-external (file &optional type description)
1392 "Attach an external file into the buffer. 1395 "Attach an external file into the buffer.
@@ -1397,19 +1400,20 @@ TYPE is the MIME type to use."
1397 (type (mml-minibuffer-read-type file)) 1400 (type (mml-minibuffer-read-type file))
1398 (description (mml-minibuffer-read-description))) 1401 (description (mml-minibuffer-read-description)))
1399 (list file type description))) 1402 (list file type description)))
1400 ;; Don't move point if this command is invoked inside the message header. 1403 ;; If in the message header, attach at the end and leave point unchanged.
1401 (let ((head (unless (message-in-body-p) 1404 (let ((head (unless (message-in-body-p) (point))))
1402 (prog1 1405 (if head (goto-char (point-max)))
1403 (point)
1404 (goto-char (point-max))))))
1405 (mml-insert-empty-tag 'external 'type type 'name file 1406 (mml-insert-empty-tag 'external 'type type 'name file
1406 'disposition "attachment" 'description description) 1407 'disposition "attachment" 'description description)
1408 ;; When using Mail mode, make sure it does the mime encoding
1409 ;; when you send the message.
1410 (or (eq mail-user-agent 'message-user-agent)
1411 (setq mail-encode-mml t))
1407 (when head 1412 (when head
1408 (unless (prog1 1413 (unless (pos-visible-in-window-p)
1409 (pos-visible-in-window-p)
1410 (goto-char head))
1411 (message "The file \"%s\" has been attached at the end of the message" 1414 (message "The file \"%s\" has been attached at the end of the message"
1412 (file-name-nondirectory file)))))) 1415 (file-name-nondirectory file)))
1416 (goto-char head))))
1413 1417
1414(defun mml-insert-multipart (&optional type) 1418(defun mml-insert-multipart (&optional type)
1415 (interactive (if (message-in-body-p) 1419 (interactive (if (message-in-body-p)
@@ -1422,12 +1426,20 @@ TYPE is the MIME type to use."
1422 (or type 1426 (or type
1423 (setq type "mixed")) 1427 (setq type "mixed"))
1424 (mml-insert-empty-tag "multipart" 'type type) 1428 (mml-insert-empty-tag "multipart" 'type type)
1429 ;; When using Mail mode, make sure it does the mime encoding
1430 ;; when you send the message.
1431 (or (eq mail-user-agent 'message-user-agent)
1432 (setq mail-encode-mml t))
1425 (forward-line -1)) 1433 (forward-line -1))
1426 1434
1427(defun mml-insert-part (&optional type) 1435(defun mml-insert-part (&optional type)
1428 (interactive (if (message-in-body-p) 1436 (interactive (if (message-in-body-p)
1429 (list (mml-minibuffer-read-type "")) 1437 (list (mml-minibuffer-read-type ""))
1430 (error "Use this command in the message body"))) 1438 (error "Use this command in the message body")))
1439 ;; When using Mail mode, make sure it does the mime encoding
1440 ;; when you send the message.
1441 (or (eq mail-user-agent 'message-user-agent)
1442 (setq mail-encode-mml t))
1431 (mml-insert-tag 'part 'type type 'disposition "inline")) 1443 (mml-insert-tag 'part 'type type 'disposition "inline"))
1432 1444
1433(declare-function message-subscribed-p "message" ()) 1445(declare-function message-subscribed-p "message" ())