emacs-php / php-mode

A powerful and flexible Emacs major mode for editing PHP scripts
GNU General Public License v3.0
583 stars 118 forks source link

File mode specification error #747

Closed VernonGrant closed 1 year ago

VernonGrant commented 1 year ago

Hi,

I'm getting the following error when opening a PHP file or when trying to enable php-mode manually.

Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 2) 0)
  php-mode-debug-reinstall()
  php-mode()
  php-mode-maybe()
  set-auto-mode-0(php-mode-maybe nil)
  set-auto-mode--apply-alist((("\\.liquid" . web-mode) ("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:l..." . json-mode) ("\\(?:build\\|profile\\)\\.boot\\'" . clojure-mode) ("\\.cljs\\'" . clojurescript-mode) ("\\.cljc\\'" . clojurec-mode) ("\\.\\(clj\\|cljd\\|dtm\\|edn\\)\\'" . clojure-mode) ("\\.dockerfile\\'" . dockerfile-mode) ("/Dockerfile\\(?:\\.[^/\\]*\\)?\\'" . dockerfile-mode) ("\\.editorconfig\\'" . editorconfig-conf-mode) ("go\\.mod\\'" . go-dot-mod-mode) ("\\.go\\'" . go-mode) ("/git-rebase-todo\\'" . git-rebase-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-mode-maybe) ("\\.\\(?:php\\.inc\\|stub\\)\\'" . php-mode) ("/\\.php_cs\\(?:\\.dist\\)?\\'" . php-mode) ("\\.ts\\'" . typescript-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-mode) ("\\.re?st\\'" . rst-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" . bat-mode) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer mio-features.php<2>> "/path/to/some/project..." nil nil "/path/to/some/project..." (104268 2049))
  #f(compiled-function (filename &optional nowarn rawfile wildcards) "Read file FILENAME into a buffer and return the buffer.\nIf a buffer exists visiting FILENAME, return that one, but\nverify that the file has not changed since visited or saved.\nThe buffer is not selected, just returned to the caller.\nOptional second arg NOWARN non-nil means suppress any warning messages.\nOptional third arg RAWFILE non-nil means the file is read literally.\nOptional fourth arg WILDCARDS non-nil means do wildcard processing\nand visit all the matching files.  When wildcards are actually\nused and expanded, return a list of buffers that are visiting\nthe various files." #<bytecode 0x3dff765178b3cab>)("/path/to/some/project..." nil nil nil)
  apply(#f(compiled-function (filename &optional nowarn rawfile wildcards) "Read file FILENAME into a buffer and return the buffer.\nIf a buffer exists visiting FILENAME, return that one, but\nverify that the file has not changed since visited or saved.\nThe buffer is not selected, just returned to the caller.\nOptional second arg NOWARN non-nil means suppress any warning messages.\nOptional third arg RAWFILE non-nil means the file is read literally.\nOptional fourth arg WILDCARDS non-nil means do wildcard processing\nand visit all the matching files.  When wildcards are actually\nused and expanded, return a list of buffers that are visiting\nthe various files." #<bytecode 0x3dff765178b3cab>) "/path/to/some/project..." (nil nil nil))
  editorconfig--advice-find-file-noselect(#f(compiled-function (filename &optional nowarn rawfile wildcards) "Read file FILENAME into a buffer and return the buffer.\nIf a buffer exists visiting FILENAME, return that one, but\nverify that the file has not changed since visited or saved.\nThe buffer is not selected, just returned to the caller.\nOptional second arg NOWARN non-nil means suppress any warning messages.\nOptional third arg RAWFILE non-nil means the file is read literally.\nOptional fourth arg WILDCARDS non-nil means do wildcard processing\nand visit all the matching files.  When wildcards are actually\nused and expanded, return a list of buffers that are visiting\nthe various files." #<bytecode 0x3dff765178b3cab>) "/path/to/some/project..." nil nil nil)
  apply(editorconfig--advice-find-file-noselect #f(compiled-function (filename &optional nowarn rawfile wildcards) "Read file FILENAME into a buffer and return the buffer.\nIf a buffer exists visiting FILENAME, return that one, but\nverify that the file has not changed since visited or saved.\nThe buffer is not selected, just returned to the caller.\nOptional second arg NOWARN non-nil means suppress any warning messages.\nOptional third arg RAWFILE non-nil means the file is read literally.\nOptional fourth arg WILDCARDS non-nil means do wildcard processing\nand visit all the matching files.  When wildcards are actually\nused and expanded, return a list of buffers that are visiting\nthe various files." #<bytecode 0x3dff765178b3cab>) ("/path/to/some/project..." nil nil nil))
  find-file-noselect("/path/to/some/project..." nil nil nil)
  find-file("/path/to/some/project...")
  dired--find-file(find-file "/path/to/some/project...")
  dired--find-possibly-alternative-file("/path/to/some/project...")
  dired-find-file()
  funcall-interactively(dired-find-file)
  call-interactively(dired-find-file nil nil)
  command-execute(dired-find-file)

I'm using:

NateEag commented 1 year ago

Looks like this is because php-mode-debug-install is called without the required force arg.

My inclination would be to make the force arg optional and default it to nil, so that feature remains available to anyone who's relying on it but the current usage asks users if they want to reinstall php-mode instead of erroring.

@zonuexe , does that sound reasonable to you? Is there some other approach you'd like better?

zonuexe commented 1 year ago

@VernonGrant Sorry, this is a php-mode bug. Please use M-x php-mode-debug-reinstall manually.

zonuexe commented 1 year ago

@VernonGrant Feel free to reopen the issue if the issue is not resolved.

@NateEag Thank you for your support!

NateEag commented 1 year ago

@zonuexe sure thing! Glad I could be a little help - you've put so much effort into php-mode over the years. :heart:

VernonGrant commented 1 year ago

@zonuexe @NateEag I really appreciate all the work you guys are doing, thanks for resolving the issue!