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

rustic-compile results in error #528

Open
hexmode opened this issue Sep 7, 2023 · 4 comments · Fixed by emacs-rustic/rustic#8 · May be fixed by #531
Open

rustic-compile results in error #528

hexmode opened this issue Sep 7, 2023 · 4 comments · Fixed by emacs-rustic/rustic#8 · May be fixed by #531

Comments

@hexmode
Copy link
Contributor

hexmode commented Sep 7, 2023

emacs 30.0.50 (a180f700cbf)

I have the following result after running M-x toggle-debug-on-error RET and eval-buffer in compile.el:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  -(1694087269.2730725 nil)
  (let ((elapsed (- (float-time) compilation--start-time))) (cond ((< elapsed 10) (format "%.2f s" elapsed)) ((< elapsed 60) (format "%.1f s" elapsed)) (t (format-seconds "%h:%02m:%02s" elapsed))))
  (compilation-insert-annotation " at " (substring (current-time-string) 0 19) ", duration " (let ((elapsed (- (float-time) compilation--start-time))) (cond ((< elapsed 10) (format "%.2f s" elapsed)) ((< elapsed 60) (format "%.1f s" elapsed)) (t (format-seconds "%h:%02m:%02s" elapsed)))))
  (let ((inhibit-read-only t) (status (if compilation-exit-message-function (funcall compilation-exit-message-function process-status exit-status msg) (cons msg exit-status))) (omax (point-max)) (opoint (point)) (cur-buffer (current-buffer))) (goto-char omax) (compilation-insert-annotation 10 mode-name " " (car status)) (if (and (numberp compilation-window-height) (= 0 compilation-window-height)) (message "%s" (cdr status))) (if (bolp) (forward-char -1)) (compilation-insert-annotation " at " (substring (current-time-string) 0 19) ", duration " (let ((elapsed (- (float-time) compilation--start-time))) (cond ((< elapsed 10) (format "%.2f s" elapsed)) ((< elapsed 60) (format "%.1f s" elapsed)) (t (format-seconds "%h:%02m:%02s" elapsed))))) (goto-char (point-max)) (add-text-properties omax (point) (append '(compilation-handle-exit t) nil)) (setq mode-line-process (list (let ((out-string (format ":%s [%s]" process-status (cdr status))) (msg (format "%s %s" mode-name (replace-regexp-in-string "\n?$" "" ...)))) (message "%s" msg) (propertize out-string 'help-echo msg 'face (if (> exit-status 0) 'compilation-mode-line-fail 'compilation-mode-line-exit))) compilation-mode-line-errors)) (force-mode-line-update) (if (and opoint (< opoint omax)) (goto-char opoint)) (run-hook-with-args 'compilation-finish-functions cur-buffer msg))
  compilation-handle-exit(exit 0 "finished\n")
  (save-current-buffer (set-buffer buffer) (compilation-handle-exit (process-status proc) (process-exit-status proc) msg) (delete-process proc))
  (if (null (buffer-name buffer)) (set-process-buffer proc nil) (save-current-buffer (set-buffer buffer) (compilation-handle-exit (process-status proc) (process-exit-status proc) msg) (delete-process proc)))
  (if (memq (process-status proc) '(exit signal)) (if (null (buffer-name buffer)) (set-process-buffer proc nil) (save-current-buffer (set-buffer buffer) (compilation-handle-exit (process-status proc) (process-exit-status proc) msg) (delete-process proc))) (setq compilation-in-progress (delq proc compilation-in-progress)) (compilation--update-in-progress-mode-line))
  (let ((buffer (process-buffer proc))) (save-current-buffer (set-buffer buffer) (setq default-directory (process-get proc 'workspace))) (if (memq (process-status proc) '(exit signal)) (if (null (buffer-name buffer)) (set-process-buffer proc nil) (save-current-buffer (set-buffer buffer) (compilation-handle-exit (process-status proc) (process-exit-status proc) msg) (delete-process proc))) (setq compilation-in-progress (delq proc compilation-in-progress)) (compilation--update-in-progress-mode-line)))
  rustic-compilation-sentinel(#<process rustic-compilation-process> "finished\n")

I've found that this is because the buffer-local variable compilation--start-time is set tonil by the time it gets to this point, even if I set it before running rustic-compile but haven't found why that is.

@gajama
Copy link

gajama commented Sep 16, 2023

I think I've just encountered the same error. I've only just set up rustic to start learning Rust, and I was trying out a few commands. rustic-cargo-check brought up the same error.

I've "fixed" it by adding (setq compilation--start-time (float-time)) to rustic-compilation immediately after (with-current-buffer buf. As this was after only a couple of minutes looking at the code, I'd be surprised if this is the correct place to put it, but it seemed sensible at first glance.

@hexmode
Copy link
Contributor Author

hexmode commented Sep 18, 2023

It looks like you mean here.

If this works for me, I'll make a PR so others can review or use.

hexmode added a commit to hexmode/rustic that referenced this issue Sep 18, 2023
Also address some cosmetic issues with code that emacs complained about.

Fixes brotzeit#528

Modified-by: Mark A. Hershberger <[email protected]>
@hexmode hexmode linked a pull request Sep 18, 2023 that will close this issue
@gajama
Copy link

gajama commented Sep 18, 2023

Hi,

No - I meant here, but if it also works in the other location, it maybe makes no difference.

@hexmode
Copy link
Contributor Author

hexmode commented Sep 18, 2023

Yeah, I realized that later and updated my comment (for anyone who wonders, my original comment was pointing to line 250). The PR uses your location.

tarsius pushed a commit to emacsmirror/rustic that referenced this issue Jun 30, 2024
Also address some cosmetic issues with code that emacs complained about.

Fixes brotzeit#528

Modified-by: Mark A. Hershberger <[email protected]>
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 a pull request may close this issue.

2 participants