#1112050 mutt: Emacs server interaction problems

Package:
mutt
Source:
mutt
Description:
text-based mailreader supporting MIME, GPG, PGP and threading
Submitter:
Alexandre Lymberopoulos
Date:
2025-08-25 18:37:01 UTC
Severity:
normal
#1112050#5
Date:
2025-08-25 17:19:44 UTC
From:
To:
Dear Maintainer,

Using mutt with emacs as editor is my choice for the last decades. But
now, I experienced some problems:

1 - emacs started to complain after editing a message and closing it
with C-x C-c. The message was: "no server editing buffer exist". All I
had to do was to save the buffer (C-x C-s) and kill it (C-c k), so I got
the standart screen before sendind the e-mail.

2 - looking for solutions, I found something about emacs server and gave
it a try (is this necessary or not? if not, how to get this fixed this
way?). First I changed my editor variable in .muttrc from

set editor="emacs %s -f post-mode"

to

set editor = "emacsclient -a ' ' -t -n"

Then added the following lines to .emacs:

;; ~/.emacs - Server Configuration
;; Enable server mode for daemon functionality
(require 'server)

;; Start the server only if we are in daemon mode.
;; This is the safest, most correct way.
(when (daemonp)
  (server-mode))

Enabled emacs.service in systemctl:

systemctl --user enable emacs.service

Rebooted to simulate real use in the future. When I try to compose or
answer an email I get the following from emacs (even if it is the first
thing I do):

The current server still has clients; delete them? (yes or no)

If I answer no, emacs opens regularly and I can edit and close the
client (learned that it must be done with C-x #, no C-x C-c). If the
answer is yes it closes emacs, go back to mutt screen saying "Aborted
unmodified message."

I'm clueless here, but I can provide any further information to fix
this. Running emacs 30.1 here, installed by emacs-gtk package from stock
Debian 13.

Best, Alexandre

#1112050#10
Date:
2025-08-25 18:35:19 UTC
From:
To:
Not sure if this helps, but when emacs is open the output of ps aux|
grep -i emacs is the following:

ps aux|grep -i emacs
lymber      1204  0.2  0.9 170480 76840 ?        Ss   15:03   0:04 /usr/bin/emacs --fg-daemon
lymber     12723  0.0  0.0   2680  1648 pts/2    S+   15:32   0:00 sh -c emacsclient -a 'emacs' -t '/home/lymber/tmp/mutt-macbookpro-1000-6986-10257019837793114056'
lymber     12724  0.0  0.0   2580  1404 pts/2    S+   15:32   0:00 emacsclient -a emacs -t /home/lymber/tmp/mutt-macbookpro-1000-6986-10257019837793114056
lymber     12742  0.0  0.0   6596  2268 pts/3    S+   15:32   0:00 grep -i emacs

The both emacsclient instances on the same file is something expected?

Best, Alexandre