• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:insert +defs:buffer +defs:substring

73 (defcustom mml-insert-mime-headers-always nil
144 and `mml-insert-mime-headers-always' is nil. The value will be bound
148 (defvar mml-buffer-list nil)
150 (defun mml-generate-new-buffer (name)
151 (let ((buf (generate-new-buffer name)))
152 (push buf mml-buffer-list)
156 (let (kill-buffer-hook)
157 (mapcar 'kill-buffer mml-buffer-list)
158 (setq mml-buffer-list nil)))
161 "Parse the current buffer as an MML document."
172 "Parse the current buffer as an MML document."
206 (eval `(mml-insert-tag ,secure-mode
305 (buffer-substring-no-properties
328 (buffer-substring-no-properties
338 (setq name (buffer-substring-no-properties
342 (setq elem (buffer-substring-no-properties
345 (setq val (buffer-substring-no-properties
358 (defun mml-buffer-substring-no-properties-except-hard-newlines (start end)
359 (let ((str (buffer-substring-no-properties start end))
368 "Return the buffer up till the next part, multipart or closing part or multipart.
369 If MML is non-nil, return the buffer up till the correspondent mml tag."
380 (mml-buffer-substring-no-properties-except-hard-newlines
387 (mml-buffer-substring-no-properties-except-hard-newlines
394 (mml-buffer-substring-no-properties-except-hard-newlines
407 (with-temp-buffer
413 (buffer-string)))))
434 (with-temp-buffer
440 ((cdr (assq 'buffer cont))
441 (insert-buffer-substring (cdr (assq 'buffer cont))))
445 (mm-insert-file-contents filename)))
447 (insert (cdr (assq 'contents cont))))
451 (insert (cdr (assq 'contents cont)))
490 ;; Indicate that `mml-insert-mime-headers' should
491 ;; insert a "; format=flowed" string unless the
497 (setq coded (buffer-string)))
498 (mml-insert-mime-headers cont type charset encoding flowed)
499 (insert "\n")
500 (insert coded))
501 (mm-with-unibyte-buffer
503 ((cdr (assq 'buffer cont))
504 (insert (mm-string-as-unibyte
505 (with-current-buffer (cdr (assq 'buffer cont))
506 (buffer-string)))))
510 (mm-insert-file-contents filename nil nil nil nil t)))
518 (insert contents)
520 (insert contents)))))
521 (setq encoding (mm-encode-buffer type)
522 coded (mm-string-as-multibyte (buffer-string))))
523 (mml-insert-mime-headers cont type charset encoding nil)
524 (insert "\n")
525 (mm-with-unibyte-current-buffer
526 (insert coded)))))
528 (insert "Content-Type: message/external-body")
536 (mml-insert-parameter
539 (mml-insert-parameter
545 (mml-insert-parameter
551 (mml-insert-parameter
555 (mml-insert-parameter-string
557 (insert "\n\n")
558 (insert "Content-Type: "
565 (insert "Content-ID: " (message-make-message-id) "\n")
566 (insert "Content-Transfer-Encoding: "
568 (insert "\n\n")
569 (insert (or (cdr (assq 'contents cont))))
570 (insert "\n")))
581 (insert (format "Content-Type: multipart/%s; boundary=\"%s\""
590 (insert "\n--" mml-boundary "\n")
593 (insert "\n--" mml-boundary "--\n")))))
636 (with-temp-buffer
638 ((cdr (assq 'buffer cont))
639 (insert-buffer-substring (cdr (assq 'buffer cont))))
642 (mm-insert-file-contents filename nil nil nil nil t))
644 (insert (cdr (assq 'contents cont)))))
662 (defun mml-insert-mime-headers (cont type charset encoding flowed)
671 mml-insert-mime-headers-always)
675 (insert "Content-Type: " type)
677 (mml-insert-parameter
680 (mml-insert-parameter "format=flowed"))
682 (mml-insert-parameter-string
684 (insert "\n"))
686 (insert "Content-ID: " id "\n"))
692 (insert "Content-Disposition: " (or disposition "inline"))
694 (mml-insert-parameter-string
696 (insert "\n"))
698 (insert (format "Content-Transfer-Encoding: %s\n" encoding)))
700 (insert "Content-Description: ")
703 (insert description "\n")))
720 (defun mml-insert-parameter-string (cont types)
727 (mml-insert-parameter
740 (substring path (1+ (match-end 2))))
743 (defun mml-insert-buffer (buffer)
747 (insert-buffer-substring buffer)
756 "Translate the current buffer (which should be a message) into MML.
757 If HANDLES is non-nil, use it instead reparsing the buffer."
764 (setq handles (mm-dissect-buffer t)))
769 (mml-insert-mime handles)
770 (mml-insert-mime handles t))
781 "Translate the current buffer from MML to MIME."
789 (mail-encode-encoded-word-buffer))))
791 (defun mml-insert-mime (handle &optional no-markup)
792 (let (textp buffer mmlp)
797 (set-buffer (setq buffer (mml-generate-new-buffer " *mml*")))
798 (mm-insert-part handle 'no-cache)
803 (mml-insert-mml-markup handle nil t t)
806 (mml-insert-mml-markup handle buffer textp)))
809 (insert-buffer-substring buffer)
811 (insert "<#/mml>\n"))
813 (mapcar 'mml-insert-mime (cdr handle))
814 (insert "<#/multipart>\n"))
820 (mm-insert-part handle)
821 (insert (mm-decode-string (mm-get-part handle) charset)))
825 (insert "<#/part>\n")))))
827 (defun mml-insert-mml-markup (handle &optional buffer nofile mmlp)
828 "Take a MIME handle and insert an MML tag."
831 (insert "<#multipart type=" (mm-handle-media-subtype handle))
834 (insert " start=\"" start "\"")))
835 (insert ">\n"))
837 (insert "<#mml type=" (mm-handle-media-type handle))
838 (insert "<#part type=" (mm-handle-media-type handle)))
842 (insert " " (symbol-name (car elem)) "=\"" (cdr elem) "\"")))
844 (insert " id=\"" (mm-handle-id handle) "\""))
846 (insert " disposition=" (car (mm-handle-disposition handle))))
847 (when buffer
848 (insert " buffer=\"" (buffer-name buffer) "\""))
850 (insert " nofile=yes"))
852 (insert " description=\"" (mm-handle-description handle) "\""))
853 (insert ">\n")))
855 (defun mml-insert-parameter (&rest parameters)
859 (insert ";")
861 (insert " " param)
868 (insert "\n")
902 (define-key map "b" 'mml-attach-buffer)
905 (define-key map "m" 'mml-insert-multipart)
906 (define-key map "p" 'mml-insert-part)
925 ["Attach Buffer..." mml-attach-buffer
927 '(:help "Attach a buffer to the outgoing MIME message"))]
960 ["Insert Part..." mml-insert-part
962 ["Insert Multipart..." mml-insert-multipart
1005 ;;; inserting stuff to the buffer.
1070 (insert "!")))))
1072 (defun mml-insert-tag (name &rest plist)
1076 (insert "<#" name)
1086 (insert (format " %s=%s" key value)))))
1087 (insert ">\n"))
1089 (defun mml-insert-empty-tag (name &rest plist)
1093 (apply #'mml-insert-tag name plist)
1094 (insert "<#/" name ">\n"))
1147 (mml-insert-empty-tag 'part
1177 (defun mml-attach-buffer (buffer &optional type description)
1178 "Attach a buffer to the outgoing MIME message.
1181 (let* ((buffer (read-buffer "Attach buffer: "))
1182 (type (mml-minibuffer-read-type buffer "text/plain"))
1184 (list buffer type description)))
1187 (mml-insert-empty-tag 'part 'type type 'buffer buffer
1192 "Attach an external file into the buffer.
1202 (mml-insert-empty-tag 'external 'type type 'name file
1205 (defun mml-insert-multipart (&optional type)
1212 (mml-insert-empty-tag "multipart" 'type type)
1215 (defun mml-insert-part (&optional type)
1218 (mml-insert-tag 'part 'type type 'disposition "inline")
1221 (defun mml-preview-insert-mail-followup-to ()
1229 (insert (message-make-mail-followup-to))))
1232 "Display current buffer with Gnus, in a new buffer.
1236 (let* ((buf (current-buffer))
1246 (pop-to-buffer (generate-new-buffer
1248 "*MIME preview of ") (buffer-name))))
1250 (push (current-buffer) gnus-buffers))
1251 (erase-buffer)
1252 (insert-buffer-substring buf)
1253 (mml-preview-insert-mail-followup-to)
1267 (when (fboundp 'set-buffer-multibyte)
1268 (let ((s (buffer-string)))
1269 ;; Insert the content into unibyte buffer.
1270 (erase-buffer)
1272 (insert s)))
1274 gnus-article-prepare-hook gnus-original-article-buffer)
1282 (gnus-make-local-hook 'kill-buffer-hook)
1283 (add-hook 'kill-buffer-hook
1286 (setq buffer-read-only t)
1287 (local-set-key "q" (lambda () (interactive) (kill-buffer nil)))
1335 (not (cdr (assq 'buffer cont)))