(gnus-article-edit-article
`(lambda ()
(buffer-disable-undo)
- (erase-buffer)
(let ((mail-parse-charset (or gnus-article-charset
',gnus-newsgroup-charset))
(mail-parse-ignored-charsets
',gnus-newsgroup-ignored-charsets))
(mbl mml-buffer-list))
(setq mml-buffer-list nil)
- (insert-buffer-substring gnus-original-article-buffer)
+ ;; A new text must be inserted before deleting existing ones
+ ;; at the end so as not to move existing markers of which
+ ;; the insertion type is t.
+ (delete-region
+ (point-min)
+ (prog1
+ (goto-char (point-max))
+ (insert-buffer-substring gnus-original-article-buffer)))
(mime-to-mml ',handles)
(setq gnus-article-mime-handles nil)
(let ((mbl1 mml-buffer-list))
((mm-handle-undisplayer handle)
(mm-remove-part handle)))
(goto-char start)
+ (unless (bolp)
+ ;; This is a header button.
+ (forward-line 1))
(mm-display-inline handle))
;; Toggle the button appearance between `[button]...' and `[button]'.
(goto-char btn)
(point-max)))
(dolist (annot annots)
(set-extent-endpoints annot (point) (point)))))
- (unless (or displayed-p (eolp))
- ;; Add extra newline.
- (insert (propertize (buffer-substring (1- (point)) (point))
- 'gnus-undeletable t))))
- (unless (search-backward "\n\n" nil t)
- ;; We're in the article header.
- (delete-char -1)
- (dolist (ovl (gnus-overlays-in btn (point)))
- (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
- (gnus-overlay-put ovl 'face nil))
- (save-restriction
- (message-narrow-to-field)
- (let ((gnus-treatment-function-alist
- '((gnus-treat-highlight-headers
- gnus-article-highlight-headers))))
- (gnus-treat-article 'head))))
+ (setq start (point))
+ (if (search-backward "\n\n" nil t)
+ (progn
+ (goto-char start)
+ (unless (or displayed-p (eolp))
+ ;; Add extra newline.
+ (insert (propertize (buffer-substring (1- start) start)
+ 'gnus-undeletable t))))
+ ;; We're in the article header.
+ (delete-char -1)
+ (dolist (ovl (gnus-overlays-in btn (point)))
+ (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
+ (gnus-overlay-put ovl 'face nil))
+ (save-restriction
+ (message-narrow-to-field)
+ (let ((gnus-treatment-function-alist
+ '((gnus-treat-highlight-headers
+ gnus-article-highlight-headers))))
+ (gnus-treat-article 'head)))))
(goto-char b))))
(defun gnus-mime-set-charset-parameters (handle charset)
(unless (zerop (buffer-size))
(buffer-string))))))
(goto-char start)
+ (unless (bolp)
+ ;; This is a header button.
+ (forward-line 1))
(cond ((stringp part)
(save-restriction
(narrow-to-region (point)
(point-max)))
(dolist (annot annots)
(set-extent-endpoints annot (point) (point)))))
- (unless (or displayed-p (eolp))
- ;; Add extra newline.
- (insert (propertize (buffer-substring (1- (point)) (point))
- 'gnus-undeletable t))))
- (unless (search-backward "\n\n" nil t)
- ;; We're in the article header.
- (delete-char -1)
- (dolist (ovl (gnus-overlays-in point (point)))
- (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
- (gnus-overlay-put ovl 'face nil))
- (save-restriction
- (message-narrow-to-field)
- (let ((gnus-treatment-function-alist
- '((gnus-treat-highlight-headers
- gnus-article-highlight-headers))))
- (gnus-treat-article 'head))))
+ (setq start (point))
+ (if (search-backward "\n\n" nil t)
+ (progn
+ (goto-char start)
+ (unless (or displayed-p (eolp))
+ ;; Add extra newline.
+ (insert (propertize (buffer-substring (1- start) start)
+ 'gnus-undeletable t))))
+ ;; We're in the article header.
+ (delete-char -1)
+ (dolist (ovl (gnus-overlays-in point (point)))
+ (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
+ (gnus-overlay-put ovl 'face nil))
+ (save-restriction
+ (message-narrow-to-field)
+ (let ((gnus-treatment-function-alist
+ '((gnus-treat-highlight-headers
+ gnus-article-highlight-headers))))
+ (gnus-treat-article 'head)))))
(goto-char point)
(if (window-live-p window)
(select-window window)))
(setcar handle (caar handle))))
flat)
flat))))
- (let ((case-fold-search t) buttons st handle)
+ (let ((case-fold-search t) buttons handle type st)
(save-excursion
(save-restriction
(widen)
(unless (and interactive buttons)
;; Find buttons.
(setq buttons nil)
- (dolist (handle (flattened-alist))
- (when (and (not (stringp (cadr handle)))
- (or (equal (car (mm-handle-disposition
- (cdr handle)))
- "attachment")
- (not (and (mm-inlinable-p (cdr handle))
- (mm-inlined-p (cdr handle))))))
- (push handle buttons)))
+ (dolist (button (flattened-alist))
+ (setq handle (cdr button)
+ type (mm-handle-media-type handle))
+ (when (or (and (if (gnus-buffer-live-p gnus-summary-buffer)
+ (with-current-buffer gnus-summary-buffer
+ gnus-inhibit-images)
+ gnus-inhibit-images)
+ (string-match "\\`image/" type))
+ (mm-inline-override-p handle)
+ (and (mm-handle-disposition handle)
+ (not (equal (car (mm-handle-disposition handle))
+ "inline"))
+ (not (mm-attachment-override-p handle)))
+ (not (mm-automatic-display-p handle))
+ (not (or (and (mm-inlinable-p handle)
+ (mm-inlined-p handle))
+ (mm-automatic-external-display-p type))))
+ (push button buttons)))
(when buttons
;; Add header buttons.
(article-goto-body)
(when (eq obuf (current-buffer))
(set-buffer in-buffer)
t))
- (setq selected (gnus-summary-select-article))
+ (setq selected (ignore-errors (gnus-summary-select-article)))
(set-buffer obuf)
(unless not-restore-window
(set-window-configuration owin))