Using Magit 20161227.1853, Git 2.11.0, Emacs 25.1.1, darwin
When trying to commit from magit, it hangs and doesn't prompt the commit message editing buffer. killing it and trying again immediately prompts said buffer, but then C-c C-c does nothing...
Could you please give a bit more information? For example what is the "it" that hangs? Emacs? And what's the "it" that you kill? The commit message buffer? (I though Emacs did hang and the commit message buffer didn't show up, so how did you manage to do that?)
Does the buffer show up but "hang"? If not, can you find the buffer in the list of buffers and manually switch to it?
Did you try to reproduce this with the shell command given by magit-emacs-Q-command?
For now a restart of Emacs solved it, but it happens from time to time. I'll reopen with additional details when I encounter them...
Thanks for now...
Ok, this happens again from time to time.
I'm getting this when pressing c in the status window. Then nothing changes in the window, and magit prints in the *Messages* buffer:
Type C-c C-c to finish, or C-c C-k to cancel
Waiting and waiting, I eventually give up and press C-g, and the output becomes GitError with the message:
There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/hy/gry5dnsj6zlbrclcg160nc800000gn/T/emacs501/server'. ... [Hit $ to see buffer *magit-process: backslash for details] [2 times]
Please answer this question:
If not, can you find the buffer in the list of buffers and manually switch to it?
(And the others too, please.)
@tarsius oops, sorry
I can only find a buffer named *magit-process: ..., and it contains the following:
0 git … add -u .
1 git … commit --
Waiting for Emacs...
*ERROR*: Quit
error: There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/hy/gry5dnsj6zlbrclcg160nc800000gn/T/emacs501/server'.
Please supply the message using either -m or -F option.
So no buffer named COMMIT_EDITMSG.
@tarsius after this happens, and I try to commit again, a buffer called COMMIT_EDITMSG is immediately opened, but C-c C-c does nothing in it
*ERROR*: Quit is printed by the emacsclient upon receiving the message -error Quit from server.el, which probably means that something goes wrong in server-execute. Do M-x toggle-debug-error and M-x toggle-debug-on-signal in a new Emacs instance before attempting to to commit, hopefully you will get a backtrace. Also try whether using emacsclient manually causes the same error.
Do M-x toggle-debug-error and M-x toggle-debug-on-signal
That should be M-x toggle-debug-on-error and M-: (setq debug-on-signal t).
@tarsius you mean toggle-debug-on-quit right? Couldn't find toggle-debug-on-signal...
@npostavs got it. thanks
Now I'm getting:
Debugger entered--Lisp error: (void-variable with-editor-emacsclient-executable)
default-toplevel-value(with-editor-emacsclient-executable)
custom-initialize-reset(with-editor-emacsclient-executable (funcall (function #[0 "\300 \207" [with-editor-locate-emacsclient] 1])))
custom-declare-variable(with-editor-emacsclient-executable (funcall (function #[0 "\300 \207" [with-editor-locate-emacsclient] 1])) "The Emacsclient executable used by the `with-editor' macro." :group with-editor :type (choice (string :tag "Executable") (const :tag "Don't use Emacsclient" nil)))
byte-code("\300\301\302\303\304DD\305\306\307\310\311&\210\300\312\302\303\313DD\314\306\307\310\315&\210\300\316\302\303\317DD\320\306\307\310\321&\210\322\316\323\324#\210\300\325\302\303\326DD\327\306\307\310\321&\210\322\325\323\324#\210\300\330\302\303\331DD\332\306\307\310\333&\207" [custom-declare-variable with-editor-emacsclient-executable funcall function #[0 "\300 \207" [with-editor-locate-emacsclient] 1] "The Emacsclient executable used by the `with-editor' macro." :group with-editor :type (choice (string :tag "Executable") (const :tag "Don't use Emacsclient" nil)) with-editor-sleeping-editor #[0 "\300\207" ["sh -c 'echo \"WITH-EDITOR: $$ OPEN $0\"; sleep 604800 & sleep=$!; trap \"kill $sleep; exit 0\" USR1; trap \"kill $sleep; exit 1\" USR2; wait $sleep'"] 1 "sh -c 'echo \"WITH-EDITOR: $$ OPEN $0\"; sleep 604800 & sleep=$!; trap \"kill $sleep; exit 0\" USR1; trap \"kill $sleep; exit 1\" USR2; wait $sleep'"] "The sleeping editor, used when the Emacsclient cannot be used.\n\nThis fallback is used for asynchronous process started inside the\nmacro `with-editor', when the process runs on a remote machine or\nfor local processes when `with-editor-emacsclient-executable' is\nnil (i.e. when no suitable Emacsclient was found, or the user\ndecided not to use it).\n\nWhere the latter uses a socket to communicate with Emacs' server,\nthis substitute prints edit requests to its standard output on\nwhich a process filter listens for such requests. As such it is\nnot a complete substitute for a proper Emacsclient, it can only\nbe used as $EDITOR of child process of the current Emacs instance.\n\nSome shells do not execute traps immediately when waiting for a\nchild process, but by default we do use such a blocking child\nprocess.\n\nIf you use such a shell (e.g. `csh' on FreeBSD, but not Debian),\nthen you have to edit this option. You can either replace \"sh\"\nwith \"bash\" (and install that), or you can use the older, less\nperformant implementation:\n\n \"sh -c '\\\n echo \\\"WITH-EDITOR: $$ OPEN $0\\\"; \\\n trap \\\"exit 0\\\" USR1; \\\n trap \\\"exit 1\" USR2; \\\n while true; do sleep 1; done'\"\n\nNote that this leads to a delay of up to a second. The delay can\nbe shortened by replacing \"sleep 1\" with \"sleep 0.01\", or if your\nimplementation does not support floats, then by using `nanosleep'\ninstead." string with-editor-finish-query-functions #[0 "\300\207" [nil] 1] "List of functions called to query before finishing session.\n\nThe buffer in question is current while the functions are called.\nIf any of them returns nil, then the session is not finished and\nthe buffer is not killed. The user should then fix the issue and\ntry again. The functions are called with one argument. If it is\nnon-nil then that indicates that the user used a prefix argument\nto force finishing the session despite issues. Functions should\nusually honor that and return non-nil." hook put permanent-local t with-editor-cancel-query-functions #[0 "\300\207" [nil] 1] "List of functions called to query before canceling session.\n\nThe buffer in question is current while the functions are called.\nIf any of them returns nil, then the session is not canceled and\nthe buffer is not killed. The user should then fix the issue and\ntry again. The functions are called with one argument. If it is\nnon-nil then that indicates that the user used a prefix argument\nto force canceling the session despite issues. Functions should\nusually honor that and return non-nil." with-editor-mode-lighter #[0 "\300\207" [" WE"] 1 " WE"] "The mode-line lighter of the With-Editor mode." (choice (const :tag "No lighter" "") string)] 8)
require(with-editor)
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\210\300\313\314\315#\207" [require cl-lib dash with-editor git-commit magit-core magit-diff magit-apply magit-log magit-repos format-spec package nil t] 4)
require(magit)
byte-code("\301\302!\210\303\304\305\306\307\310\311\312&\210\313\314\315\316\317DD\320\311\304\321\322&\210\313\323\315\316\324DD\325\326\327\311\304\321\322\330\331&
\210\313\332\315\316\333DD\334\326\335\311\304\321\322& \210\313\336\315\316\337DD\340\326\341\311\304\321\342& \210\313\343\315\316\344DD\345\326\346\311\304\321\342& \210\313\347\315\316\350DD\351\326\352\311\304\311\353\321\354\355\356\357\360\361\362\363\"&\207" [magit-log-margin--custom-type require magit custom-declare-group magit-status nil "Inspect and manipulate Git repositories." :link (info-link "(magit)Status Buffer") :group magit-modes custom-declare-variable magit-status-mode-hook funcall function #[0 "\300\207" [nil] 1] "Hook run after entering Magit-Status mode." :type hook magit-status-headers-hook #[0 "\300\207" [(magit-insert-error-header magit-insert-diff-filter-header magit-insert-head-branch-header magit-insert-upstream-branch-header magit-insert-push-branch-header magit-insert-tags-header)] 1] "Hook run to insert headers into the status buffer.\n\nThis hook is run by `magit-insert-status-headers', which in turn\nhas to be a member of `magit-status-sections-hook' to be used at\nall." :package-version (magit . "2.1.0") :options (magit-insert-error-header magit-insert-diff-filter-header magit-insert-repo-header magit-insert-remote-header magit-insert-head-branch-header magit-insert-upstream-branch-header magit-insert-push-branch-header magit-insert-tags-header) magit-status-sections-hook #[0 "\300\207" [(magit-insert-status-headers magit-insert-merge-log magit-insert-rebase-sequence magit-insert-am-sequence magit-insert-sequencer-sequence magit-insert-bisect-output magit-insert-bisect-rest magit-insert-bisect-log magit-insert-untracked-files magit-insert-unstaged-changes magit-insert-staged-changes magit-insert-stashes magit-insert-unpulled-from-upstream magit-insert-unpulled-from-pushremote magit-insert-unpushed-to-upstream magit-insert-unpushed-to-pushremote)] 1] "Hook run to insert sections into a status buffer." (magit . "2.4.0") magit-status-expand-stashes #[0 "\300\207" [t] 1] "Whether the list of stashes is expanded initially." (magit . "2.3.0") boolean magit-status-show-hashes-in-headers #[0 "\300\207" [nil] 1] "Whether headers in the status buffer show hashes.\nThe functions which respect this option are\n`magit-insert-head-branch-header',\n`magit-insert-upstream-branch-header', and\n`magit-insert-push-branch-header'." (magit . "2.4.0") magit-status-margin #[0 "\301A@\302\301\3038\257\207" [magit-log-margin nil magit-log-margin-width 4] 6] "Format of the margin in `magit-status-mode' buffers.\n\nThe value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH).\n\nIf INIT is non-nil, then the margin is shown initially.\nSTYLE controls how to format the committer date. It can be one\n of `age' (to show the age of the commit), `age-abbreviated' (to\n abbreviate the time unit to a character), or a string (suitable\n for `format-time-string') to show the actual date.\nWIDTH controls the width of the margin. This exists for forward\n compatibility and currently the value should not be changed.\nAUTHOR controls whether the name of the author is also shown by\n default.\nAUTHOR-WIDTH has to be an integer. When the name of the author\n is shown, then this specifies how much space is used to do so." (magit . "2.9.0") magit-margin :initialize magit-custom-initialize-reset :set-after (magit-log-margin) :set apply-partially ...] 20)
autoload-do-load((autoload "magit-status" "Show the status of the current Git repository in a buffer.\nWith a prefix argument prompt for a repository to be shown.\nWith two prefix arguments prompt for an arbitrary directory.\nIf that directory isn't the root of an existing repository\nthen offer to initialize it as a new repository.\n\n(fn &optional DIRECTORY)" t nil) magit-status)
command-execute(magit-status)
Can't even open magit-status... I will set the variables after magit-status is loaded...
Ok, getting this when trying to commit:
Debugger entered--Lisp error: (error "git exited with status 1")
signal(error ("git exited with status 1"))
error("%s exited with status %s" "git" 1)
process-lines("git" "config" "core.commentchar")
git-commit-setup-font-lock()
git-commit-setup-font-lock-in-buffer()
run-hooks(after-change-major-mode-hook)
run-mode-hooks()
fundamental-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer COMMIT_EDITMSG> "~/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG" nil nil "~/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG" (65873996 16777220))
find-file-noselect("/Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG")
#[770 "\305\306r\211\203\205 \211@ \206 \n\211@\307!\310\311\"\210\211\204, \312\313!\210\314!q\210\202Z \211q\210\312\313!\210\315!\203G \316!\204T \317\305\306\"\210\202T \320\321\322Q!\203T \323!\210
\204Z \305\324A!\210\312\325!\210\312\326!\210)\266\204y \327\330\331\306\305$\210
BpB\262A\266\202\202 \210)\204\227 \332\333\334\333\"\244#\210)\207" [last-nonmenu-event server-raise-frame minibuffer-auto-raise server-buffer-clients server-existing-buffer t nil get-file-buffer add-to-history file-name-history run-hooks pre-command-hook find-file-noselect file-exists-p verify-visited-file-modtime revert-buffer y-or-n-p "File no longer exists: " ", write buffer to file? " write-file server-goto-line-column server-visit-hook post-command-hook add-hook kill-buffer-hook server-kill-buffer process-put buffers process-get] 13 ("/Applications/Emacs.app/Contents/Resources/lisp/server.elc" . 36221)]((("/Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG")) #<process server <1>> nil)
apply(#[770 "\305\306r\211\203\205 \211@ \206 \n\211@\307!\310\311\"\210\211\204, \312\313!\210\314!q\210\202Z \211q\210\312\313!\210\315!\203G \316!\204T \317\305\306\"\210\202T \320\321\322Q!\203T \323!\210
\204Z \305\324A!\210\312\325!\210\312\326!\210)\266\204y \327\330\331\306\305$\210
BpB\262A\266\202\202 \210)\204\227 \332\333\334\333\"\244#\210)\207" [last-nonmenu-event server-raise-frame minibuffer-auto-raise server-buffer-clients server-existing-buffer t nil get-file-buffer add-to-history file-name-history run-hooks pre-command-hook find-file-noselect file-exists-p verify-visited-file-modtime revert-buffer y-or-n-p "File no longer exists: " ", write buffer to file? " write-file server-goto-line-column server-visit-hook post-command-hook add-hook kill-buffer-hook server-kill-buffer process-put buffers process-get] 13 ("/Applications/Emacs.app/Contents/Resources/lisp/server.elc" . 36221)] ((("/Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG")) #<process server <1>> nil))
server-visit-files((("/Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG")) #<process server <1>> nil)
server-execute(#<process server <1>> (("/Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG")) nil nil nil nil nil)
#[0 "r\310
!q\210\305\242\203 \311\305\242!\203 \305\242\202 \f
\f\312\300\307\242\301\242\304\242\303\242\302\242\306\242&*\207" [#<process server <1>> (nil) (nil) (nil) (nil) ("/Users/rotemy/workspace/src/work/qasetup_service/") (nil) ((("/Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG"))) get-buffer-create file-directory-p server-execute server-buffer default-directory] 8]()
server-execute-continuation(#<process server <1>>)
server-process-filter(#<process server <1>> "-dir /Users/rotemy/workspace/src/work/qasetup_service/ -current-frame -tty /dev/ttys009 dumb -file /Users/rotemy/workspace/src/work/qasetup_service/.git/COMMIT_EDITMSG \n")
Hm, that part of the code is wrapped with ignore-errors, which expands to condition-case, whose doc-string contains " condition-case supresses the debugger". So my understanding is this should not actually happen. Let's assume this is not the cause and there's another issue elsewhere which is shadowed by this one. To do so also (remove-hook 'git-commit-setup-hook 'git-commit-setup-font-lock).
Oh, you should probably only set debug-on-signal just before doing the commit. Otherwise you get a bunch irrelevant backtraces, that would usually be caught.
Ok, getting this when trying to commit:
Just press c to continue after that error.
Ok, will leave this open until it reproduces. Thanks in the mean time!
It happened again, but it doesn't seem like debug-on-signal did anything.... Any further things I should try?
@npostavs @tarsius it seems like emacsclient is fired correctly, and the COMMIT_EDITMSG buffer is created, it just doesn't switch automatically to it and is stuck (Can't even switch buffers myself before I have to C-g it...)
is stuck (Can't even switch buffers myself before I have to C-g it...)
Hmm, it might be interesting to M-x toggle-debug-on-quit to get a backtrace from that C-g.
For some reason even turning on debug-on-quit doesn't cause a debugger to be entered on the C-g... I still get a GitError with the text:
Waiting for Emacs...
*ERROR*: Quit
error: There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/hy/gry5dnsj6zlbrclcg160nc800000gn/T/emacs501/server'.
Please supply the message using either -m or -F option.
Maybe you could try redefining server-process-filter (from server.el) to let the debugger kick in?
modified lisp/server.el
@@ -1265,7 +1265,7 @@ server-execute-continuation
(server-execute-continuation proc))))
;; condition-case
- (error (server-return-error proc err))))
+ ((debug error) (server-return-error proc err))))
+1 - I'm seeing this hanging behavior too. I can confirm that debug-on-quit does not cause the debugger to get invoked.
Also tried a different Emacs build (the Carbon fork) and behavior is the same 😞
@npostavs I tried applying your patch but it doesn't seem to cause Emacs to enter a debugger in this case... Any more ideas?
To be clear, you apply the patch, then reload the resulting function (e.g., add -l server.el to the command line when starting Emacs), then set debug-on-error to t. Does that work give you a backtrace?
I tried copying the function to scratch, applying the patch and C-x C-e-ing it...
I have both debug-on-error and debug-on-quit turned on, and still I don't get a debugger when C-g-ing it... I still see the GitError! behavior....
Does it work to M-x debug-on-entry RET git-commit-setup RET?
Yes, it seems to work (after I press c in the launched debugger)
However I don't see any exception or error then...
Can you send SIGUSR2 to Emacs when it's stuck?
Will try the next time it reproduces
SIGUSR2 causes the following traceback:
Debugger entered--entering a function:
* message("Quit emacsclient request")
server-execute(#<process server <1>> (("/Users/ry/workspace/configs/emacs/.git/COMMIT_EDITMSG")) nil nil nil nil nil)
#[0 "r\310!q\210\305\242\203 \311\305\242!\203 \305\242\202 \f\f\312\300\307\242\301\242\304\242\303\242\302\242\306\242&*\207" [#<process server <1>> (nil) (nil) (nil) (nil) ("/Users/ry/workspace/configs/emacs/") (nil) ((("/Users/ry/workspace/configs/emacs/.git/COMMIT_EDITMSG"))) get-buffer-create file-directory-p server-execute server-buffer default-directory] 8]()
server-execute-continuation(#<process server <1>>)
server-process-filter(#<process server <1>> "-dir /Users/ry/workspace/configs/emacs/ -current-frame -tty /dev/ttys007 dumb -file /Users/ry/workspace/configs/emacs/.git/COMMIT_EDITMSG \n")
Hmm, really not getting anything useful. Okay, how about some tracing, evaluate this:
(mapatoms (lambda (sym)
(when (and (fboundp sym)
(string-prefix-p "git-commit" (symbol-name sym)))
(trace-function-background sym))))
And then after it get's stuck, check the contents of the *trace-output* buffer.
@npostavs Not sure it helps, but this is what I get:
1 -> (git-commit-setup-check-buffer)
| 2 -> (git-commit-setup)
| | 3 -> (git-commit-setup-font-lock-in-buffer)
| | | 4 -> (git-commit-setup-font-lock)
| | | | 5 -> (git-commit-mode-font-lock-keywords)
| | | | | 6 -> (git-commit-summary-regexp)
| | | | | 6 <- git-commit-summary-regexp: "\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?"
| | | | | 6 -> (git-commit-summary-regexp)
| | | | | 6 <- git-commit-summary-regexp: "\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?"
| | | | 5 <- git-commit-mode-font-lock-keywords: (("^#.*" (0 (quote font-lock-comment-face))) ("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) ("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) ("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) ("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) ("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) ("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) ("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) ("\\[.+?\\]" (0 (quote git-commit-note) t)) ("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t)))
| | | 4 <- git-commit-setup-font-lock: (t (#1=("^#.*" (0 (quote font-lock-comment-face))) #2=("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) #3=("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) #4=("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) #5=("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) #6=("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) #7=("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) #8=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) #9=("\\[.+?\\]" (0 (quote git-commit-note) t)) #10=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t))) #1# #2# #3# #4# #5# #6# #7# #8# #9# #10#)
| | 3 <- git-commit-setup-font-lock-in-buffer: (t (#1=("^#.*" (0 (quote font-lock-comment-face))) #2=("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) #3=("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) #4=("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) #5=("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) #6=("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) #7=("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) #8=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) #9=("\\[.+?\\]" (0 (quote git-commit-note) t)) #10=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t))) #1# #2# #3# #4# #5# #6# #7# #8# #9# #10#)
| | 3 -> (git-commit-setup-font-lock-in-buffer)
| | | 4 -> (git-commit-setup-font-lock)
| | | | 5 -> (git-commit-mode-font-lock-keywords)
| | | | | 6 -> (git-commit-summary-regexp)
| | | | | 6 <- git-commit-summary-regexp: "\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?"
| | | | | 6 -> (git-commit-summary-regexp)
| | | | | 6 <- git-commit-summary-regexp: "\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?"
| | | | 5 <- git-commit-mode-font-lock-keywords: (("^#.*" (0 (quote font-lock-comment-face))) ("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) ("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) ("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) ("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) ("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) ("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) ("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) ("\\[.+?\\]" (0 (quote git-commit-note) t)) ("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t)))
| | | 4 <- git-commit-setup-font-lock: (t (#1=("^#.*" (0 (quote font-lock-comment-face))) #2=("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) #3=("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) #4=("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) #5=("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) #6=("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) #7=("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) #8=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) #9=("\\[.+?\\]" (0 (quote git-commit-note) t)) #10=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t))) #1# #2# #3# #4# #5# #6# #7# #8# #9# #10#)
| | 3 <- git-commit-setup-font-lock-in-buffer: (t (#1=("^#.*" (0 (quote font-lock-comment-face))) #2=("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) #3=("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) #4=("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) #5=("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) #6=("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) #7=("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) #8=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) #9=("\\[.+?\\]" (0 (quote git-commit-note) t)) #10=("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t))) #1# #2# #3# #4# #5# #6# #7# #8# #9# #10#)
| | 3 -> (git-commit-mode 1)
| | 3 <- git-commit-mode: t
| | 3 -> (git-commit-setup-font-lock)
| | | 4 -> (git-commit-mode-font-lock-keywords)
| | | | 5 -> (git-commit-summary-regexp)
| | | | 5 <- git-commit-summary-regexp: "\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?"
| | | | 5 -> (git-commit-summary-regexp)
| | | | 5 <- git-commit-summary-regexp: "\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?"
| | | 4 <- git-commit-mode-font-lock-keywords: (("^#.*" (0 (quote font-lock-comment-face))) ("^# On branch \\(.*\\)" (1 (quote git-commit-comment-branch) t)) ("^# Not currently on any branch." (1 (quote git-commit-comment-detached) t)) ("^# \\(\\(?:Change\\(?:d but not updated\\|s \\(?:not staged for commit\\|to be committed\\)\\)\\|Un\\(?:\\(?:merged path\\|tracked file\\)s\\)\\):\\)" (1 (quote git-commit-comment-heading) t)) ("^# \\(?:\\([^:
]+\\):\\s-+\\)?\\(.*\\)" (1 (quote git-commit-comment-action) t t) (2 (quote git-commit-comment-file) t)) ("^\\(\\(?:Acked-by\\|Cc\\|\\(?:Re\\(?:\\(?:port\\|view\\)ed\\)\\|S\\(?:igned-off\\|uggested\\)\\|Tested\\)-by\\):\\)\\( .*\\)" (1 (quote git-commit-known-pseudo-header)) (2 (quote git-commit-pseudo-header))) ("^[-a-zA-Z]+: [^<]+? <[^>]+>" (0 (quote git-commit-pseudo-header))) ("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (1 (quote git-commit-summary) t)) ("\\[.+?\\]" (0 (quote git-commit-note) t)) ("\\`\\(?:^\\(?:\\s-*\\|#.*\\)
\\)*\\(.\\{0,180\\}\\)\\(.*\\)\\(?:
#\\|
\\(.+\\)\\)?" (2 (quote git-commit-overlong-summary) t t) (3 (quote git-commit-nonempty-second-line) t t)))
| | 3 <- git-commit-setup-font-lock: nil
| | 3 -> (git-commit-save-message)
| | | 4 -> (git-commit-buffer-message)
| | | 4 <- git-commit-buffer-message: nil
| | 3 <- git-commit-save-message: nil
| | 3 -> (git-commit-setup-changelog-support)
| | 3 <- git-commit-setup-changelog-support: "
\\|[ ]*$\\|\\*\\|("
| | 3 -> (git-commit-turn-on-auto-fill)
| | 3 <- git-commit-turn-on-auto-fill: do-auto-fill
| | 3 -> (git-commit-propertize-diff)
| | 3 <- git-commit-propertize-diff: nil
| 2 <- git-commit-setup: nil
1 <- git-commit-setup-check-buffer: nil
Not sure it helps, but this is what I get:
Hmm, and this is after it gets stuck? I think that means it's not getting stuck in magit's code.
Earlier I told you to patch server-process-filter to let the debugger run, but looking again at your backtrace from SIGUSR2, server-execute is the one of interest.
--- i/lisp/server.el
+++ w/lisp/server.el
@@ -1317,7 +1317,7 @@ server-execute
"When done with a buffer, type \\[server-edit]")))))
(when (and frame (null tty-name))
(server-unselect-display frame)))
- ((quit error)
+ ((debug quit error)
(when (eq (car err) 'quit)
(message "Quit emacsclient request"))
(server-return-error proc err)))))
Can you try again with that and debug-on-quit enabled?
Also, does running emacsclient just by itself on other files ever get stuck like this?
@npostavs ok, made the changes and now waiting for it to reproduce...
@npostavs as for your other question, no -- I couldn't get emacsclient by itself to get stuck in the same manner
Ok, the last tip by @npostavs finally pinned it down for me - it was flyspell getting stuck on the COMMIT_EDITMSG buffer.
I changed my text-mode hook from:
(lambda ()
(flyspell-mode t))
to
(lambda ()
(unless (derived-mode-p 'git-commit-mode)
(flyspell-mode t)))
and it seems to finally work now!
Thanks a lot for the help guys!
There is, of course, the open question of why flyspell gets stuck in the first place, but I will take that to another thread.
Ah, finally!
I think derived-mode-p won't work though: it checks the major mode, while git-commit-mode is a minor mode.
@npostavs you're right. I should probably use (bound-and-true-p git-commit-mode)
@vmalloc I am seeing this as well and flyspell seems to be the cause. Have you figured out what is actually happening behind the scenes? (btw, this is on Linux w/ Emacs 25.3)
No. I just disabled it. My Emacs skills aren't good enough to figure it out
I guess...
On Thu, Sep 21, 2017 at 4:51 PM Matthias Dahl notifications@github.com
wrote:
@vmalloc https://github.com/vmalloc I am seeing this as well and
flyspell seems to be the cause. Have you figured out what is actually
happening behind the scenes?—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/magit/magit/issues/2915#issuecomment-331162173, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AABwJiF5l4F6dBSRwNmwh0E0l8XN4UxDks5skmmAgaJpZM4LYrh9
.
Ok, thanks nevertheless though. I will see if I can narrow it down and figure out what is going on behind the scenes. I will keep this issue updated once I find something. Naturally, any help is more than welcome. :-)
@vmalloc @cvillecsteele Could you please list what other Emacs packages you had installed while you were able to trigger this bug?
This is really a tough nut to crack. I already spent countless hours tracking this down and I am somewhat in doubt where it has led me thus far. With regards to flyspell, when it hangs, it always does so at this https://github.com/emacs-mirror/emacs/blob/master/lisp/textmodes/flyspell.el#L1180 location, by the way.
@BinaryKhaos I'm not sure which packages I had at the time, but I can try and reproduce when I get the chance and let you know.
@vmalloc Awesome. Thanks.
@vmalloc @cvillecsteele Ok... finally have a rather good understanding what is causing this. No need to send me the package list anymore. Thanks nevertheless. This is not a bug in a specific package but in Emacs itself and can pretty much hit any package. I will see how this can be fixed, hopefully prepare a patch and send something to this Emacs dev list when ready... and update here for reference as well, naturally. This was really though to track down...
@BinaryKhaos wow, cool! thanks for the effort! I really hope such a fix will be merged relatively soon (flyspell is pretty useful when crafting git commit messages...)
Hi,
I'm having the same issue - I'm trying to turn off flyspell-mode following the suggestion above:
(dolist (hook '(text-mode-hook))
(add-hook hook
(lambda ()
(unless (bound-and-true-p git-commit-mode)
(flyspell-mode t)))))
However flyspell-mode is still t in my COMMIT_EDITMSG window - any suggestions to turn off this?
@joonro Make sure git-commit-turn-on-flyspell is not a member of git-commit-setup-hook, remove all of your own setup that enables flyspell-mode, and then restart Emacs. Is the mode being enabled in commit buffers now?
If not, then add your code that enables flyspell-mode (in some cases) again and restart Emacs. Is the mode being enabled in commit buffers now?
Thanks for the quick reply. git-commit-turn-on-flyspell is not a member of git-commit-setup-hook. I just took out whole (dolist (hook '(text-mode-hook)) ... part and now flyspell-mode is nil in the COMMIT_EDITMSG window, so it seems the issue is the unless part is not working for some reason.
The major mode is turned on before git-commit-mode unfortunately. This probably cannot easily be changed, but maybe it would make sense to at least bind the variable git-commit-mode to t while enabling the major mode.
So it seems strange that the above code appears to do the trick for other people.
If I remember correctly there is something broken about flyspell when using an old Emacs and there is another more recent issue about that. I'll try to look into this again tomorrow.
Thank you so much! FYI, I use GNU Emacs 25.2.1 (x86_64-w64-mingw32), and Magit 20170913.1424, Git 2.14.1.windows.1, Emacs 25.2.1, windows-nt.
bind the variable git-commit-mode to t while enabling the major mode.
Done.
GNU Emacs 25.2.1
If you do email from emacs, then you should update to 25.3 for security reasons.
@tarsius The problem is with Emacs itself... and it is a race-condition of some sort and not limited to flyspell but buried in Emacs' C code. I am currently working on patches and will post them to the -dev list shortly. I just need the time to sit down and finish implementing the fixes. Right now real life (tm) intervenes unfortunately and delays things on my end... sorry for that. :-(
And sorry for being so vague/brief, I am somewhat limited in time right now. If you need/want more details, just let me know.
No problem.
I am so glad this wasn't just me... I was blaming it on the develop branch of Spacemacs. Thanks all for debugging this.
Thanks for everyone's patience. Testing the fix as we speak. Thus far, the hang can no longer be triggered at all and no ill side-effects. But I will do some more testing to be sure. Patch(es) go out later this week. I will report back once those are posted.
Thanks @BinaryKhaos!
Just posted the patches to the -dev list with a lengthy explanation. :-) Hopefully they get accepted for the 26 release as well... and in general naturally.
Sorry everyone it took me this long due to private reasons, but the fix is now in Emacs master and won't be backported to the 26.x branch, unfortunately. The patches, though, cleanly apply to 26.x and will work there just fine -- as I use that version myself. ;-)
If you run into problems specifically with that patch, please let me know. Thanks, again, for everyone's patience... and have a great weekend!
Thank you for the fix!
cc @d12frosted for emacs-plus tap.
@syl20bnr thanks for pining me here
I am adding this patch to emacs-plus in https://github.com/d12frosted/homebrew-emacs-plus/pull/78
Update the patch is in master. Whoever uses emacs-plus gets this patch automatically on --devel. Let me know if it doesn't work for you.
This issue still happens for me, many times a day. I'll type c to commit, then it Magit goes out to lunch. If I find the emacsclient callback in the system process list and kill it, and re-attempt, then sometimes it works almost instantly, sometimes I need to restart Emacs to make it work again.
I see this output from ps axwwww:
86839 s004 Ss+ 0:00.02 /Users/johnw/.nix-profile/bin/git --no-pager --literal-pathspecs -c core.preloadindex=true -c log.showSignature=false commit --
86840 s004 S+ 0:00.01 sh -c echo "WITH-EDITOR: $$ OPEN $0^_ IN $(pwd)"; sleep 604800 & sleep=$!; trap "kill $sleep; exit 0" USR1; trap "kill $sleep; exit 1" USR2; wait $sleep /Users/johnw/dfinity/dev/master/.git/COMMIT_EDITMSG
86842 s004 S+ 0:00.00 sleep 604800
But there is no COMMIT_EDITMSG buffer in Emacs, so it will sleep a while...
@tarsius I found the cause of my problem: I'm using emacs-direnv. When Magit opens the commit editor the first time (which is fast), it loads in the direnv for my project, which does not have my Emacs on the PATH (so emacsclient is incorrectly resolved to /usr/bin). This turns off the fast mode of with-editor.
@jwiegley Have you find a work-around for this problem? I am facing the same issue.
This has started happening to me lately. I also see emacsclient running. Unlike @jwiegley my emacs is at the normal place, no path issues. Is there a way to debug this further? Note that C-g seems to unfreeze things and it proceeds to the commit message.
Most helpful comment
Sorry everyone it took me this long due to private reasons, but the fix is now in Emacs master and won't be backported to the 26.x branch, unfortunately. The patches, though, cleanly apply to 26.x and will work there just fine -- as I use that version myself. ;-)
If you run into problems specifically with that patch, please let me know. Thanks, again, for everyone's patience... and have a great weekend!