Fix XEmacs compilation
[gnus] / lisp / gnus-art.el
index d2cf73f..d759583 100644 (file)
@@ -254,7 +254,13 @@ This can also be a list of the above values."
                 (regexp :value ".*"))
   :group 'gnus-article-signature)
 
-(defcustom gnus-hidden-properties '(invisible t intangible t)
+(defcustom gnus-hidden-properties
+  (if (featurep 'xemacs)
+      ;; `intangible' is evil, but I keep it here in case it's useful.
+      '(invisible t intangible t)
+    ;; Emacs's command loop moves point out of invisible text anyway, so
+    ;; `intangible' is clearly not needed there.
+    '(invisible t))
   "Property list to use for hiding text."
   :type 'sexp
   :group 'gnus-article-hiding)
@@ -1623,6 +1629,7 @@ It is a string, such as \"PGP\". If nil, ask user."
 
 (defcustom gnus-use-idna (and (condition-case nil (require 'idna) (file-error))
                              (mm-coding-system-p 'utf-8)
+                             idna-program
                              (executable-find idna-program))
   "Whether IDNA decoding of headers is used when viewing messages.
 This requires GNU Libidn, and by default only enabled if it is found."
@@ -4988,7 +4995,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 +5002,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))
@@ -5972,7 +5985,7 @@ Since MIME attachments tend to be put at the end of an article, we may
 overlook them if there is a huge body.  This option offers you a copy
 of all non-inlinable MIME parts as buttons shown in front of an article.
 If nil, don't show those extra buttons."
-  :version "24.5"
+  :version "25.1"
   :group 'gnus-article-mime
   :type 'boolean)
 
@@ -6368,7 +6381,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)
@@ -6388,14 +6401,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)
@@ -6791,7 +6814,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))