magit / with-editor

Use the Emacsclient as the $EDITOR of child processes
http://magit.vc/manual/with-editor
GNU General Public License v3.0
185 stars 45 forks source link

GitError! There was a problem with the editor '/usr/bin/emacsclient.emacs --socket-name=/tmp/emacs1000/server'. #69

Closed thraxil closed 4 years ago

thraxil commented 4 years ago

Attempting to commit with magit generates the error: GitError! There was a problem with the editor '/usr/bin/emacsclient.emacs --socket-name=/tmp/emacs1000/server'. [Type '$' for details]

Hitting $ gives me:

hint: Waiting for your editor to close the file...
Waiting for Emacs...
*ERROR*: ‘recenter’ing a window that does not display current-buffer.
error: There was a problem with the editor '/usr/bin/emacsclient.emacs --socket-name=/tmp/emacs1000/server'.
Please supply the message using either -m or -F option.

M-x magit-version:

Magit 20191227.1438, Git 2.20.1, Emacs 26.3, gnu/linux

This is on Ubuntu 19.10.

output of M-x with-editor-debug:

 exec-path: (/home/anders/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /home/anders/code/go/bin /home/anders/code/go/go/bin /home/anders/work/google-cloud-sdk/bin /usr/lib/emacs/26.3/x86_64-linux-gnu)
  with-editor-emacsclient-path:
    /home/anders/bin (t)
    /usr/local/sbin (t)
    /usr/local/bin (t)
    /usr/sbin (t)
    /usr/bin (t)
      /usr/bin/emacsclient (26.3)
      /usr/bin/emacsclient.emacs (26.3)
    /sbin (usr/sbin)
    /bin (usr/bin)
      /bin/emacsclient (26.3)
      /bin/emacsclient.emacs (26.3)
    /usr/games (t)
    /usr/local/games (t)
    /snap/bin (t)
    /home/anders/code/go/bin (t)
    /home/anders/code/go/go/bin (t)
    /home/anders/work/google-cloud-sdk/bin (t)
    /usr/lib/emacs/26.3/x86_64-linux-gnu (t)
tarsius commented 4 years ago

The error ‘recenter’ing a window that does not display current-buffer. is being raised by some emacs-lisp code. I don't think that code is part of Emacs or Magit. Please search your additional installed packages for the phrase "a window that does not display current-buffer" using for example rgrep on the elpa directory.

npostavs commented 4 years ago

That error is from Emacs' recenter C code: https://github.com/emacs-mirror/emacs/blob/emacs-26.3/src/window.c#L5927-L5931

thraxil commented 4 years ago

Thanks. My init.el has the following:

; keep point centered vertically
(add-hook 'post-command-hook
          (lambda ()
            (unless (eq major-mode 'eshell-mode)
              (recenter '("don't redraw")))))

commenting that out makes magit work. However, the vertical centering isn't something that I want to get rid of. I've used this exact config for years and it only recently broke when I upgraded magit. I've tried adding an exclusion for magit-mode like I already have for eshell-mode but that doesn't help. I'm not sure how to figure out which mode/buffer is triggering the problem so that I could exclude it and still use the vertical centering everywhere else.

tarsius commented 4 years ago

You could translate the error message into code that detects that situation, something like:

(eq (current-buffer) (window-buffer (selected-window))