From efabacf652f968bdc766c208f59cc8d99ec11d3a Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Thu, 18 Dec 2008 22:48:14 +0000 Subject: [PATCH] * mm-util.el (mm-substring-no-properties): New function. (mm-string-to-multibyte): Doc fix. * mml.el (mml-attach-file): Use mm-substring-no-properties. --- lisp/ChangeLog | 7 +++++++ lisp/mm-util.el | 16 ++++++++++++++-- lisp/mml.el | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 513964c41..be757787a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2008-12-18 Katsumi Yamaoka + + * mm-util.el (mm-substring-no-properties): New function. + (mm-string-to-multibyte): Doc fix. + + * mml.el (mml-attach-file): Use mm-substring-no-properties. + 2008-12-18 Reiner Steib * mml.el (mml-attach-file): Strip text properties from file name. diff --git a/lisp/mm-util.el b/lisp/mm-util.el index 7e9f0cacd..842b2d78f 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -118,7 +118,19 @@ (and (consp elem) (stringp (car elem)) (string-match (car elem) buffer-name) - (throw 'return (cdr elem)))))))))))) + (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/mml.el b/lisp/mml.el index 51d07539e..14e060b11 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -1291,7 +1291,7 @@ body) or \"attachment\" (separate from the body)." 'type type ;; icicles redefines read-file-name and returns a ;; string w/ text properties :-/ - 'filename (substring-no-properties file) + 'filename (mm-substring-no-properties file) 'disposition (or disposition "attachment") 'description description))) -- 2.25.1