(mm-read-charset, mm-subst-char-in-string, mm-replace-in-string)
authorKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 18 Dec 2008 23:28:29 +0000 (23:28 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 18 Dec 2008 23:28:29 +0000 (23:28 +0000)
(mm-special-display-p): Enable those lambda forms to be byte compiled.

lisp/ChangeLog
lisp/mm-util.el

index be75778..b19f68d 100644 (file)
@@ -1,6 +1,8 @@
 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.
index 842b2d7..ebc42a6 100644 (file)
        (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.
      (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.
+      . ,(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)))))
+          (setq string (substring string (or from 0) to))
+          (set-text-properties 0 (length string) nil string)
+          string)))))
 
 (eval-and-compile
   (if (featurep 'xemacs)