aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/init/ycp-help.el2
-rw-r--r--emacs/.emacs.d/init/ycp-markup.el3
-rw-r--r--emacs/.emacs.d/init/ycp-prog.el2
-rw-r--r--emacs/.emacs.d/lisp/my/wiki-faces.el77
-rw-r--r--emacs/.emacs.d/lisp/my/wiki.el55
5 files changed, 97 insertions, 42 deletions
diff --git a/emacs/.emacs.d/init/ycp-help.el b/emacs/.emacs.d/init/ycp-help.el
index 9ed0831..3503a6d 100644
--- a/emacs/.emacs.d/init/ycp-help.el
+++ b/emacs/.emacs.d/init/ycp-help.el
@@ -38,6 +38,8 @@
"C-h K" #'describe-keymap ; overrides `Info-goto-emacs-key-command-node'
"C-h c" #'describe-char ; overrides `describe-key-briefly'
"C-h D" #'shortdoc-display-group
+ "C-h X" #'Info-goto-emacs-command-node
+ "C-h F" #'describe-face
)
)
diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el
index 65a9db0..fb31663 100644
--- a/emacs/.emacs.d/init/ycp-markup.el
+++ b/emacs/.emacs.d/init/ycp-markup.el
@@ -69,7 +69,8 @@
(my-keybind markdown-mode-map "<ret>" 'my-markdown-maybe-follow-thing-at-point))
;; mediawiki
-(my-package mediawiki (:delay 60))
+(my-package mediawiki)
+(my-package wiki)
(my-package ledger-mode
(:install t)
diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el
index b7db188..c6a5610 100644
--- a/emacs/.emacs.d/init/ycp-prog.el
+++ b/emacs/.emacs.d/init/ycp-prog.el
@@ -445,8 +445,6 @@
'(haskell-mode . haskell))
(add-to-list 'tree-sitter-major-mode-language-alist
'(phps-mode . php))
- (add-to-list 'tree-sitter-major-mode-language-alist
- '(wiki-mode . wiki))
;; disable tree sitter for c/c++ and use eglot instead
;; FIXME: make it so it is only disabled with eglot on
(add-to-list 'tree-sitter-major-mode-language-alist
diff --git a/emacs/.emacs.d/lisp/my/wiki-faces.el b/emacs/.emacs.d/lisp/my/wiki-faces.el
new file mode 100644
index 0000000..2c35722
--- /dev/null
+++ b/emacs/.emacs.d/lisp/my/wiki-faces.el
@@ -0,0 +1,77 @@
+;;; wiki-faces.el -- faces for wiki-mode -*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation.
+
+;; Author: Yuchen Pei <id@ypei.org>
+;; Package-Requires: ((emacs "28.2"))
+
+;; This file is part of dotted.
+
+;; dotted is free software: you can redistribute it and/or modify it under
+;; the terms of the GNU Affero General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; dotted is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
+;; Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public
+;; License along with dotted. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; faces for wiki-mode.
+
+;;; Code:
+
+(defgroup wiki-faces nil
+ "Faces in wiki mode."
+ :tag "Wiki Faces"
+ :group 'wiki-appearance)
+
+(defface wiki-level-1 '((t :inherit outline-1))
+ "Face used for level 1 headlines."
+ :group 'wiki-faces)
+
+(defvar wiki-level-1 'wiki-level-1
+ "Face used for level 1 headlines.")
+
+(defface wiki-level-2 '((t :inherit outline-2))
+ "Face used for level 2 headlines."
+ :group 'wiki-faces)
+
+(defvar wiki-level-2 'wiki-level-2
+ "Face used for level 2 headlines.")
+
+(defface wiki-level-3 '((t :inherit outline-3))
+ "Face used for level 3 headlines."
+ :group 'wiki-faces)
+
+(defvar wiki-level-3 'wiki-level-3
+ "Face used for level 3 headlines.")
+
+(defface wiki-level-4 '((t :inherit outline-4))
+ "Face used for level 4 headlines."
+ :group 'wiki-faces)
+
+(defvar wiki-level-4 'wiki-level-4
+ "Face used for level 4 headlines.")
+
+(defface wiki-level-5 '((t :inherit outline-5))
+ "Face used for level 5 headlines."
+ :group 'wiki-faces)
+
+(defvar wiki-level-5 'wiki-level-5
+ "Face used for level 5 headlines.")
+
+(defface wiki-level-6 '((t :inherit outline-6))
+ "Face used for level 6 headlines."
+ :group 'wiki-faces)
+
+(defvar wiki-level-6 'wiki-level-6
+ "Face used for level 6 headlines.")
+
+(provide 'wiki-faces)
+;;; wiki-faces.el ends here
diff --git a/emacs/.emacs.d/lisp/my/wiki.el b/emacs/.emacs.d/lisp/my/wiki.el
index 0ef52e3..2aace73 100644
--- a/emacs/.emacs.d/lisp/my/wiki.el
+++ b/emacs/.emacs.d/lisp/my/wiki.el
@@ -25,48 +25,25 @@
;; A wikitext mode.
;;; Code:
-(require 'parsec)
+(require 'wiki-faces)
+
+(defvar wiki-font-lock-keywords
+ (list
+ (cons "^======.*======$" 'wiki-level-6)
+ (cons "^=====.*=====$" 'wiki-level-5)
+ (cons "^====.*====$" 'wiki-level-4)
+ (cons "^===.*===$" 'wiki-level-3)
+ (cons "^==.*==$" 'wiki-level-2)
+ (cons "^=.*=$" 'wiki-level-1)
+ ))
-(defun wiki-file ()
- (parsec-many (wiki-block)))
-
-(defun wiki-block ()
- (parsec-or (wiki-header)))
-
-(defun wiki-header ()
- (let* ((marker (parsec-many-s (parsec-ch ?=)))
- (raw-content
- (string-trim
- (parsec-many-till-s
- (parsec-none-of ?\n)
- (parsec-try
- (parsec-and
- (parsec-str marker)
- (wiki-header-end)))))))
- (list 'Header
- (length marker)
- (parsec-with-input raw-content
- (wiki-inlines)))))
-
-(defun wiki-header-end ()
- (parsec-and
- (parsec-many (wiki-space))
- (parsec-eol-or-eof)))
-
-(defun wiki-space ()
- (parsec-one-of ?\s ?\t))
-
-(defun wiki-inlines ()
- (parsec-many (wiki-inline)))
-
-(defun wiki-inline ()
- (parsec-or (wiki-plain)))
+(define-derived-mode wiki-mode text-mode "Wiki"
+ "A wikitext mode."
-(defun wiki-plain ()
- (list 'Plain (parsec-many1-as-string (parsec-any-ch))))
+ (setq-local comment-start "<!--")
+ (setq-local comment-end "-->")
-(define-derived-mode wiki-mode text-mode "Wiki"
- "A wikitext mode.")
+ (setq-local font-lock-defaults '(wiki-font-lock-keywords t nil nil nil)))
(provide 'wiki)
;;; wiki.el ends here