aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2011-11-15 18:36:54 -0500
committerGlenn Morris2011-11-15 18:36:54 -0500
commitd20faa20cff77bc4b64a9ceb5da267996786853c (patch)
tree6dd683b9a397ab6bfc703d31973bfb495a9d6869 /lisp
parentb018182ccdc0e8ecc1156ed4fa06a7464b0de572 (diff)
downloademacs-d20faa20cff77bc4b64a9ceb5da267996786853c.tar.gz
emacs-d20faa20cff77bc4b64a9ceb5da267996786853c.zip
Add optional arguments to rmailmm to force state, not just toggle.
* lisp/mail/rmailmm.el (rmail-mime-toggle-raw): Remove entity arg, which wasn't being used. Add optional arg to force given state. (rmail-mime): Add optional arg to force given state.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/mail/rmailmm.el52
2 files changed, 34 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9b76ce5e22e..387afa667fe 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12011-11-15 Glenn Morris <rgm@gnu.org>
2
3 * mail/rmailmm.el (rmail-mime-toggle-raw): Remove entity arg,
4 which wasn't being used. Add optional arg to force given state.
5 (rmail-mime): Add optional arg to force given state.
6
12011-11-15 Juanma Barranquero <lekktu@gmail.com> 72011-11-15 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * allout.el (allout-encryption-plaintext-sanitization-regexps): 9 * allout.el (allout-encryption-plaintext-sanitization-regexps):
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 46cd4bbfb37..f3b539c52d0 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -357,13 +357,17 @@ The value is a vector [INDEX HEADER TAGLINE BODY END], where
357 (dolist (child (rmail-mime-entity-children entity)) 357 (dolist (child (rmail-mime-entity-children entity))
358 (rmail-mime-raw-mode child))) 358 (rmail-mime-raw-mode child)))
359 359
360(defun rmail-mime-toggle-raw (entity) 360(defun rmail-mime-toggle-raw (&optional state)
361 "Toggle on and off the raw display mode of MIME-entity ENTITY." 361 "Toggle on and off the raw display mode of MIME-entity at point.
362With optional argument STATE, force the specified display mode.
363Use `raw' for raw mode, and any other non-nil value for decoded mode."
362 (let* ((pos (if (eobp) (1- (point-max)) (point))) 364 (let* ((pos (if (eobp) (1- (point-max)) (point)))
363 (entity (get-text-property pos 'rmail-mime-entity)) 365 (entity (get-text-property pos 'rmail-mime-entity))
364 (current (aref (rmail-mime-entity-display entity) 0)) 366 (current (aref (rmail-mime-entity-display entity) 0))
365 (segment (rmail-mime-entity-segment pos entity))) 367 (segment (rmail-mime-entity-segment pos entity)))
366 (if (not (eq (aref current 0) 'raw)) 368 (if (or (eq state 'raw)
369 (and (not state)
370 (not (eq (aref current 0) 'raw))))
367 ;; Enter the raw mode. 371 ;; Enter the raw mode.
368 (rmail-mime-raw-mode entity) 372 (rmail-mime-raw-mode entity)
369 ;; Enter the shown mode. 373 ;; Enter the shown mode.
@@ -1265,35 +1269,35 @@ available."
1265 (setq font-lock-defaults '(rmail-font-lock-keywords t t nil nil))) 1269 (setq font-lock-defaults '(rmail-font-lock-keywords t t nil nil)))
1266 1270
1267;;;###autoload 1271;;;###autoload
1268(defun rmail-mime (&optional arg) 1272(defun rmail-mime (&optional arg state)
1269 "Toggle displaying of a MIME message. 1273 "Toggle the display of a MIME message.
1270 1274
1271The actual behavior depends on the value of `rmail-enable-mime'. 1275The actual behavior depends on the value of `rmail-enable-mime'.
1272 1276
1273If `rmail-enable-mime' is non-nil (default), this command changes the 1277If `rmail-enable-mime' is non-nil (the default), this command toggles
1274display of a MIME message between decoded presentation form and raw data. 1278the display of a MIME message between decoded presentation form and
1275 1279raw data. With optional prefix argument ARG, it toggles the display only
1276With ARG, toggle the display of the current MIME entity only. 1280of the MIME entity at point, if there is one. The optional argument
1277 1281STATE forces a particular display state, rather than toggling.
1278If `rmail-enable-mime' is nil, this creates a temporary 1282`raw' forces raw mode, any other non-nil value forces decoded mode.
1279\"*RMAIL*\" buffer holding a decoded copy of the message. Inline 1283
1280content-types are handled according to 1284If `rmail-enable-mime' is nil, this creates a temporary \"*RMAIL*\"
1281`rmail-mime-media-type-handlers-alist'. By default, this 1285buffer holding a decoded copy of the message. Inline content-types are
1282displays text and multipart messages, and offers to download 1286handled according to `rmail-mime-media-type-handlers-alist'.
1283attachments as specified by `rmail-mime-attachment-dirs-alist'." 1287By default, this displays text and multipart messages, and offers to
1284 (interactive "P") 1288download attachments as specified by `rmail-mime-attachment-dirs-alist'.
1289The arguments ARG and STATE have no effect in this case."
1290 (interactive (list current-prefix-arg nil))
1285 (if rmail-enable-mime 1291 (if rmail-enable-mime
1286 (with-current-buffer rmail-buffer 1292 (with-current-buffer rmail-buffer
1287 (if (rmail-mime-message-p) 1293 (if (rmail-mime-message-p)
1288 (let ((rmail-mime-mbox-buffer rmail-view-buffer) 1294 (let ((rmail-mime-mbox-buffer rmail-view-buffer)
1289 (rmail-mime-view-buffer rmail-buffer) 1295 (rmail-mime-view-buffer rmail-buffer)
1290 (entity (get-text-property (point) 'rmail-mime-entity))) 1296 (entity (get-text-property
1291 (if arg 1297 (progn
1292 (if entity 1298 (or arg (goto-char (point-min)))
1293 (rmail-mime-toggle-raw entity)) 1299 (point)) 'rmail-mime-entity)))
1294 (goto-char (point-min)) 1300 (if (or (not arg) entity) (rmail-mime-toggle-raw state)))
1295 (rmail-mime-toggle-raw
1296 (get-text-property (point) 'rmail-mime-entity))))
1297 (message "Not a MIME message"))) 1301 (message "Not a MIME message")))
1298 (let* ((data (rmail-apply-in-message rmail-current-message 'buffer-string)) 1302 (let* ((data (rmail-apply-in-message rmail-current-message 'buffer-string))
1299 (buf (get-buffer-create "*RMAIL*")) 1303 (buf (get-buffer-create "*RMAIL*"))