Re: Emacs: lilypond-ts-mode and the future of lilypond-mode

David Kastrup <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.devel
Message-ID <[email protected]>
Saul Tobin <[email protected]> writes:

>>
>> I pushed a commit just now that should resolve this. Please let me know.
>>
>
> I should mention — you will need to either manually remove the old compiled
> LilyPond grammar from .emacs.d/tree-sitter and restart Emacs, or manually
> run (lilypond-ts--install) after pulling from the updated lilypond-ts-mode
> repo.

Debugger entered--Lisp error: (void-function file-notify-add-watch)
  (file-notify-add-watch file-dir '(change) #'(lambda (ev) (let ((ev-file (car (last ev)))) (if (string-match-p ".nav" ev-file) (progn (lilypond-ts--init-nav-watcher file-dir) (let* (...) (progn ... nil)))))))
  (cons file-dir (file-notify-add-watch file-dir '(change) #'(lambda (ev) (let ((ev-file (car ...))) (if (string-match-p ".nav" ev-file) (progn (lilypond-ts--init-nav-watcher file-dir) (let* ... ...)))))))
  (cons (cons file-dir (file-notify-add-watch file-dir '(change) #'(lambda (ev) (let ((ev-file ...)) (if (string-match-p ".nav" ev-file) (progn ... ...)))))) lilypond-ts--watchers)
  (setq lilypond-ts--watchers (cons (cons file-dir (file-notify-add-watch file-dir '(change) #'(lambda (ev) (let (...) (if ... ...))))) lilypond-ts--watchers))
  (if (file-exists-p nav-dir) (progn (mapc #'lilypond-ts--read-nav-data (directory-files nav-dir t "^.*\\.l$")) (setq lilypond-ts--watchers (cons (cons nav-dir (file-notify-add-watch nav-dir '(change) #'lilypond-ts--nav-watcher-callback)) lilypond-ts--watchers))) (setq lilypond-ts--watchers (cons (cons file-dir (file-notify-add-watch file-dir '(change) #'(lambda (ev) (let ... ...)))) lilypond-ts--watchers)))
  (if s (if (file-exists-p nav-dir) (progn (mapc #'lilypond-ts--read-nav-data (directory-files nav-dir t "^.*\\.l$")) (setq lilypond-ts--watchers (cons (cons nav-dir (file-notify-add-watch nav-dir '... #'lilypond-ts--nav-watcher-callback)) lilypond-ts--watchers))) (setq lilypond-ts--watchers (cons (cons file-dir (file-notify-add-watch file-dir '(change) #'(lambda ... ...))) lilypond-ts--watchers))))
  (let* ((fname (and t (or fname (buffer-file-name)))) (file-dir (and fname (file-name-directory fname))) (nav-dir (and file-dir (file-name-concat file-dir ".nav"))) (s (and nav-dir (not (assoc nav-dir lilypond-ts--watchers))))) (if s (if (file-exists-p nav-dir) (progn (mapc #'lilypond-ts--read-nav-data (directory-files nav-dir t "^.*\\.l$")) (setq lilypond-ts--watchers (cons (cons nav-dir (file-notify-add-watch nav-dir ... ...)) lilypond-ts--watchers))) (setq lilypond-ts--watchers (cons (cons file-dir (file-notify-add-watch file-dir '... #'...)) lilypond-ts--watchers)))))
  lilypond-ts--init-nav-watcher()
  (if lilypond-ts-navigation-mode (lilypond-ts--init-nav-watcher) (lilypond-ts--maybe-remove-nav-watcher))
  (let ((last-message (current-message))) (setq lilypond-ts-navigation-mode (cond ((eq arg 'toggle) (not lilypond-ts-navigation-mode)) ((and (numberp arg) (< arg 1)) nil) (t t))) (if (boundp 'local-minor-modes) (progn (setq local-minor-modes (delq 'lilypond-ts-navigation-mode local-minor-modes)) (if lilypond-ts-navigation-mode (progn (setq local-minor-modes (cons 'lilypond-ts-navigation-mode local-minor-modes)))))) (if lilypond-ts-navigation-mode (lilypond-ts--init-nav-watcher) (lilypond-ts--maybe-remove-nav-watcher)) (run-hooks 'lilypond-ts-navigation-mode-hook (if lilypond-ts-navigation-mode 'lilypond-ts-navigation-mode-on-hook 'lilypond-ts-navigation-mode-off-hook)) (if (called-interactively-p 'any) (progn nil (if (and (current-message) (not (equal last-message (current-message)))) nil (let ((local " in current buffer")) (message "%s %sabled%s" "Lilypond-Ts-Navigation mode" (if lilypond-ts-navigation-mode "en" "dis") local))))))
  lilypond-ts-navigation-mode(1)
  (progn (set (make-local-variable 'treesit-primary-parser) (treesit-parser-create 'lilypond)) (if (multisession-value lilypond-ts--lily-installs-alist) nil (lilypond-ts-find-installs)) (lilypond-ts--ensure-repl) (set (make-local-variable 'comment-start) "%") (set (make-local-variable 'comment-start-skip) "[%;]+{? *") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'block-comment-start) "%{") (set (make-local-variable 'block-comment-end) "%}") (set (make-local-variable 'treesit-thing-settings) lilypond-ts--thing-settings) (set (make-local-variable 'treesit-defun-name-function) #'lilypond-ts--defun-name) (set (make-local-variable 'treesit-defun-tactic) 'nested) (set (make-local-variable 'treesit-font-lock-settings) (apply #'treesit-font-lock-rules (lilypond-ts--font-lock-rules))) (set (make-local-variable 'treesit-font-lock-feature-list) lilypond-ts--font-lock-features) (set (make-local-variable 'treesit-font-lock-level) 3) (set (make-local-variable 'treesit-simple-indent-rules) lilypond-ts-indent-rules) (set (make-local-variable 'treesit-simple-imenu-settings) lilypond-ts-imenu-rules) (add-hook 'lilypond-ts-post-eval-hook #'lilypond-ts--require-list-refresh) (treesit-major-mode-setup) (set (make-local-variable 'lisp-indent-function) #'scheme-indent-function) (set (make-local-variable 'syntax-propertize-function) #'lilypond-ts--propertize-syntax) (lilypond-ts-autodoc-mode 1) (lilypond-ts-capf-mode 1) (lilypond-ts-navigation-mode 1))
  (if (treesit-ready-p 'lilypond) (progn (set (make-local-variable 'treesit-primary-parser) (treesit-parser-create 'lilypond)) (if (multisession-value lilypond-ts--lily-installs-alist) nil (lilypond-ts-find-installs)) (lilypond-ts--ensure-repl) (set (make-local-variable 'comment-start) "%") (set (make-local-variable 'comment-start-skip) "[%;]+{? *") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'block-comment-start) "%{") (set (make-local-variable 'block-comment-end) "%}") (set (make-local-variable 'treesit-thing-settings) lilypond-ts--thing-settings) (set (make-local-variable 'treesit-defun-name-function) #'lilypond-ts--defun-name) (set (make-local-variable 'treesit-defun-tactic) 'nested) (set (make-local-variable 'treesit-font-lock-settings) (apply #'treesit-font-lock-rules (lilypond-ts--font-lock-rules))) (set (make-local-variable 'treesit-font-lock-feature-list) lilypond-ts--font-lock-features) (set (make-local-variable 'treesit-font-lock-level) 3) (set (make-local-variable 'treesit-simple-indent-rules) lilypond-ts-indent-rules) (set (make-local-variable 'treesit-simple-imenu-settings) lilypond-ts-imenu-rules) (add-hook 'lilypond-ts-post-eval-hook #'lilypond-ts--require-list-refresh) (treesit-major-mode-setup) (set (make-local-variable 'lisp-indent-function) #'scheme-indent-function) (set (make-local-variable 'syntax-propertize-function) #'lilypond-ts--propertize-syntax) (lilypond-ts-autodoc-mode 1) (lilypond-ts-capf-mode 1) (lilypond-ts-navigation-mode 1)))
  (let ((delay-mode-hooks t)) (prog-mode) (setq major-mode 'lilypond-ts-mode) (setq mode-name "Lilypond") (progn (if (get 'prog-mode 'mode-class) (put 'lilypond-ts-mode 'mode-class (get 'prog-mode 'mode-class))) (if (keymap-parent lilypond-ts-mode-map) nil (set-keymap-parent lilypond-ts-mode-map (current-local-map))) (let ((parent (char-table-parent lilypond-ts-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent lilypond-ts-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get lilypond-ts-mode-abbrev-table :parents) (eq lilypond-ts-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put lilypond-ts-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map lilypond-ts-mode-map) (set-syntax-table lilypond-ts-mode-syntax-table) (setq local-abbrev-table lilypond-ts-mode-abbrev-table) (if (treesit-ready-p 'lilypond) (progn (set (make-local-variable 'treesit-primary-parser) (treesit-parser-create 'lilypond)) (if (multisession-value lilypond-ts--lily-installs-alist) nil (lilypond-ts-find-installs)) (lilypond-ts--ensure-repl) (set (make-local-variable 'comment-start) "%") (set (make-local-variable 'comment-start-skip) "[%;]+{? *") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'block-comment-start) "%{") (set (make-local-variable 'block-comment-end) "%}") (set (make-local-variable 'treesit-thing-settings) lilypond-ts--thing-settings) (set (make-local-variable 'treesit-defun-name-function) #'lilypond-ts--defun-name) (set (make-local-variable 'treesit-defun-tactic) 'nested) (set (make-local-variable 'treesit-font-lock-settings) (apply #'treesit-font-lock-rules (lilypond-ts--font-lock-rules))) (set (make-local-variable 'treesit-font-lock-feature-list) lilypond-ts--font-lock-features) (set (make-local-variable 'treesit-font-lock-level) 3) (set (make-local-variable 'treesit-simple-indent-rules) lilypond-ts-indent-rules) (set (make-local-variable 'treesit-simple-imenu-settings) lilypond-ts-imenu-rules) (add-hook 'lilypond-ts-post-eval-hook #'lilypond-ts--require-list-refresh) (treesit-major-mode-setup) (set (make-local-variable 'lisp-indent-function) #'scheme-indent-function) (set (make-local-variable 'syntax-propertize-function) #'lilypond-ts--propertize-syntax) (lilypond-ts-autodoc-mode 1) (lilypond-ts-capf-mode 1) (lilypond-ts-navigation-mode 1))))
  (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (prog-mode) (setq major-mode 'lilypond-ts-mode) (setq mode-name "Lilypond") (progn (if (get 'prog-mode 'mode-class) (put 'lilypond-ts-mode 'mode-class (get 'prog-mode 'mode-class))) (if (keymap-parent lilypond-ts-mode-map) nil (set-keymap-parent lilypond-ts-mode-map (current-local-map))) (let ((parent (char-table-parent lilypond-ts-mode-syntax-table))) (if (and parent (not (eq parent ...))) nil (set-char-table-parent lilypond-ts-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get lilypond-ts-mode-abbrev-table :parents) (eq lilypond-ts-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put lilypond-ts-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map lilypond-ts-mode-map) (set-syntax-table lilypond-ts-mode-syntax-table) (setq local-abbrev-table lilypond-ts-mode-abbrev-table) (if (treesit-ready-p 'lilypond) (progn (set (make-local-variable 'treesit-primary-parser) (treesit-parser-create 'lilypond)) (if (multisession-value lilypond-ts--lily-installs-alist) nil (lilypond-ts-find-installs)) (lilypond-ts--ensure-repl) (set (make-local-variable 'comment-start) "%") (set (make-local-variable 'comment-start-skip) "[%;]+{? *") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'block-comment-start) "%{") (set (make-local-variable 'block-comment-end) "%}") (set (make-local-variable 'treesit-thing-settings) lilypond-ts--thing-settings) (set (make-local-variable 'treesit-defun-name-function) #'lilypond-ts--defun-name) (set (make-local-variable 'treesit-defun-tactic) 'nested) (set (make-local-variable 'treesit-font-lock-settings) (apply #'treesit-font-lock-rules (lilypond-ts--font-lock-rules))) (set (make-local-variable 'treesit-font-lock-feature-list) lilypond-ts--font-lock-features) (set (make-local-variable 'treesit-font-lock-level) 3) (set (make-local-variable 'treesit-simple-indent-rules) lilypond-ts-indent-rules) (set (make-local-variable 'treesit-simple-imenu-settings) lilypond-ts-imenu-rules) (add-hook 'lilypond-ts-post-eval-hook #'lilypond-ts--require-list-refresh) (treesit-major-mode-setup) (set (make-local-variable 'lisp-indent-function) #'scheme-indent-function) (set (make-local-variable 'syntax-propertize-function) #'lilypond-ts--propertize-syntax) (lilypond-ts-autodoc-mode 1) (lilypond-ts-capf-mode 1) (lilypond-ts-navigation-mode 1)))))
  lilypond-ts-mode()
  funcall-interactively(lilypond-ts-mode)
  call-interactively(lilypond-ts-mode record nil)
  command-execute(lilypond-ts-mode record)
  execute-extended-command(nil "lilypond-ts-mode" "lilypond-ts-mo")
  funcall-interactively(execute-extended-command nil "lilypond-ts-mode" "lilypond-ts-mo")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)


-- 
David Kastrup
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.