Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't call magit-refresh-function if nil #1434

Merged
merged 1 commit into from
Jul 21, 2014
Merged

Conversation

npostavs
Copy link
Contributor

Symptom: an error thrown when refreshing the process buffer after running magit-git-command, eg: : status RET (full stacktrace below). I bisected to 8aa75bf where I saw the check for nil magit-refresh-function was dropped. But maybe it's magit-git-command that needs to be fixed? Somehow other commands can output to the process buffer without triggering a problem...

Debugger entered--Lisp error: (void-function nil)
  nil()
  apply(nil nil)
  (save-excursion (apply magit-refresh-function magit-refresh-args))
  (let ((inhibit-read-only t)) (erase-buffer) (save-excursion (apply magit-refresh-function magit-refresh-args)))
  (let ((section (magit-current-section)) ident line char other) (if section (progn (setq ident (magit-section-ident section) line (count-lines (progn (or (and ... ... ...) (error "%s accessing a non-%s" ... ...)) (aref section 3)) (point)) char (- (point) (line-beginning-position))))) (let ((inhibit-read-only t)) (erase-buffer) (save-excursion (apply magit-refresh-function magit-refresh-args))) (if section (progn (let ((it (magit-find-section ident))) (if it (let ((start ...)) (goto-char start) (if (> ... 1) (progn ... ...))) (goto-char (let (...) (if it ... ...))))))) (run-hooks (quote magit-refresh-buffer-hook)) (magit-highlight-section))
  magit-refresh-buffer()
  (progn (run-hooks (quote magit-pre-refresh-hook)) (magit-refresh-buffer) (if (derived-mode-p (quote magit-status-mode)) nil (let ((it (magit-mode-get-buffer magit-status-buffer-name-format (quote magit-status-mode)))) (if it (progn (save-current-buffer (set-buffer it) (magit-refresh-buffer)))))))
  (if (derived-mode-p (quote magit-mode)) (progn (run-hooks (quote magit-pre-refresh-hook)) (magit-refresh-buffer) (if (derived-mode-p (quote magit-status-mode)) nil (let ((it (magit-mode-get-buffer magit-status-buffer-name-format (quote magit-status-mode)))) (if it (progn (save-current-buffer (set-buffer it) (magit-refresh-buffer))))))))
  (if inhibit-magit-refresh nil (if (derived-mode-p (quote magit-mode)) (progn (run-hooks (quote magit-pre-refresh-hook)) (magit-refresh-buffer) (if (derived-mode-p (quote magit-status-mode)) nil (let ((it (magit-mode-get-buffer magit-status-buffer-name-format ...))) (if it (progn (save-current-buffer ... ...))))))) (if magit-auto-revert-mode (progn (magit-revert-buffers))))
  magit-refresh()
  (save-current-buffer (set-buffer it) (magit-refresh))
  (progn (save-current-buffer (set-buffer it) (magit-refresh)))
  (if (buffer-live-p it) (progn (save-current-buffer (set-buffer it) (magit-refresh))))
  (progn (if (buffer-live-p it) (progn (save-current-buffer (set-buffer it) (magit-refresh)))))
  (if it (progn (if (buffer-live-p it) (progn (save-current-buffer (set-buffer it) (magit-refresh))))))
  (let ((it (process-get process (quote command-buf)))) (if it (progn (if (buffer-live-p it) (progn (save-current-buffer (set-buffer it) (magit-refresh)))))))
  (progn (setq event (substring event 0 -1)) (magit-process-unset-mode-line) (if (string-match "^finished" event) (progn (message (concat (capitalize (process-name process)) " finished")))) (magit-process-finish process) (if (eq process magit-this-process) (progn (setq magit-this-process nil))) (let ((it (process-get process (quote command-buf)))) (if it (progn (if (buffer-live-p it) (progn (save-current-buffer (set-buffer it) (magit-refresh))))))))
  (if (memq (process-status process) (quote (exit signal))) (progn (setq event (substring event 0 -1)) (magit-process-unset-mode-line) (if (string-match "^finished" event) (progn (message (concat (capitalize (process-name process)) " finished")))) (magit-process-finish process) (if (eq process magit-this-process) (progn (setq magit-this-process nil))) (let ((it (process-get process (quote command-buf)))) (if it (progn (if (buffer-live-p it) (progn (save-current-buffer ... ...))))))))
  magit-process-sentinel(#<process git> "finished\n")

The check against magit-refresh-function was dropped in
8aa75bf, when magit-mode-refresh-buffer
was changed to magit-refresh-buffer.
@tarsius
Copy link
Member

tarsius commented Jul 21, 2014

It was even worse than that... pressing g in a process buffer erased its content. The problem is that magit-process-mode has no magit-refresh-function because it's not like other magit buffers. I didn't think of that when I dropped that check. But this leads to the question whether magit-process-mode should derive from magit-mode. I am undecided, not doing so would complicate things a bit. So while it might end up not being the final solution, restoring the check at least solves the issue for now.

Thanks, for catching this and bisecting.

@tarsius tarsius closed this Jul 21, 2014
@tarsius tarsius reopened this Jul 21, 2014
tarsius added a commit that referenced this pull request Jul 21, 2014
don't call magit-refresh-function if nil
@tarsius tarsius merged commit 1181b91 into magit:next Jul 21, 2014
@tarsius tarsius added this to the 2.1.0 milestone Jul 21, 2014
@tarsius
Copy link
Member

tarsius commented Jul 24, 2014

Merged into next, see #1220.

@npostavs npostavs deleted the safe-refresh branch October 25, 2014 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants