* mm-util.el (mm-substring-no-properties): New function.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 18 Dec 2008 22:48:14 +0000 (22:48 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 18 Dec 2008 22:48:14 +0000 (22:48 +0000)
(mm-string-to-multibyte): Doc fix.

* mml.el (mml-attach-file): Use mm-substring-no-properties.

lisp/ChangeLog
lisp/mm-util.el
lisp/mml.el

index 513964c..be75778 100644 (file)
@@ -1,3 +1,10 @@
+2008-12-18  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * 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  <Reiner.Steib@gmx.de>
 
        * mml.el (mml-attach-file): Strip text properties from file name.
index 7e9f0ca..842b2d7 100644 (file)
                       (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)
     '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 "")))))
index 51d0753..14e060b 100644 (file)
@@ -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)))