]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix sieve-upload when sieve-buffer is nil
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Sun, 30 Sep 2018 08:40:35 +0000 (17:40 +0900)
committerEli Zaretskii <eliz@gnu.org>
Sat, 13 Oct 2018 08:51:06 +0000 (11:51 +0300)
* lisp/net/sieve.el (sieve-upload): Don't rely on sieve-buffer being
non-nil.  (Bug#32880)

Copyright-paperwork-exempt: yes

lisp/net/sieve.el

index 1f80ccc1e05277d4bd1e7cf5b06a9475a0cc1166..ef7bb5c025cfae269be08af135a9ac6dd425276a 100644 (file)
@@ -345,11 +345,14 @@ Used to bracket operations which move point in the sieve-buffer."
 ;;;###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