better layer organization

This commit is contained in:
Phuntsok Drak-pa 2019-07-21 17:24:46 +02:00
parent c26c659c32
commit c11528aa72
5 changed files with 95 additions and 37 deletions

View File

@ -11,22 +11,35 @@
- [[#key-bindings][Key bindings]]
* Description
This layer adds support for conlanging.
This layer adds support for conlanging.
** Features:
- Conversion from translittion to other alphabets
- Open linguistic files
- Conversion from translittion to other alphabets
- Open linguistic files
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =conlanging= to the existing =dotspacemacs-configuration-layers= list in this
file.
To install this layer, either clone this project in your =~/.emacs.d/private/=
folder, or symlink it from there to your actual clone location. Then, add
=conlanging= in your dotspacemacs file in the
=dotspacemacs-configuration-layers= list:
#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers '(conlanging))
#+end_src
You can then reload your configuration file with ~SPC f e R~, or restart Emacs
with ~SPC q r~ or ~SPC q R~.
* Key bindings
| Key Binding | Description |
|---------------+-----------------------------------------------------|
| ~SPC o l m o~ | Open ~matter.org~ file |
| ~SPC o l m r~ | Translate Mattér translitteration into runes |
| ~SPC o l m l~ | Translate Mattér translitteration into native latin |
| ~SPC o l m h~ | Open ~hjepl.org~ file |
| Key Binding | Description |
|---------------+---------------------------------------------------------|
| ~SPC o l e o~ | Open ~einnlanda.org~ file |
| ~SPC o l e r~ | Translate Einnlandish transliteration into runes |
| ~SPC o l e l~ | Translate Einnlandish transliteration into native latin |
| ~SPC o l h o~ | Open Einnlandics ~hjelp.org~ file |
| ~SPC o l m o~ | Open Mattérs ~matter.org~ file |
| ~SPC o l m r~ | Translate Mattér transliteration into runes |
| ~SPC o l m l~ | Translate Mattér transliteration into native latin |
| ~SPC o l n o~ | Open Ňyqys ~nyqy.org~ file |
| ~SPC o l t o~ | Open Tãsos ~taso.org~ file |

View File

@ -58,7 +58,8 @@
("é " . "\\\\oe")))
(defun conlanging//replace-string-by-char (t-string t-correspondance-table)
"Return a copy of t-string converted with the correspondance table"
"Return a copy of t-string converted with the correspondance
table"
(while t-correspondance-table
(let ((cur-from-char (car (car t-correspondance-table)))
(cur-to-char (cdr (car t-correspondance-table))))
@ -69,8 +70,8 @@
t-string)
(defun conlanging//get-boundary ()
"Get the boundary of either the selected region, or if there is none the
word the cursor is over"
"Get the boundary of either the selected region, or if there is
none the word the cursor is over"
(interactive)
(let* ((beg (region-beginning))
(end (region-end))
@ -80,10 +81,11 @@ word the cursor is over"
(cons beg end))))
(defun conlanging//replace-char-by-table (correspondance-table)
"Replaces selected texts strings according to the table passed as argument. The
table is a list of pairs, the first element of the pair is a regex to be
searched in the selected text and the second element of the pair the string it
has to be replaced with."
"Replaces selected texts strings according to the table passed
as argument. The table is a list of pairs, the first element of
the pair is a regex to be searched in the selected text and the
second element of the pair the string it has to be replaced
with."
(let* ((cur-boundary (conlanging//get-boundary))
(beg (car cur-boundary))
(end (cdr cur-boundary)))
@ -96,15 +98,17 @@ has to be replaced with."
(defun conlanging/matter-to-runes ()
"Replaces translitterated Mattér to its runic writing system"
"Replaces transliterated Mattér to its runic writing system"
(interactive)
(conlanging//replace-char-by-table latin-to-runes-table))
(defun conlanging/matter-to-native-latin ()
"Replaces translitterated Mattér to its native latin writing system"
"Replaces transliterated Mattér by its corresponding native
latin writing system"
(interactive)
(conlanging//replace-char-by-table latin-to-native-table))
(defun conlanging/matter-to-latex-runes ()
"Replaces transliterated Mattér by its corresponding runes"
(interactive)
(conlanging//replace-char-by-table latin-to-latex-runes))

43
keybindings.el Normal file
View File

@ -0,0 +1,43 @@
;;; packages.el --- conlanging layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Lucien Cartier-Tilet <phundrak@phundrak.fr>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(spacemacs/declare-prefix "ol" "conlanging")
(spacemacs/declare-prefix "olh" "Hjelp")
(spacemacs/declare-prefix "olho" "hjelp.org")
(spacemacs/declare-prefix "olm" "Mattér")
(spacemacs/declare-prefix "olmo" "matter.org")
(spacemacs/declare-prefix "ole" "Einnlanda")
(spacemacs/declare-prefix "oleo" "einnlanda.org")
(spacemacs/declare-prefix "oln" "Ňyqy")
(spacemacs/declare-prefix "olno" "nyqy.org")
(spacemacs/declare-prefix "olt" "Tãso")
(spacemacs/declare-prefix "olto" "taso.org")
(spacemacs/declare-prefix-for-mode 'org-mode "ml" "conlanging")
(spacemacs/declare-prefix-for-mode 'org-mode "mlm" "Mattér")
(spacemacs/set-leader-keys
"olho" (lambda () (interactive)
(find-file "~/Documents/code/web/langue-phundrak-fr/hjelp.org"))
"olmo" (lambda () (interactive)
(find-file "~/Documents/code/web/langue-phundrak-fr/matter.org"))
"olno" (lambda () (interactive)
(find-file "~/Documents/code/web/langue-phundrak-fr/nyqy.org"))
"oleo" (lambda () (interactive)
(find-file "~/Documents/code/web/langue-phundrak-fr/einnlanda.org"))
"olto" (lambda () (interactive)
(find-file "~/Documents/code/web/langue-phundrak-fr/taso.org")))
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"lmr" 'conlanging/matter-to-runes
"lml" 'conlanging/matter-to-native-latin
"lmL" 'conlanging/matter-to-latex-runes)
;;; keybindings.el ends here

14
layers.el Normal file
View File

@ -0,0 +1,14 @@
;;; funcs.el --- Conlanging Layer functions File for Spacemacs
;;
;; Copyright (c) 2019-2020 Lucien Cartier-Tilet
;;
;; Author: Lucien Cartier-Tilet <phundrak@phundrak.fr>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(configuration-layer/declare-layer 'conlanging)
;;; layers.el ends here

View File

@ -1,16 +0,0 @@
;;; packages.el --- conlanging layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Lucien Cartier-Tilet <phundrak@phundrak.fr>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defconst conlanging-packages
'())
;;; packages.el ends here