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

imenu not supported for yang-mode? #9

Open
pierre-rouleau opened this issue Oct 7, 2021 · 1 comment
Open

imenu not supported for yang-mode? #9

pierre-rouleau opened this issue Oct 7, 2021 · 1 comment

Comments

@pierre-rouleau
Copy link

pierre-rouleau commented Oct 7, 2021

When opening a .yang file that has yang-mode associated with it and using the latest version (20190507.724) of this code Emacs complains that imenu support is not available: I get the following traceback.

Debugger entered--Lisp error: (imenu-unavailable "The mode ‘YANG//l’ does not support Imenu")
  signal(imenu-unavailable ("The mode ‘YANG//l’ does not support Imenu"))
  imenu-unavailable-error("The mode `%s' does not support Imenu" "YANG//l")
  imenu-add-to-menubar("Defs")
  imenup-add-defs-to-menubar()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook yang-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook yang-mode-hook))
  run-mode-hooks(yang-mode-hook)
  yang-mode()
  set-auto-mode-0(yang-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer [email protected]> "~/devpub/yang/yang/standard/ieee/published/1906.1/[email protected]" nil nil "~/devpub/ya$
  find-file-noselect("/Users/roup/devpub/yang/yang/standard/ieee/published/1906.1/[email protected]" nil nil nil)
  find-file("/Users/roup/devpub/yang/yang/standard/ieee/published/1906.1/[email protected]")
  dired-find-file()
  funcall-interactively(dired-find-file)
  #<subr call-interactively>(dired-find-file nil nil)
  apply(#<subr call-interactively> dired-find-file (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> dired-find-file nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (dired-find-file nil nil))
  call-interactively(dired-find-file nil nil)
  command-execute(dired-find-file)
  • I have not written any function to hook into yang-mode yet.
  • I am using Emacs 26.3
@pierre-rouleau
Copy link
Author

pierre-rouleau commented Oct 7, 2021

I did not notice the 'p' in the imenup-add-defs-to-menubar(). This is a imenu+ function. If I disable the use of imenu+ from my setup, the problem goes away. If I set imenu-generic-expression to something valid inside yang-mode the problem also goes away (with the added benefit of supporting imenu).

The imenu+ issue has to do with it expecting the imenu-generic-expression to be set. This has nothing to do about the yang code. The yang-mode code can stay as is and it's possible to add imenu (and imenu+) support via hooks. But Iit might also be a good idea to have built-in imenu support.

I could provide it if there's an interest.

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