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

Advice set-auto-mode-0 instead of set-auto-mode-1 #1

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

abougouffa
Copy link
Contributor

First, let me thank you for this clever package! I was always annoyed by so-long taking too long to open a big file even thought I know that opening the same file in fundamental-mode works out of the box. The approach taken by this package makes perfect sens! So thanks!

I've noticed an error displayed when I open a big file with guard-lf-mode active, after enabling debug on error I got this trace:

Debugger entered--Lisp error: (wrong-type-argument consp nil)
  guard-lf--set-auto-mode-1(#<subr set-auto-mode-1>)
  apply(guard-lf--set-auto-mode-1 #<subr set-auto-mode-1> nil)
  set-auto-mode-1()
  so-long--check-header-modes()
  so-long--set-auto-mode(#<subr set-auto-mode>)
  apply(so-long--set-auto-mode #<subr set-auto-mode> nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer big.js> "~/big.js" nil nil "~/big.js" (73518280 66307))
  #<subr find-file-noselect>("~/big.js" nil nil t)
  apply(#<subr find-file-noselect> ("~/big.js" nil nil t))
  guard-lf--find-file(#<subr find-file-noselect> "~/big.js" nil nil t)
  apply(guard-lf--find-file #<subr find-file-noselect> ("~/big.js" nil nil t))
  #f(advice guard-lf--find-file :around #<subr find-file-noselect>)("~/big.js" nil nil t)
  apply(#f(advice guard-lf--find-file :around #<subr find-file-noselect>) ("~/big.js" nil nil t))
  find-file-noselect("~/big.js" nil nil t)
  find-file("~/big.js" t)
  funcall-interactively(find-file "~/big.js" t)
  command-execute(find-file)

It turned out that there was a mistake in the adviced function, guard-lf should advice set-auto-mode-0 instead of set-auto-mode-1. Even the signature of guard-lf--set-auto-mode-1 doesn't match the signature set-auto-mode-1.

This PR fixes the issue!

@jcs090218
Copy link
Member

Hmm.. you are right. I intended to add advice around set-auto-mode-0, but am not sure why I had set-autp-mode-1 instead. 😕 I guess the fuzzy completion got me confused. 🤔

Thank you!

@jcs090218 jcs090218 merged commit 86bd304 into jcs-elpa:master Jun 20, 2024
10 of 11 checks passed
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