X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-art.el;h=36bb79ca9efd6a08871cde70182157a1f14477e8;hb=1c2ed0ce5abe2181e51f777171f8cd40a547e5a9;hp=01d8378c19a36072d493f524e8d4cd568860f825;hpb=974ba1f3c0ff7f80e205fad25aed6889b08bde07;p=gnus diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 01d8378c1..36bb79ca9 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -4988,7 +4988,6 @@ and `gnus-mime-delete-part', and not provided at run-time normally." (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 @@ -4996,7 +4995,14 @@ and `gnus-mime-delete-part', and not provided at run-time normally." ',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)) @@ -5347,6 +5353,9 @@ Compressed files like .gz and .bz2 are decompressed." ((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) @@ -5365,22 +5374,25 @@ Compressed files like .gz and .bz2 are decompressed." (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) @@ -5713,6 +5725,9 @@ all parts." (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) @@ -5747,22 +5762,25 @@ all parts." (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))) @@ -6356,7 +6374,7 @@ in the body. Use `gnus-header-face-alist' to highlight buttons." (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) @@ -6376,14 +6394,24 @@ in the body. Use `gnus-header-face-alist' to highlight buttons." (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) @@ -6779,7 +6807,7 @@ not have a face in `gnus-article-boring-faces'." (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))