55; ; Author: Norgate AV
66; ; Maintainer: Norgate AV
77; ; Version: 0.1.0
8- ; ; Package-Requires: ((emacs "29.1"))
8+ ; ; Package-Requires: ((emacs "29.1") (yasnippet "0.14.0") )
99; ; Keywords: languages, netlinx, amx, harman
1010; ; URL: https://github.com/Norgate-AV/emacs-netlinx-mode
1111; ; SPDX-License-Identifier: MIT
@@ -85,6 +85,19 @@ If set, enables quick access to NetLinx documentation via \\[netlinx-open-help].
8585 (treesit-install-language-grammar 'netlinx )
8686 (message " NetLinx: Grammar installation complete " )))
8787
88+ ; ; Yasnippet integration
89+ (require 'yasnippet )
90+
91+ (defun netlinx-mode--setup-snippets ()
92+ " Setup yasnippet snippets for netlinx-mode."
93+ (let ((snippets-dir (expand-file-name
94+ " snippets"
95+ (file-name-directory
96+ (or load-file-name buffer-file-name)))))
97+ (when (file-directory-p snippets-dir)
98+ (add-to-list 'yas-snippet-dirs snippets-dir t )
99+ (yas-load-directory snippets-dir))))
100+
88101; ;; Commands
89102
90103(defun netlinx-open-help ()
@@ -107,6 +120,9 @@ The file path is configured via `netlinx-mode-help-file'."
107120 ; ; Ensure grammar is installed
108121 (netlinx-mode--ensure-grammar)
109122
123+ ; ; Setup yasnippet integration if available
124+ (netlinx-mode--setup-snippets)
125+
110126 ; ; Keybindings
111127 (define-key netlinx-mode-map (kbd " C-c C-d" ) #'netlinx-open-help )
112128
0 commit comments