1
0
forked from alex-eg/sex

3 Commits

Author SHA1 Message Date
Pavel Kulyov
3cff3d479b sex-mode: add supported keywords, drop chicken-* 2026-10-29 15:01:50 +03:00
Pavel Kulyov
1af6cb7d50 readme: add sex-mode.el installation via quelpa 2026-10-29 14:41:06 +03:00
Pavel Kulyov
2f56739134 sex-mode: add header and footer, fix lint errors
That makes the package installable via quelpa.
2026-10-29 14:41:00 +03:00
2 changed files with 38 additions and 25 deletions

View File

@@ -289,4 +289,4 @@ To harness the power of sex-mode, add the following lines to your
:upgrade t)) :upgrade t))
#+end_src #+end_src
~.sex~ and ~.hsex~ files then open in ~sex-mode~. ~.sex~ files then open in ~sex-mode~.

View File

@@ -26,7 +26,7 @@
;; :files ("sex-mode.el") ;; :files ("sex-mode.el")
;; :upgrade t)) ;; :upgrade t))
;; ;;
;; Visiting a .sex or .hsex file turns the mode on. ;; Visiting a .sex file turns the mode on.
;;; Code: ;;; Code:
@@ -59,42 +59,55 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
(defconst sex-font-lock-keywords (defconst sex-font-lock-keywords
(eval-when-compile (eval-when-compile
(list (list
;; Declarations ;; Declarations. `pub' and `extern' are optional prefixes, so
;; `(pub fn main' highlights both keywords and the name.
(list (concat "(" (list (concat "("
(regexp-opt '("chicken-define" "\\(?:\\(pub\\|extern\\)[[:space:]]+\\)?"
"chicken-define-syntax" (regexp-opt '("define"
"chicken-import"
"chicken-load"
"define"
"defmacro" "defmacro"
"extern" "enum"
"fn"
"import" "import"
"include" "include"
"fn"
"pub"
"struct" "struct"
"var" "typedef"
"union") "union"
'word) "var")
"\\>" 'words)
"[[:space:]]*" "[[:space:]]*"
"\\([[:word:]]*\\)") "\\([[:word:]]*\\)")
'(1 font-lock-keyword-face) '(1 font-lock-keyword-face nil t)
'(2 font-lock-function-name-face)) '(2 font-lock-keyword-face)
;; Keywords '(3 font-lock-function-name-face nil t))
;; Statement and expression heads, plus the macro-language forms
;; that appear in `defmacro' bodies.
(list (concat "(" (list (concat "("
(regexp-opt '("do" (regexp-opt '("break"
"c-bit-or"
"c-bit-or="
"c-or"
"case" "case"
"case/fallthrough"
"cast"
"closure"
"continue"
"default" "default"
"if" "do"
"else"
"for" "for"
"goto" "goto"
"if"
"lambda"
"map-fields"
"return" "return"
"sizeof"
"static-assert"
"switch" "switch"
"var" "type-match"
"while") "type-of"
'word) "while"
"\\>") ":")
'words))
'(1 font-lock-builtin-face)))) '(1 font-lock-builtin-face))))
"Font-lock keywords for Sex mode.") "Font-lock keywords for Sex mode.")
@@ -134,7 +147,7 @@ Blank lines separate paragraphs. Semicolons start comments.
(sex-mode-set-variables)) (sex-mode-set-variables))
;;;###autoload ;;;###autoload
(add-to-list 'auto-mode-alist '("\\.\\(sex\\|hsex\\)\\'" . sex-mode)) (add-to-list 'auto-mode-alist '("\\.sex\\'" . sex-mode))
(provide 'sex-mode) (provide 'sex-mode)