summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2008-12-19 02:40:25 +0000
committerMiles Bader <miles@gnu.org>2008-12-19 02:40:25 +0000
commitc7948b5fadad5b745f7733daac11a19fbfcc6ccf (patch)
treed9a08e3e58b2143fe59fc305e79f1b5b3cf9a27b
parentf013149203926418962838d68bc7f09d35c16052 (diff)
downloademacs-c7948b5fadad5b745f7733daac11a19fbfcc6ccf.tar.gz
emacs-c7948b5fadad5b745f7733daac11a19fbfcc6ccf.tar.bz2
emacs-c7948b5fadad5b745f7733daac11a19fbfcc6ccf.zip
Merge from gnus--devo--0
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1505
-rw-r--r--lisp/gnus/ChangeLog13
-rw-r--r--lisp/gnus/mm-util.el90
-rw-r--r--lisp/gnus/mml.el4
3 files changed, 67 insertions, 40 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 5dbf7ff30cb..94145b74b6c 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,16 @@
+2008-12-18 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * mm-util.el (mm-substring-no-properties): New function.
+ (mm-read-charset, mm-subst-char-in-string, mm-replace-in-string)
+ (mm-special-display-p): Enable those lambda forms to be byte compiled.
+ (mm-string-to-multibyte): Doc fix.
+
+ * mml.el (mml-attach-file): Use mm-substring-no-properties.
+
+2008-12-18 Reiner Steib <Reiner.Steib@gmx.de>
+
+ * mml.el (mml-attach-file): Strip text properties from file name.
+
2008-12-16 Glenn Morris <rgm@gnu.org>
* mm-util.el (mm-charset-override-alist): Declare for compiler.
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index 1c28f375db0..9ef3d37ac7e 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -47,38 +47,38 @@
(if (fboundp (car elem))
(defalias nfunc (car elem))
(defalias nfunc (cdr elem)))))
- '((coding-system-list . ignore)
+ `((coding-system-list . ignore)
(char-int . identity)
(coding-system-equal . equal)
(annotationp . ignore)
(set-buffer-file-coding-system . ignore)
(read-charset
- . (lambda (prompt)
- "Return a charset."
- (intern
- (completing-read
- prompt
- (mapcar (lambda (e) (list (symbol-name (car e))))
- mm-mime-mule-charset-alist)
- nil t))))
+ . ,(lambda (prompt)
+ "Return a charset."
+ (intern
+ (completing-read
+ prompt
+ (mapcar (lambda (e) (list (symbol-name (car e))))
+ mm-mime-mule-charset-alist)
+ nil t))))
(subst-char-in-string
- . (lambda (from to string &optional inplace)
- ;; stolen (and renamed) from nnheader.el
- "Replace characters in STRING from FROM to TO.
+ . ,(lambda (from to string &optional inplace)
+ ;; stolen (and renamed) from nnheader.el
+ "Replace characters in STRING from FROM to TO.
Unless optional argument INPLACE is non-nil, return a new string."
- (let ((string (if inplace string (copy-sequence string)))
- (len (length string))
- (idx 0))
- ;; Replace all occurrences of FROM with TO.
- (while (< idx len)
- (when (= (aref string idx) from)
- (aset string idx to))
- (setq idx (1+ idx)))
- string)))
+ (let ((string (if inplace string (copy-sequence string)))
+ (len (length string))
+ (idx 0))
+ ;; Replace all occurrences of FROM with TO.
+ (while (< idx len)
+ (when (= (aref string idx) from)
+ (aset string idx to))
+ (setq idx (1+ idx)))
+ string)))
(replace-in-string
- . (lambda (string regexp rep &optional literal)
- "See `replace-regexp-in-string', only the order of args differs."
- (replace-regexp-in-string regexp rep string nil literal)))
+ . ,(lambda (string regexp rep &optional literal)
+ "See `replace-regexp-in-string', only the order of args differs."
+ (replace-regexp-in-string regexp rep string nil literal)))
(string-as-unibyte . identity)
(string-make-unibyte . identity)
;; string-as-multibyte often doesn't really do what you think it does.
@@ -105,20 +105,32 @@
(multibyte-char-to-unibyte . identity)
(set-buffer-multibyte . ignore)
(special-display-p
- . (lambda (buffer-name)
- "Returns non-nil if a buffer named BUFFER-NAME gets a special frame."
- (and special-display-function
- (or (and (member buffer-name special-display-buffer-names) t)
- (cdr (assoc buffer-name special-display-buffer-names))
- (catch 'return
- (dolist (elem special-display-regexps)
- (and (stringp elem)
- (string-match elem buffer-name)
- (throw 'return t))
- (and (consp elem)
- (stringp (car elem))
- (string-match (car elem) buffer-name)
- (throw 'return (cdr elem))))))))))))
+ . ,(lambda (buffer-name)
+ "Returns non-nil if a buffer named BUFFER-NAME gets a special frame."
+ (and special-display-function
+ (or (and (member buffer-name special-display-buffer-names) t)
+ (cdr (assoc buffer-name special-display-buffer-names))
+ (catch 'return
+ (dolist (elem special-display-regexps)
+ (and (stringp elem)
+ (string-match elem buffer-name)
+ (throw 'return t))
+ (and (consp elem)
+ (stringp (car elem))
+ (string-match (car elem) buffer-name)
+ (throw 'return (cdr elem)))))))))
+ (substring-no-properties
+ . ,(lambda (string &optional from to)
+ "Return a substring of STRING, without text properties.
+It starts at index FROM and ending before TO.
+TO may be nil or omitted; then the substring runs to the end of STRING.
+If FROM is nil or omitted, the substring starts at the beginning of STRING.
+If FROM or TO is negative, it counts from the end.
+
+With one argument, just copy STRING without its properties."
+ (setq string (substring string (or from 0) to))
+ (set-text-properties 0 (length string) nil string)
+ string)))))
(eval-and-compile
(if (featurep 'xemacs)
@@ -156,7 +168,7 @@
'string-to-multibyte)
(t
(lambda (string)
- "Return a multibyte string with the same individual chars as string."
+ "Return a multibyte string with the same individual chars as STRING."
(mapconcat
(lambda (ch) (mm-string-as-multibyte (char-to-string ch)))
string "")))))
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index 3e3cb2ccda4..14e060b117a 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -1289,7 +1289,9 @@ body) or \"attachment\" (separate from the body)."
(unless (message-in-body-p) (goto-char (point-max)))
(mml-insert-empty-tag 'part
'type type
- 'filename file
+ ;; icicles redefines read-file-name and returns a
+ ;; string w/ text properties :-/
+ 'filename (mm-substring-no-properties file)
'disposition (or disposition "attachment")
'description description)))