-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomeega-poly-elisp.el
84 lines (76 loc) · 3.14 KB
/
comeega-poly-elisp.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
;;; comeega-poly-elisp.el --- Comeega-polymode for emacs-lisp-mode -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2021-2022 Mohsen BANAN - http://mohsen.1.banan.byname.net/contact
;;
;; Author: Mohsen BANAN <[email protected]>
;; Maintainer: Mohsen BANAN <[email protected]>
;; Created: February 03, 2022
;; Keywords: languages lisp
;; Homepage: https://github.com/bx-blee/comment-block
;; Package-Requires: ((emacs "26.1"))
;; Package-Version: 0.1
;;
;; This file is not part of GNU Emacs.
;; This file is part of Blee (ByStar Libre-Halaal Emacs Environment).
;;
;; This is Libre-Halaal Software intended to perpetually remain Libre-Halaal.
;; See http://mohsen.1.banan.byname.net/PLPC/120033 for details.
;; _Copyleft_: GNU AFFERO GENERAL PUBLIC LICENSE --- [[file:../LICENSE]]
;;
;;; Commentary:
;;
;; Comeega-polymode for emacs-lisp-mode enhanced with org-mode.
;;
;; Inculsion of block comments in elisp file is based on the
;; [[https://github.com/bx-blee/comment-block][comment-block]] package.
;;
;; Comeega-poly-elisp-org block-comment open tag is: "(orgCmntBegin"
;; Comeega-poly-elisp-org block-comment close tag is: "orgCmntEnd)"
;;
;; Comeega-poly-elisp-org doc-string open tag is: "#+org_begin"
;; Comeega-poly-elisp-org doc-string close tag is: "#+org_end"
;;
;; Smoke test file for this comeega-polymode is: [[file: ./examples/NOTYET ]]
;;
;;; Code:
(require 'polymode)
(require 'org)
(require 'org-src)
(define-hostmode comeega-poly-emacs-lisp-hostmode
:mode 'emacs-lisp-mode
;; temporary
:protect-font-lock t
:protect-syntax t
:protect-indent t)
(define-innermode comeega-poly-elisp-org-cmnt-innermode nil
"Innermode for matching comeega fragments in `org-mode'"
:mode 'org-mode
:head-matcher "[ \t]*#\\+begin_org.*\n"
:tail-matcher "[ \t]*#\\+end_org.*\n"
:head-mode 'host
:tail-mode 'host)
(define-innermode comeega-poly-elisp-org-docStr-innermode nil
"Innermode for matching comeega fragments in `org-mode'"
:mode 'org-mode
:head-matcher "(orgCmntBegin.*\n"
:tail-matcher "orgCmntEnd).*\n"
:head-mode 'host
:tail-mode 'host)
(define-polymode comeega-poly-emacs-lisp-mode
:hostmode 'comeega-poly-emacs-lisp-hostmode
:innermodes '(comeega-poly-elisp-org-cmnt-innermode comeega-poly-elisp-org-docStr-innermode)
(setq-local org-src-fontify-natively nil)
(setq-local polymode-move-these-minor-modes-from-old-buffer
(append '(org-indent-mode)
polymode-move-these-minor-modes-from-old-buffer))
(setq-local polymode-run-these-before-change-functions-in-other-buffers
(append '(org-before-change-function
org-element--cache-before-change
org-table-remove-rectangle-highlight)
polymode-run-these-before-change-functions-in-other-buffers))
(setq-local polymode-run-these-after-change-functions-in-other-buffers
(append '(org-element--cache-after-change)
polymode-run-these-after-change-functions-in-other-buffers)))
;; (add-to-list 'auto-mode-alist '("\\.el\\'" . comeega-poly-emacs-lisp-mode))
(provide 'comeega-poly-elisp)
;;; comeega-poly-elisp.el ends here