lastquestion / explain-pause-mode

top, but for Emacs.
GNU General Public License v3.0
241 stars 6 forks source link

wrong-type-argument symbolp #f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>) when saving file #71

Closed shackra closed 4 years ago

shackra commented 4 years ago

Well. After updating to ef0ce465fea50ebb9196fec66ed29ba166ee0415 turns out that I now experience this bug when saving a file to disk (C-x C-s):

Debugger entered--Lisp error: (wrong-type-argument symbolp #f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>))
  advice-add(#f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>) :around (closure ((hook-list . post-command-hook) (hook-func . #f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>)) explain-pause-top-mode-abbrev-table explain-pause-top-mode-syntax-table cl-struct-explain-pause-top--command-entry-tags cl-struct-explain-pause-top--table-display-entry-tags cl-struct-explain-pause-top--table-tags cl-struct-explain-pause-command-record-tags t) (orig-func &rest args) (if (not explain-pause-mode) (apply orig-func args) (let ((current-record explain-pause--current-command-record)) (explain-pause--command-record-and-store current-record) (let ((new-frame (let ... ...))) (progn (explain-pause-log--send-command-entry explain-pause--current-command-record new-frame) (setq explain-pause--current-command-record new-frame) (let (...) (if should-profile ...) (progn ... ...) (unwind-protect ... ... ... ... ...))))))) ((name . "explain-pause-wrap-hook-post-command-hook")))
  (cond ((or (symbolp hook-func) (byte-code-function-p hook-func)) (advice-add hook-func :around (explain-pause--generate-hook-wrapper hook-func hook-list) (cons (cons 'name (format "explain-pause-wrap-hook-%s" hook-list)) nil)) hook-func) (t (if (and (listp hook-func) (listp (nth 3 hook-func)) (equal (nth 1 (nth 3 hook-func)) '#'explain-pause--lambda-hook-wrapper)) hook-func #'(lambda (&rest args) (apply #'explain-pause--lambda-hook-wrapper hook-func hook-list args)))))
  explain-pause--advice-add-hook(#f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>) post-command-hook)
  (setcar c (explain-pause--advice-add-hook hook-func hook-list))
  (let* ((c (nthcdr 1 args))) (setcar c (explain-pause--advice-add-hook hook-func hook-list)))
  (progn (let* ((c (nthcdr 1 args))) (setcar c (explain-pause--advice-add-hook hook-func hook-list))))
  (if (and (seq-contains explain-pause--native-called-hooks hook-list) (functionp hook-func)) (progn (let* ((c (nthcdr 1 args))) (setcar c (explain-pause--advice-add-hook hook-func hook-list)))))
  (let ((hook-list (nth 0 args)) (hook-func (nth 1 args))) (if (and (seq-contains explain-pause--native-called-hooks hook-list) (functionp hook-func)) (progn (let* ((c (nthcdr 1 args))) (setcar c (explain-pause--advice-add-hook hook-func hook-list))))))
  explain-pause--wrap-add-hook((post-command-hook #f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>) append nil))
  add-hook(post-command-hook #f(compiled-function () #<bytecode 0x4c7a0e9800c1d76>) append nil)
  flymake-start(t)
  flymake-after-save-hook()
  run-hooks(after-save-hook)
  basic-save-buffer(t)
  save-buffer(1)
  #<subr funcall-interactively>(save-buffer 1)
  apply(#<subr funcall-interactively> (save-buffer 1))
  funcall-interactively(save-buffer 1)
  #<subr call-interactively>(save-buffer nil nil)
  apply(#<subr call-interactively> (save-buffer nil nil))
  (unwind-protect (apply original-func args) (let ((top-frame explain-pause--current-command-record)) (if extra-frame (cond ((and (eq (progn ... ...) target-function) (eq (progn ... ...) command-frame)) (explain-pause--command-record-and-store top-frame) (if (progn (or ... ...) (aref top-frame 7)) (progn (explain-pause--command-record--save-and-stop-profiling top-frame))) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)) ((eq top-frame command-frame) (explain-pause--command-record-and-store top-frame) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame)) (t (explain-pause-report-measuring-bug "call-interactively has extra-frame" "top-frame" top-frame "target-function" target-function))) (if (not (eq top-frame command-frame)) (explain-pause-report-measuring-bug "call interactively frame does not match" "command-frame" command-frame "should be equal" top-frame) (explain-pause--command-record-and-store command-frame) (if (progn (or (and ... t) (signal ... ...)) (aref command-frame 7)) (progn (explain-pause--command-record--save-and-stop-profiling command-frame))) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)))) (if (eq parent explain-pause-root-command-loop) nil (progn (or (and (memq (type-of parent) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record parent))) (let* ((v parent)) (aset v 5 (current-time))))) (setq explain-pause--current-command-record parent))
  (let ((parent explain-pause--current-command-record) (target-function (car args)) (command-frame nil) (extra-frame nil)) (if (eq parent explain-pause-root-command-loop) nil (explain-pause--command-record-and-store parent)) (if (or (eq target-function #'self-insert-command) (eq target-function #'newline) (eq target-function #'next-line) (eq target-function #'previous-line) (eq target-function #'delete-forward-char)) nil (let ((i-spec (car (cdr (interactive-form target-function))))) (if (and (stringp i-spec) (explain-pause--interactive-form-needs-frame-p i-spec)) (progn (setq command-frame (explain-pause--command-record-from-parent parent parent 'call-interactively-interactive t)) (setq extra-frame t))))) (if extra-frame nil (setq command-frame (explain-pause--command-record-from-parent parent parent target-function))) (explain-pause-log--send-command-entry parent command-frame) (setq explain-pause--current-command-record command-frame) (progn (or (and (memq (type-of command-frame) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record command-frame))) (let* ((v command-frame)) (aset v 5 (current-time)))) (if (and (not extra-frame) (explain-pause--command-record-profile-p command-frame)) (progn (explain-pause--command-record-start-profiling command-frame))) (unwind-protect (apply original-func args) (let ((top-frame explain-pause--current-command-record)) (if extra-frame (cond ((and (eq ... target-function) (eq ... command-frame)) (explain-pause--command-record-and-store top-frame) (if (progn ... ...) (progn ...)) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)) ((eq top-frame command-frame) (explain-pause--command-record-and-store top-frame) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame)) (t (explain-pause-report-measuring-bug "call-interactively has extra-frame" "top-frame" top-frame "target-function" target-function))) (if (not (eq top-frame command-frame)) (explain-pause-report-measuring-bug "call interactively frame does not match" "command-frame" command-frame "should be equal" top-frame) (explain-pause--command-record-and-store command-frame) (if (progn (or ... ...) (aref command-frame 7)) (progn (explain-pause--command-record--save-and-stop-profiling command-frame))) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)))) (if (eq parent explain-pause-root-command-loop) nil (progn (or (and (memq (type-of parent) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record parent))) (let* ((v parent)) (aset v 5 (current-time))))) (setq explain-pause--current-command-record parent)))
  explain-pause--wrap-call-interactively(#<subr call-interactively> save-buffer nil nil)
  apply(explain-pause--wrap-call-interactively #<subr call-interactively> (save-buffer nil nil))
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)

this error happens 100% of the time there is something to be written to disk. My Emacs version is GNU Emacs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.14, cairo version 1.17.3) of 2020-02-18

lastquestion commented 4 years ago

😭

Ohhhh, this is because a bytecompiled function symbol is not the same as a bytecompiled function value

One second, I will get a fix for you right now.

lastquestion commented 4 years ago

I tested with flymake-mode in emacs 28 HEAD, commit bc8089a3fa11161428c51439fd3b26fd6583345d, it works now.

Please update to HEAD again and sorry you ran into 3 bugs :( 😢