]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/gnus/gnus-art.el (gnus-mm-display-part): Bugfix for the 2014-03-23 change
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 30 Apr 2014 04:05:27 +0000 (04:05 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 30 Apr 2014 04:05:27 +0000 (04:05 +0000)
lisp/gnus/ChangeLog
lisp/gnus/gnus-art.el

index f766dd539cf8ae71a197a7d70ff0db9e9024ec5c..7d880016ad7272b176749b1d0a4f794ac20b9894 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-30  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-mm-display-part): Don't move point while toggling
+       a part; redisplay a button (enbugged in 2014-02-05).
+
 2014-04-27  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * auth-source.el (auth-source-search, auth-source-search-backends):
index 0d68c5442f99b206b8602c0dd566d83d97f85f7a..ef50a0064ae7ab5cc3a9733f316664b8822758c1 100644 (file)
@@ -5635,43 +5635,53 @@ all parts."
   "Display HANDLE and fix MIME button."
   (let ((id (get-text-property (point) 'gnus-part))
        (point (point))
-       (inhibit-read-only t))
-    (forward-line 1)
-    (prog1
-       (let ((window (selected-window))
-             (mail-parse-charset gnus-newsgroup-charset)
-             (mail-parse-ignored-charsets
-              (if (gnus-buffer-live-p gnus-summary-buffer)
-                  (with-current-buffer gnus-summary-buffer
-                    gnus-newsgroup-ignored-charsets)
-                nil)))
-         (save-excursion
-           (unwind-protect
-               (let ((win (gnus-get-buffer-window (current-buffer) t))
-                     (beg (point)))
-                 (when win
-                   (select-window win))
-                 (goto-char point)
-                 (forward-line)
-                 (if (mm-handle-displayed-p handle)
-                     ;; This will remove the part.
-                     (mm-display-part handle)
-                   (save-window-excursion
-                     (save-restriction
-                       (narrow-to-region (point)
-                                         (if (eobp) (point) (1+ (point))))
-                       (gnus-bind-safe-url-regexp (mm-display-part handle))
-                       ;; We narrow to the part itself and
-                       ;; then call the treatment functions.
-                       (goto-char (point-min))
-                       (forward-line 1)
-                       (narrow-to-region (point) (point-max))
-                       (gnus-treat-article
-                        nil id
-                        (gnus-article-mime-total-parts)
-                        (mm-handle-media-type handle))))))
-             (if (window-live-p window)
-                 (select-window window))))))))
+       (inhibit-read-only t)
+       (window (selected-window))
+       (mail-parse-charset gnus-newsgroup-charset)
+       (mail-parse-ignored-charsets
+        (if (gnus-buffer-live-p gnus-summary-buffer)
+            (with-current-buffer gnus-summary-buffer
+              gnus-newsgroup-ignored-charsets)
+          nil))
+       retval)
+    (unwind-protect
+       (progn
+         (let ((win (gnus-get-buffer-window (current-buffer) t)))
+           (when win
+             (select-window win)
+             (goto-char point)))
+         (forward-line)
+         (if (mm-handle-displayed-p handle)
+             ;; This will remove the part.
+             (setq retval (mm-display-part handle))
+           (save-window-excursion
+             (save-restriction
+               ;; FIXME: nothing is displayed in the article buffer
+               ;; while prompting a user for a file name.
+               (narrow-to-region (point)
+                                 (if (eobp) (point) (1+ (point))))
+               (gnus-bind-safe-url-regexp
+                (setq retval (mm-display-part handle)))
+               ;; We narrow to the part itself and
+               ;; then call the treatment functions.
+               (goto-char (point-min))
+               (forward-line 1)
+               (narrow-to-region (point) (point-max))
+               (gnus-treat-article
+                nil id
+                (gnus-article-mime-total-parts)
+                (mm-handle-media-type handle))))))
+      (if (window-live-p window)
+         (select-window window))
+      (goto-char point)
+      ;; Toggle the button appearance between `[button]...' and `[button]'.
+      (let ((end (next-single-property-change point 'gnus-data)))
+       (delete-region (previous-single-property-change end 'gnus-data) end))
+      (gnus-insert-mime-button
+       handle id (list (mm-handle-displayed-p handle)))
+      (delete-char -1)
+      (goto-char point))
+    retval))
 
 (defun gnus-article-goto-part (n)
   "Go to MIME part N."