1

I noticed there is no library listed in melpa for highlighting and working with Apache Avro IDL schemata. Is there any, or else how people who work with Avro have set up their configuration to ease their work?

4
  • "how people who work with avro have set up their configuration to ease their work" is too broad. This site is more about specific how-to questions. Maybe you want to ask simply how to get syntax highlighting for avro files?
    – Drew
    Aug 9 '21 at 2:47
  • @Drew That is correct. However I’m definitely open to more encompassing answers.
    – dmvianna
    Aug 9 '21 at 3:24
  • 1
    It would help if you provided a description (and maybe some links) to what avro is. I googled it and the first hit says: " It uses JSON for defining data types and protocols...", so does a JSON library satisfy your requirements? If so, there should be plenty to choose from.
    – NickD
    Aug 9 '21 at 13:35
  • 1
    @NickD As I became more knowledgeable on the subject I was able to formulate a more precise question. I changed the wording and included a link to the specification.
    – dmvianna
    Aug 11 '21 at 13:14
1

I couldn't find anything, so I made it myself.

;;; avro-mode.el -- major mode for editing Avro IDL files. -*- coding: utf-8; lexical-binding: t; -*-

;;; Copyright © by Daniel Vianna
;;; Version: 0.0.1
;;; Created: 19 Aug 2021

;;; Keywords: languages

;;; This file is not part of GNU Emacs.

;;; License:

;;; You can redistribute this program and/or modify it under the terms of the GNU General Public License version 2.

;;; Package --- summary
;;; Commentary:
;;;
;;; Avro interface description language mode (.avdl)
;;; Code:

(require 'generic-x)

(define-generic-mode
    'avro-mode
  '("//") ;; comments
  '("protocol" "namespace") ;; reserved words
  '(("\\<[[:alnum:]]+\\>" (0 font-lock-builtin-face) ("\\<[[:alnum:]]+\\>;?\\( {\\)?" nil nil (0 nil))) ;; type
    ("\\<\\(?:namespace\\|protocol\\)\\>" . font-lock-keyword-face)
    
    ("{\\|}\\|;\\|<\\|>" . font-lock-constant-face)) ;; separators
  '("\\.avdl$") ;; file extension
  nil
  "Major mode for editing Avro IDL files."
  )

(provide 'avro-mode)

;;; avro-mode.el ends here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.