Add major mode for highlighting npmrc files (Bug#77138)
* etc/NEWS: mention the new mode. * lisp/textmodes/conf-mode.el (conf-npmrc-mode-syntax-table): New variable. * lisp/textmodes/conf-mode.el (conf-npmrc-mode): New major mode derived from conf-mode for highlighting .npmrc files. * lisp/files.el (auto-mode-alist): Associate the new mode with .npmrc files.
This commit is contained in:
parent
2b7a72b117
commit
891f51fe11
3 changed files with 19 additions and 0 deletions
3
etc/NEWS
3
etc/NEWS
|
@ -1637,6 +1637,9 @@ highlight the fill-column indicators. By default this is disabled.
|
|||
|
||||
* New Modes and Packages in Emacs 31.1
|
||||
|
||||
** New major mode 'conf-npmrc-mode'.
|
||||
A major mode based on conf-mode purposed for editing ".npmrc" files.
|
||||
|
||||
** New major modes based on the tree-sitter library
|
||||
|
||||
*** New major mode 'markdown-ts-mode'.
|
||||
|
|
|
@ -3207,6 +3207,8 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" .
|
|||
("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
|
||||
("\\.toml\\'" . conf-toml-mode)
|
||||
("\\.desktop\\'" . conf-desktop-mode)
|
||||
;; Dot is excluded from npmrc, because global configs may lack it.
|
||||
("npmrc\\'" . conf-npmrc-mode)
|
||||
("/\\.redshift\\.conf\\'" . conf-windows-mode)
|
||||
("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
|
||||
("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
|
||||
|
|
|
@ -136,6 +136,13 @@ not align (only setting space according to `conf-assignment-space')."
|
|||
table)
|
||||
"Syntax table in use in Unix style `conf-mode' buffers.")
|
||||
|
||||
(defvar conf-npmrc-mode-syntax-table
|
||||
(let ((table (make-syntax-table conf-mode-syntax-table)))
|
||||
(modify-syntax-entry ?\; "<" table)
|
||||
(modify-syntax-entry ?# "<" table)
|
||||
table)
|
||||
"Syntax table in use in npmrc `conf-mode' buffers.")
|
||||
|
||||
(defvar conf-javaprop-mode-syntax-table
|
||||
(make-syntax-table conf-unix-mode-syntax-table)
|
||||
"Syntax table in use in Java properties buffers.")
|
||||
|
@ -664,6 +671,13 @@ For details see `conf-mode'.
|
|||
(conf-mode-initialize "#" 'conf-desktop-font-lock-keywords)
|
||||
(conf-quote-normal nil))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode conf-npmrc-mode conf-mode "Conf[npmrc]"
|
||||
:syntax-table conf-npmrc-mode-syntax-table
|
||||
"Conf Mode starter for .npmrc files.
|
||||
Comments start with `#' and `;'. For details see `conf-mode'."
|
||||
(conf-mode-initialize "#"))
|
||||
|
||||
(provide 'conf-mode)
|
||||
|
||||
;;; conf-mode.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue