jdtsmith / mode-minder

Show all modes available in Emacs
GNU General Public License v3.0
45 stars 1 forks source link

Error when there are modes defined in my config #2

Closed karthink closed 7 months ago

karthink commented 9 months ago

When I run M-x mode-minder, I get:

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  (file-name-base nil)
  (#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_2> my/org-hugo-mode)
  (mode-minder)
  (funcall-interactively mode-minder)
  (command-execute mode-minder record)
  (execute-extended-command nil "mode-minder" "mode-minder")
  (funcall-interactively execute-extended-command nil "mode-minder" "mode-minder")
  (command-execute execute-extended-command)

my/org-hugo-mode is defined in my init file inside the use-package block for ox-hugo.

jdtsmith commented 9 months ago

I pushed a change to try to handle this, see if that fixes it for you. I presume if it's defined in your init it will already be active.

karthink commented 9 months ago

Thanks. Now I get the following error:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p delete)
  (mouse-posn-property ((66 . 1) (delete) ".#emacs-async-comp-geiser-log-8PbDQc.el" 0) context-menu-function)
  (context-menu-map)
  (#f(compiled-function (_) #<bytecode -0x1415a92fc4ff11e6>) (keymap))
  (describe-map (keymap (menu . context-menu-open) (down-mouse-3 menu-item "Context Menu" (keymap) :filter #f(compiled-function (_) #<bytecode -0x1415a92fc4ff11e6>)) (mouse-3)) [] nil t nil t t nil)
  (describe-map-tree (keymap (menu . context-menu-open) (down-mouse-3 menu-item "Context Menu" (keymap) :filter #f(compiled-function (_) #<bytecode -0x1415a92fc4ff11e6>)) (mouse-3)) t nil nil nil t nil nil t)
  (substitute-command-keys "Toggle Context Menu mode.\n\nWhen Context Menu mode ...")
  (documentation context-menu-mode)
  (and t (documentation mode))
  (let* ((doc (and t (documentation mode))) (doc (and doc (substring doc 0 (string-match "\\(\\.[[:space:]]\\)\\|\n" doc)))) (beg (and doc (point)))) (if beg (progn (princ (concat " " doc)) (add-text-properties beg (point) '(font-lock-face custom-documentation))) nil))
  (save-current-buffer (set-buffer standard-output) (save-excursion (re-search-backward " \\([^ ]+\\)") (help-xref-button 1 'mode-minder-help-function mode)) (if tag (princ tag)) (princ (make-string pad 32)) (let* ((doc (and t (documentation mode))) (doc (and doc (substring doc 0 (string-match "\\(\\.[[:space:]]\\)\\|\n" doc)))) (beg (and doc (point)))) (if beg (progn (princ (concat " " doc)) (add-text-properties beg (point) '(font-lock-face custom-documentation))) nil)))
  (let* ((mstr (concat (make-string (* 2 depth) 32) (if (= (% depth 2) 0) "•" "-") " " (symbol-name mode))) (sfile (symbol-file mode)) (aliases (gethash mode mode-minder-alias-ht)) (tag (if sfile (concat (cond ((file-in-directory-p sfile package-user-dir) "[P]") ((not ...) "[O]")) (if aliases (concat " (" (string-join ... ", ") ")"))))) (pad (max 0 (- mode-minder-pad (length mstr) (length tag))))) (princ mstr) (save-current-buffer (set-buffer standard-output) (save-excursion (re-search-backward " \\([^ ]+\\)") (help-xref-button 1 'mode-minder-help-function mode)) (if tag (princ tag)) (princ (make-string pad 32)) (let* ((doc (and t (documentation mode))) (doc (and doc (substring doc 0 (string-match "\\(\\.[[:space:]]\\)\\|\n" doc)))) (beg (and doc (point)))) (if beg (progn (princ (concat " " doc)) (add-text-properties beg (point) '(font-lock-face custom-documentation))) nil))) (princ "\n") (mapc #'(lambda (c) (mode-minder--map-tree c (gethash c mode-minder-ht) (1+ depth))) (sort children #'mode-minder--sym-sort)))
  (mode-minder--map-tree context-menu-mode nil 0)
  ((closure (t) (x) (mode-minder--map-tree x (gethash x mode-minder-ht) 0)) context-menu-mode)
  (mapc (closure (t) (x) (mode-minder--map-tree x (gethash x mode-minder-ht) 0)) (abbrev-mode abridge-diff-mode ace-window-display-mode ace-window-posframe-mode allout-mode allout-widgets-mode antifennel-mode artist-mode async-bytecomp-package-mode auto-composition-mode auto-compression-mode auto-encryption-mode auto-fill-mode auto-image-file-mode auto-insert-mode auto-revert-mode auto-revert-tail-mode auto-save-mode auto-save-visited-mode avy-linum-mode bib-cite-minor-mode blink-cursor-mode buffer-face-mode bug-reference-mode bug-reference-prog-mode button-mode calctex-mode cdlatex-mode checkdoc-minor-mode citar-embark-mode cl-font-lock-built-in-mode cl-old-struct-compat-mode column-number-mode comint-fontify-input-mode company-mode company-search-mode company-tng-mode compilation-minor-mode compilation-shell-minor-mode completion-in-region-mode consult-preview-at-point-mode context-menu-mode corfu-mode corfu-popupinfo-mode coterm-auto-char-lighter-mode coterm-auto-char-mode coterm-char-mode coterm-mode coterm-scroll-snap-mode cua-mode ...))
  (while (and (consp --cl-var--) (progn (setq list (car --cl-var--)) (consp --cl-var--))) (setq heading (car --cl-var--)) (princ (format "%s (%d):" heading (mode-minder--count list))) (save-current-buffer (set-buffer standard-output) (add-text-properties (line-beginning-position) (point) '(font-lock-face info-title-2))) (princ "\n\n") (mapc #'(lambda (x) (mode-minder--map-tree x (gethash x mode-minder-ht) 0)) (sort list #'mode-minder--sym-sort)) (setq --cl-var-- (cdr --cl-var--)) (setq --cl-var-- (cdr --cl-var--)))
  (let* ((--cl-var-- (append (mapcar #'cdr (seq-group-by #'(lambda ... ...) roots)) (list minors))) (list nil) (--cl-var-- '("Major Mode Hierarchies" "\nStandalone Modes" "\nMinor Modes")) (heading nil)) (while (and (consp --cl-var--) (progn (setq list (car --cl-var--)) (consp --cl-var--))) (setq heading (car --cl-var--)) (princ (format "%s (%d):" heading (mode-minder--count list))) (save-current-buffer (set-buffer standard-output) (add-text-properties (line-beginning-position) (point) '(font-lock-face info-title-2))) (princ "\n\n") (mapc #'(lambda (x) (mode-minder--map-tree x (gethash x mode-minder-ht) 0)) (sort list #'mode-minder--sym-sort)) (setq --cl-var-- (cdr --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) nil)
  (let (roots minors) (mapatoms #'(lambda (x) (if (and (commandp x) (string-suffix-p "-mode" (symbol-name x))) (progn (let* (...) (progn ... ...)))))) (let* ((--cl-var-- (append (mapcar #'cdr (seq-group-by #'... roots)) (list minors))) (list nil) (--cl-var-- '("Major Mode Hierarchies" "\nStandalone Modes" "\nMinor Modes")) (heading nil)) (while (and (consp --cl-var--) (progn (setq list (car --cl-var--)) (consp --cl-var--))) (setq heading (car --cl-var--)) (princ (format "%s (%d):" heading (mode-minder--count list))) (save-current-buffer (set-buffer standard-output) (add-text-properties (line-beginning-position) (point) '(font-lock-face info-title-2))) (princ "\n\n") (mapc #'(lambda (x) (mode-minder--map-tree x (gethash x mode-minder-ht) 0)) (sort list #'mode-minder--sym-sort)) (setq --cl-var-- (cdr --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) nil))
  ((closure (t) nil (let (roots minors) (mapatoms #'(lambda (x) (if (and ... ...) (progn ...)))) (let* ((--cl-var-- (append (mapcar ... ...) (list minors))) (list nil) (--cl-var-- '("Major Mode Hierarchies" "\nStandalone Modes" "\nMinor Modes")) (heading nil)) (while (and (consp --cl-var--) (progn (setq list ...) (consp --cl-var--))) (setq heading (car --cl-var--)) (princ (format "%s (%d):" heading (mode-minder--count list))) (save-current-buffer (set-buffer standard-output) (add-text-properties (line-beginning-position) (point) '...)) (princ "\n\n") (mapc #'(lambda ... ...) (sort list #'mode-minder--sym-sort)) (setq --cl-var-- (cdr --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) nil))))
  (help--window-setup "*Mode-Minder*" (closure (t) nil (let (roots minors) (mapatoms #'(lambda (x) (if (and ... ...) (progn ...)))) (let* ((--cl-var-- (append (mapcar ... ...) (list minors))) (list nil) (--cl-var-- '("Major Mode Hierarchies" "\nStandalone Modes" "\nMinor Modes")) (heading nil)) (while (and (consp --cl-var--) (progn (setq list ...) (consp --cl-var--))) (setq heading (car --cl-var--)) (princ (format "%s (%d):" heading (mode-minder--count list))) (save-current-buffer (set-buffer standard-output) (add-text-properties (line-beginning-position) (point) '...)) (princ "\n\n") (mapc #'(lambda ... ...) (sort list #'mode-minder--sym-sort)) (setq --cl-var-- (cdr --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) nil))))
  (mode-minder)
  (funcall-interactively mode-minder)
  (command-execute mode-minder record)
  (execute-extended-command nil "mode-minder" "mode-min")
  (funcall-interactively execute-extended-command nil "mode-minder" "mode-min")
  (command-execute execute-extended-command)

Along with the following warnings:

⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for go is unavailable (not-found): (libtree-sitter-go libtree-sitter-go.0 libtree-sitter-go.0.0 libtree-sitter-go.so libtree-sitter-go.so.0 libtree-sitter-go.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for gomod is unavailable (not-found): (libtree-sitter-gomod libtree-sitter-gomod.0 libtree-sitter-gomod.0.0 libtree-sitter-gomod.so libtree-sitter-gomod.so.0 libtree-sitter-gomod.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for json is unavailable (not-found): (libtree-sitter-json libtree-sitter-json.0 libtree-sitter-json.0.0 libtree-sitter-json.so libtree-sitter-json.so.0 libtree-sitter-json.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for cpp is unavailable (not-found): (libtree-sitter-cpp libtree-sitter-cpp.0 libtree-sitter-cpp.0.0 libtree-sitter-cpp.so libtree-sitter-cpp.so.0 libtree-sitter-cpp.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for c is unavailable (not-found): (libtree-sitter-c libtree-sitter-c.0 libtree-sitter-c.0.0 libtree-sitter-c.so libtree-sitter-c.so.0 libtree-sitter-c.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for cpp is unavailable (not-found): (libtree-sitter-cpp libtree-sitter-cpp.0 libtree-sitter-cpp.0.0 libtree-sitter-cpp.so libtree-sitter-cpp.so.0 libtree-sitter-cpp.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for cmake is unavailable (not-found): (libtree-sitter-cmake libtree-sitter-cmake.0 libtree-sitter-cmake.0.0 libtree-sitter-cmake.so libtree-sitter-cmake.so.0 libtree-sitter-cmake.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for typescript is unavailable (not-found): (libtree-sitter-typescript libtree-sitter-typescript.0 libtree-sitter-typescript.0.0 libtree-sitter-typescript.so libtree-sitter-typescript.so.0 libtree-sitter-typescript.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for tsx is unavailable (not-found): (libtree-sitter-tsx libtree-sitter-tsx.0 libtree-sitter-tsx.0.0 libtree-sitter-tsx.so libtree-sitter-tsx.so.0 libtree-sitter-tsx.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for toml is unavailable (not-found): (libtree-sitter-toml libtree-sitter-toml.0 libtree-sitter-toml.0.0 libtree-sitter-toml.so libtree-sitter-toml.so.0 libtree-sitter-toml.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for java is unavailable (not-found): (libtree-sitter-java libtree-sitter-java.0 libtree-sitter-java.0.0 libtree-sitter-java.so libtree-sitter-java.so.0 libtree-sitter-java.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for ruby is unavailable (not-found): (libtree-sitter-ruby libtree-sitter-ruby.0 libtree-sitter-ruby.0.0 libtree-sitter-ruby.so libtree-sitter-ruby.so.0 libtree-sitter-ruby.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for dockerfile is unavailable (not-found): (libtree-sitter-dockerfile libtree-sitter-dockerfile.0 libtree-sitter-dockerfile.0.0 libtree-sitter-dockerfile.so libtree-sitter-dockerfile.so.0 libtree-sitter-dockerfile.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for yaml is unavailable (not-found): (libtree-sitter-yaml libtree-sitter-yaml.0 libtree-sitter-yaml.0.0 libtree-sitter-yaml.so libtree-sitter-yaml.so.0 libtree-sitter-yaml.so.0.0) No such file or directory
jdtsmith commented 9 months ago

Looks like an error with documentation for one of your modes. What does M-: (documentation 'context-menu-mode) do?

The warnings are harmless, it's just trying to load all of the ts modes it saw (not knowing they have no ts grammar installed).

jdtsmith commented 8 months ago

Any progress on figuring this one out?

jdtsmith commented 7 months ago

Closing, but please let me know if this is still an issue.