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

(wrong-type-argument stringp nil) when using Emacs 26 #7

Open
ghost opened this issue Jun 22, 2018 · 2 comments
Open

(wrong-type-argument stringp nil) when using Emacs 26 #7

ghost opened this issue Jun 22, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 22, 2018

It does't take much to reproduce this, just type module foo { in a new .yang file and you'll get a backtrace like this.

Using yang-mode packaage 20180306.407 on Emacs 26.1

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  looking-at(nil)
  c-just-after-func-arglist-p(1)
  c-guess-basic-syntax()
  c-electric-brace(nil)
  funcall-interactively(c-electric-brace nil)
  call-interactively(c-electric-brace nil nil)
  command-execute(c-electric-brace)
@ghost
Copy link
Author

ghost commented Jun 22, 2018

Adding this near the other c-lang-defconst calls seems to fix the problem. cc-mode seems to be defaulting some stuff to nil and then passing that to looking-at (which apparently doesn't like nil).

(c-lang-defconst c-cpp-expr-functions-key
  yang "")

(c-lang-defconst c-opt-op-identifier-prefix
  yang "")

I'm not really sure if "" is the right thing for YANG though

@event
Copy link

event commented Apr 2, 2024

Since the time of the original issue, more variables cause problems. Another solution is to derive yang-mode from js-mode, rather then java-mode:

@@ -157,12 +157,13 @@
   (require 'cc-langs)
   (require 'cc-fonts))
 
+(require 'js)
 (eval-and-compile
   ;; Make our mode known to the language constant system.  Use Java
   ;; mode as the fallback for the constants we don't change here.
   ;; This needs to be done also at compile time since the language
   ;; constants are evaluated then.
-  (c-add-language 'yang-mode 'java-mode)
+  (c-add-language 'yang-mode 'js-mode)
 
   ;; compatibility with emacs < 24
   (defalias 'yang-mode-prog-mode

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

No branches or pull requests

1 participant