From: Eric Abrahamsen Date: Mon, 8 Jul 2019 17:53:07 +0000 (-0700) Subject: Improvements to sieve script usability X-Git-Tag: emacs-27.0.90~2054 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8961c6b9726d5c77c0271f2fce18ffac164cbfbb;p=emacs.git Improvements to sieve script usability * lisp/net/sieve-mode.el (sieve-mode-menu): Add `sieve-upload-and-kill' to the mode menu. * lisp/net/sieve.el (sieve-manage-mode-menu): Add `sieve-manage-quit' to the mode menu. (sieve-help): Mention quitting in mode help. (sieve-manage-mode): Directly derive from special-mode. (sieve-edit-script): Start off with unmodified buffer. (sieve-upload): Set buffer unmodified after successful upload. Changes are aimed at 1) increasing discoverability of commands and 2) using buffer modification to help users understand what's happening. --- diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el index d237c1e7c42..55fea160f64 100644 --- a/lisp/net/sieve.el +++ b/lisp/net/sieve.el @@ -137,16 +137,15 @@ require \"fileinto\"; '("Manage Sieve" ["Edit script" sieve-edit-script t] ["Activate script" sieve-activate t] - ["Deactivate script" sieve-deactivate t])) + ["Deactivate script" sieve-deactivate t] + ["Quit and close connection" sieve-manage-quit t])) -(define-derived-mode sieve-manage-mode fundamental-mode "Sieve-manage" +(define-derived-mode sieve-manage-mode special-mode "Sieve-manage" "Mode used for sieve script management." (buffer-disable-undo (current-buffer)) (setq truncate-lines t) (easy-menu-add sieve-manage-mode-menu sieve-manage-mode-map)) -(put 'sieve-manage-mode 'mode-class 'special) - ;; Commands used in sieve-manage mode: (defun sieve-manage-quit () @@ -215,6 +214,7 @@ require \"fileinto\"; (sieve-mode) (setq sieve-buffer-script-name name) (goto-char (point-min)) + (set-buffer-modified-p nil) (message (substitute-command-keys "Press \\[sieve-upload] to upload script to server.")))) @@ -257,7 +257,7 @@ Used to bracket operations which move point in the sieve-buffer." ;; would need minor-mode for log-edit-mode (describe-function 'sieve-mode) (message "%s" (substitute-command-keys - "`\\[sieve-edit-script]':edit `\\[sieve-activate]':activate `\\[sieve-deactivate]':deactivate `\\[sieve-remove]':remove")))) + "`\\[sieve-edit-script]':edit `\\[sieve-activate]':activate `\\[sieve-deactivate]':deactivate `\\[sieve-remove]':remove `\\[sieve-manage-quit]':quit")))) ;; Create buffer: @@ -355,8 +355,10 @@ Used to bracket operations which move point in the sieve-buffer." (or name sieve-buffer-script-name script-name) script sieve-manage-buffer)) (if (sieve-manage-ok-p err) - (message (substitute-command-keys - "Sieve upload done. Use \\[sieve-manage] to manage scripts.")) + (progn + (message (substitute-command-keys + "Sieve upload done. Use \\[sieve-manage] to manage scripts.")) + (set-buffer-modified-p nil)) (message "Sieve upload failed: %s" (nth 2 err))))))) ;;;###autoload