aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2016-02-14 15:41:02 +1100
committerLars Ingebrigtsen2016-02-14 15:41:02 +1100
commita0844f15cad956a31f8a2cdb22df9ac9962ea95a (patch)
tree5999517cf4e78497c4939d3778bb3145273cd0d5
parent598ff2349eb8e3c9fc3a17d14899abe6a1e3c534 (diff)
downloademacs-a0844f15cad956a31f8a2cdb22df9ac9962ea95a.tar.gz
emacs-a0844f15cad956a31f8a2cdb22df9ac9962ea95a.zip
Clean up nnimap-request-move-article slightly
* lisp/gnus/nnheader.el (subr-x): Require. * lisp/gnus/nnimap.el (nnimap-request-move-article): Clean up the code slightly.
-rw-r--r--lisp/gnus/nnheader.el1
-rw-r--r--lisp/gnus/nnimap.el27
2 files changed, 15 insertions, 13 deletions
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 9f4d1b9334c..191a90892f3 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -40,6 +40,7 @@
40(require 'mail-utils) 40(require 'mail-utils)
41(require 'mm-util) 41(require 'mm-util)
42(require 'gnus-util) 42(require 'gnus-util)
43(require 'subr-x)
43(autoload 'gnus-range-add "gnus-range") 44(autoload 'gnus-range-add "gnus-range")
44(autoload 'gnus-remove-from-range "gnus-range") 45(autoload 'gnus-remove-from-range "gnus-range")
45;; FIXME none of these are used explicitly in this file. 46;; FIXME none of these are used explicitly in this file.
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 66096ff2367..fc9304f672b 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -913,7 +913,8 @@ textual parts.")
913 t) 913 t)
914 914
915(deffoo nnimap-request-move-article (article group server accept-form 915(deffoo nnimap-request-move-article (article group server accept-form
916 &optional _last internal-move-group) 916 &optional _last
917 internal-move-group)
917 (setq group (nnimap-decode-gnus-group group)) 918 (setq group (nnimap-decode-gnus-group group))
918 (when internal-move-group 919 (when internal-move-group
919 (setq internal-move-group (nnimap-decode-gnus-group internal-move-group))) 920 (setq internal-move-group (nnimap-decode-gnus-group internal-move-group)))
@@ -923,17 +924,18 @@ textual parts.")
923 'nnimap-request-head 924 'nnimap-request-head
924 'nnimap-request-article) 925 'nnimap-request-article)
925 article group server (current-buffer)) 926 article group server (current-buffer))
926 ;; If the move is internal (on the same server), just do it the easy 927 ;; If the move is internal (on the same server), just do it the
927 ;; way. 928 ;; easy way.
928 (let ((message-id (message-field-value "message-id"))) 929 (let ((message-id (message-field-value "message-id")))
929 (if internal-move-group 930 (if internal-move-group
930 (with-current-buffer (nnimap-buffer) 931 (with-current-buffer (nnimap-buffer)
931 (let* ((can-move (nnimap-capability "MOVE")) 932 (let* ((can-move (nnimap-capability "MOVE"))
932 (command (if can-move 933 (command (if can-move
933 "UID MOVE %d %S" 934 "UID MOVE %d %S"
934 "UID COPY %d %S")) 935 "UID COPY %d %S"))
935 (result (nnimap-command command article 936 (result (nnimap-command
936 (utf7-encode internal-move-group t)))) 937 command article
938 (utf7-encode internal-move-group t))))
937 (when (and (car result) (not can-move)) 939 (when (and (car result) (not can-move))
938 (nnimap-delete-article article)) 940 (nnimap-delete-article article))
939 (cons internal-move-group 941 (cons internal-move-group
@@ -942,11 +944,10 @@ textual parts.")
942 internal-move-group server message-id 944 internal-move-group server message-id
943 nnimap-request-articles-find-limit))))) 945 nnimap-request-articles-find-limit)))))
944 ;; Move the article to a different method. 946 ;; Move the article to a different method.
945 (let ((result (eval accept-form))) 947 (when-let ((result (eval accept-form)))
946 (when result 948 (nnimap-change-group group server)
947 (nnimap-change-group group server) 949 (nnimap-delete-article article)
948 (nnimap-delete-article article) 950 result))))))
949 result)))))))
950 951
951(deffoo nnimap-request-expire-articles (articles group &optional server force) 952(deffoo nnimap-request-expire-articles (articles group &optional server force)
952 (setq group (nnimap-decode-gnus-group group)) 953 (setq group (nnimap-decode-gnus-group group))