Subject: bug#32880: 27.0.50; sieve-upload doesn't work if no sieve-buffer

From: OGAWA Hirofumi <[email-masked]>
Date: Sun, 30 Sep 2018 17:40:35 +0900

Found another issue while testing. `buffer-name' is used in `sieve-buffer'
context too.

This adds the fix additionally by setting `script-name' before switching
to `sieve-buffer'.

---

 lisp/net/sieve.el |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff -puN lisp/net/sieve.el~sieve-fixes lisp/net/sieve.el
--- emacs/lisp/net/sieve.el~sieve-fixes	2018-09-30 07:33:22.576515187 +0900
+++ emacs-hirofumi/lisp/net/sieve.el	2018-09-30 17:30:39.718548393 +0900
@@ -345,11 +345,14 @@ Used to bracket operations which move po
 ;;;###autoload
 (defun sieve-upload (&optional name)
   (interactive)
-  (when (or (get-buffer sieve-buffer) (call-interactively 'sieve-manage))
-    (let ((script (buffer-string)) err)
+  (when (or (get-buffer sieve-buffer)
+            (save-current-buffer (call-interactively 'sieve-manage)))
+    (let ((script (buffer-string))
+          (script-name (file-name-sans-extension (buffer-name)))
+          err)
       (with-current-buffer (get-buffer sieve-buffer)
 	(setq err (sieve-manage-putscript
-                   (or name sieve-buffer-script-name (buffer-name))
+                   (or name sieve-buffer-script-name script-name)
                    script sieve-manage-buffer))
 	(if (sieve-manage-ok-p err)
 	    (message (substitute-command-keys
_
-- 
OGAWA Hirofumi <[email-masked]>