unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: hartzell@alerce.com
Cc: 36266@debbugs.gnu.org
Subject: bug#36266: 26.1; Problems with sieve-manage
Date: Thu, 25 Jul 2019 11:28:08 -0700	[thread overview]
Message-ID: <8736iuezpj.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <23815.51315.484730.915010@alice.local> (hartzell's message of "Mon, 17 Jun 2019 10:05:55 -0700")

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

hartzell@alerce.com writes:

> I asked for help with these on the `help-gnu-emacs` mailing list and
> Eric suggested that I also report them as bugs so that they don't get
> lost.  Here is the email thread:
>
> https://lists.gnu.org/archive/html/help-gnu-emacs/2019-06/msg00185.html
>
> g.
>
> ---
>
> I've been trying to use sieve-manage in GNU Emacs 26.1 on a Mac with
> dovecot-pigeonhole-0.5.6 on a FreeBSD 12 system.
>
> I've run into a few problems:
>
> 1. I can start sieve-manage, use the `f` key with the `<new script>`
>    line highlighted, edit a script, and use `C-c C-l` to upload it to
>    the server.
>
>    The problem is that the script, on the server, is named `<new
>    script>.sieve`, which is awkward.
>
>    But worse, if/when I restart sieve-manage it offers me two choices,
>    one labeled `<new script>` (which is the button to create a new
>    script) and one which is the existing script which was saved under
>    that same name.
>
>    I've tried renaming the buffer, but the code has a preference for
>    `sieve-buffer-script-name`.
>
>    Is there some way to rename the buffer?

I think it's a little weird that `sieve-new-script' (which defaults to
"<new script>" is a configurable option at all. IMO, there are two
separate concerns: some placeholder text for the button that's used to
create a new script (there's no reason to make this configurable), and
the default name for a newly-created script (the new name should be
prompted for on a script-by-script basis, and there's no reason to have
a default at all).

I've attached a simple diff which checks if your new script has the same
name as `sieve-new-script' and prompts you to rename it. But I think a
more sensible solution would be to remove the `sieve-new-script' option
altogether. Then hard-code the "new script" button text, and always
prompt for a name for a new script.

> 2. If I create a script directly on the server (e.g. `ape.sieve`) then
>    start sieve-manage, I'm offered the chance to edit it.  If I move
>    the highlighting to `ape.sieve` then use `f` to edit it, emacs
>    becomes unresponsive.  I can break out of it with C-g.
>
>    But, I've had it work once or twice.  I haven't figure out how to
>    repeat it.
>
>    If I look in `*sieve-manage-log*`, I can see that emacs has sent
>    `GETSCRIPT "ape"` and I can see the text of the script in the
>    response.
>
>    I'm not sure what it's waiting for.

I believe this is something to do with an infloop in
`accept-process-output' that was previously preventing me from logging
in to my sieve servers at all. This is just a guess, because it matches
pretty closely behavior that I saw discussed in another bug report here.
But this has since been cleared up for me in Emacs master, so maybe if
you build a new Emacs it will start working? We hope?

Eric


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-sieve-script-name.diff --]
[-- Type: text/x-patch, Size: 688 bytes --]

diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el
index 3337998bed..4485b8c730 100644
--- a/lisp/net/sieve.el
+++ b/lisp/net/sieve.el
@@ -210,7 +210,11 @@ sieve-edit-script
 	      (set-buffer-modified-p nil)
 	    (error "Sieve download failed: %s" err)))
       (switch-to-buffer (get-buffer-create "template.siv"))
-      (insert sieve-template))
+      (insert sieve-template)
+      (setq name (read-string "Name for new script: "))
+      (when (string-match "\\.sieve\\'" name)
+        ;; The server will append .sieve to the script name.
+        (setq name (replace-match "" t t name))))
     (sieve-mode)
     (setq sieve-buffer-script-name name)
     (goto-char (point-min))

  parent reply	other threads:[~2019-07-25 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 17:05 bug#36266: 26.1; Problems with sieve-manage hartzell
2019-07-10 19:34 ` Noam Postavsky
2019-07-25 18:28 ` Eric Abrahamsen [this message]
2019-08-11 15:11   ` Eric Abrahamsen
2019-08-11 16: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=8736iuezpj.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=36266@debbugs.gnu.org \
    --cc=hartzell@alerce.com \
    /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).