unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 25764@debbugs.gnu.org
Subject: bug#25764: 26.0.50; Make some usability improvements to sieve-script management
Date: Mon, 08 Jul 2019 21:42:51 +0100	[thread overview]
Message-ID: <87o924l0l0.fsf@tcd.ie> (raw)
In-Reply-To: <87vas9rg8q.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 16 Feb 2017 13:13:41 -0800")

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

I don't use sieve scripts, but I noticed a minor nit in your patch:

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> @@ -215,6 +214,7 @@ sieve-edit-script
>      (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."))))

[...]

> @@ -350,11 +350,13 @@ sieve-upload
>        (with-current-buffer (get-buffer sieve-buffer)
>  	(setq err (sieve-manage-putscript
>                     (or name sieve-buffer-script-name (buffer-name))
> -                   script sieve-manage-buffer))
> -	(if (sieve-manage-ok-p err)
> -	    (message (substitute-command-keys
> -		      "Sieve upload done.  Use \\[sieve-manage] to manage scripts."))
> -	  (message "Sieve upload failed: %s" (nth 2 err)))))))
> +                   script sieve-manage-buffer)))
> +      (if (sieve-manage-ok-p err)
> +          (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))))))

In both hunks, 'message' is given an arbitrary string as its first
argument.  Any objections to the following cleanup of sieve.el text
formatting code?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Tidy-up-sieve.el-text-formatting.patch --]
[-- Type: text/x-diff, Size: 4323 bytes --]

From 77e1def846770526f50fceca41e269ec9be5080b Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Mon, 8 Jul 2019 21:05:14 +0100
Subject: [PATCH] Tidy up sieve.el text formatting

* lisp/net/sieve.el (sieve-edit-script, sieve-upload): Do not pass
arbitrary string as first argument to 'message' (bug#25764).
(sieve-help): Split long string across multiple lines.
(sieve-refresh-scriptlist): Use ngettext.  Fix grammar.
---
 lisp/net/sieve.el | 50 +++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el
index 55fea160f6..3337998bed 100644
--- a/lisp/net/sieve.el
+++ b/lisp/net/sieve.el
@@ -215,9 +215,8 @@ sieve-edit-script
     (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."))))
+    (message "Press %s to upload script to server."
+             (substitute-command-keys "\\[sieve-upload]"))))
 
 (defmacro sieve-change-region (&rest body)
   "Turns off sieve-region before executing BODY, then re-enables it after.
@@ -256,8 +255,10 @@ sieve-help
   (if (eq last-command 'sieve-help)
       ;; 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-manage-quit]':quit"))))
+    (message "%s" (substitute-command-keys "\
+`\\[sieve-edit-script]':edit `\\[sieve-activate]':activate \
+`\\[sieve-deactivate]':deactivate `\\[sieve-remove]':remove \
+`\\[sieve-manage-quit]':quit"))))
 
 ;; Create buffer:
 
@@ -312,20 +313,20 @@ sieve-refresh-scriptlist
     (delete-region (or sieve-buffer-header-end (point-max)) (point-max))
     (goto-char (point-max))
     ;; get list of script names and print them
-    (let ((scripts (sieve-manage-listscripts sieve-manage-buffer)))
-      (if (null scripts)
-	  (insert
-           (substitute-command-keys
-            (format
-             "No scripts on server, press \\[sieve-edit-script] on %s to create a new script.\n"
-             sieve-new-script)))
-	(insert
-         (substitute-command-keys
-          (format (concat "%d script%s on server, press \\[sieve-edit-script] on a script "
-                          "name edits it, or\npress \\[sieve-edit-script] on %s to create "
-                          "a new script.\n") (length scripts)
-                          (if (eq (length scripts) 1) "" "s")
-                          sieve-new-script))))
+    (let* ((scripts (sieve-manage-listscripts sieve-manage-buffer))
+           (count (length scripts))
+           (keys (substitute-command-keys "\\[sieve-edit-script]")))
+      (insert
+       (if (null scripts)
+           (format
+            "No scripts on server, press %s on %s to create a new script.\n"
+            keys sieve-new-script)
+         (format (concat (ngettext "%d script on server"
+                                   "%d scripts on server"
+                                   count)
+                         ", press %s on a script name to edit it, or"
+                         "\npress %s on %s to create a new script.\n")
+                 count keys keys sieve-new-script)))
       (save-excursion
 	(sieve-insert-scripts (list sieve-new-script))
 	(sieve-insert-scripts scripts)))
@@ -354,12 +355,11 @@ sieve-upload
 	(setq err (sieve-manage-putscript
                    (or name sieve-buffer-script-name script-name)
                    script sieve-manage-buffer))
-	(if (sieve-manage-ok-p err)
-            (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)))))))
+        (if (not (sieve-manage-ok-p err))
+            (message "Sieve upload failed: %s" (nth 2 err))
+          (message "Sieve upload done.  Use %s to manage scripts."
+                   (substitute-command-keys "\\[sieve-manage]"))
+          (set-buffer-modified-p nil))))))
 
 ;;;###autoload
 (defun sieve-upload-and-bury (&optional name)
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


Thanks,

-- 
Basil

  parent reply	other threads:[~2019-07-08 20:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 21:13 bug#25764: 26.0.50; Make some usability improvements to sieve-script management Eric Abrahamsen
2019-06-24 23:03 ` Lars Ingebrigtsen
2019-07-08 17:55   ` Eric Abrahamsen
2019-07-08 20:42 ` Basil L. Contovounesios [this message]
2019-07-08 22:09   ` Lars Ingebrigtsen
2019-07-08 23:51   ` Eric Abrahamsen
2019-07-08 23:55     ` Lars Ingebrigtsen
2019-07-09  0:12       ` Eric Abrahamsen
2019-07-09  0:50         ` Basil L. Contovounesios
2019-07-09  1:06           ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o924l0l0.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=25764@debbugs.gnu.org \
    --cc=eric@ericabrahamsen.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).