aboutsummaryrefslogtreecommitdiff
path: root/STYLE_GUIDE.md
diff options
context:
space:
mode:
Diffstat (limited to 'STYLE_GUIDE.md')
-rw-r--r--STYLE_GUIDE.md44
1 files changed, 16 insertions, 28 deletions
diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md
index d1e4e6b..568f63e 100644
--- a/STYLE_GUIDE.md
+++ b/STYLE_GUIDE.md
@@ -13,40 +13,27 @@ Much of this Style Guide was taken from
13 13
14## Organization 14## Organization
15 15
16Emacs Lisp files should begin with a header. The first line of the 16Emacs Lisp files should begin with a header. The first line of the header should include the filename, a very brief comment (2-5 words), and the `-*- lexical-binding: t; -*-` thing. The next line should be `;;`, and the next should be `;;; Commentary:`, below which should be a more detailed description of the file and it's purpose, as well as any important notes or warnings.
17header should include the filename, a very brief comment (2-5 words),
18and the `-*- lexical-binding: t; -*-` thing. The next line(s) should be
19a more detailed description of the file and it's purpose.
20 17
21```elisp 18```elisp
22;;; -*- lexical-binding: t; -*- 19;;; init.el --- Init file for MMOSMacs -*- lexical-binding: t; -*-
23;;; init.el
24;; 20;;
25;; Main config file for MMOSMacs; the glue that binds the modules 21;;; Commentary:
26;; together. Provides package management, performance tweaks, and 22;; Main config file for MMOSMacs.
27;; integrates all the other MMOSMacs modules.
28``` 23```
29 24
30All Emacs Lisp files are organized into Sections and Subsections using 25All Emacs Lisp files are organized into Sections and Subsections using comment decorations. Section titles begin with `;;;` and their decorations extend up to 72 chars. Subsections begin with `;;` and their decorations extend up to 36 chars. Titles should be underlined with dashes on the proceeding line. Explanatory comments go below the
31comment decorations. Section titles begin with `;;;`, are ALL CAPS, and 26title underline, and an additional 36-or-72-char line goes at the bottom of the header.
32their decorations extend up to 72 chars. Subsections begin with `;;`
33and their decorations extend up to 36 chars. Titles should be underlined
34with dashes on the proceeding line. Explanatory comments go below the
35title underline, and an additional 36-or-72-char line goes at the bottom
36of the header.
37 27
38Each subsection should have 2 blank lines between the top line of the 28Each subsection should have 2 blank lines between the top line of the header and the bottom line of code from the previous subsection. Only one line goes between the Section header and the first Subsection, as well as between portions of code within the same subsection. 4 lines go between a new Section header and the previous bit of code.
39header and the bottom line of code from the previous subsection. Only
40one line goes between the Section header and the first Subsection, as
41well as between portions of code within the same subsection. 4 lines go
42between a new Section header and the previous bit of code.
43 29
44```elisp 30```elisp
45;; integrates all the other MMOSMacs modules. 31;;; Commentary:
32;; Main configuration file for MMOSMacs.
46 33
47 34
48;; --------------------------------------------------------------------- 35;; ---------------------------------------------------------------------
49;;; FIRST SECTION TITLE 36;;; First Section Title
50;; -------------------- 37;; --------------------
51;; Comments about the purpose of the section go here. 38;; Comments about the purpose of the section go here.
52;; It should be concise. Don't go into too much detail. 39;; It should be concise. Don't go into too much detail.
@@ -72,7 +59,8 @@ between a new Section header and the previous bit of code.
72 (setq some-crap nil)) 59 (setq some-crap nil))
73 60
74;; `something-else` is a little less 61;; `something-else` is a little less
75;; likely to be a package 62;; likely to be a package, but it
63;; wouldn't surprise me
76(use-package something-else 64(use-package something-else
77 :straight t) 65 :straight t)
78 66
@@ -87,7 +75,7 @@ between a new Section header and the previous bit of code.
87;; I really don't know what to write 75;; I really don't know what to write
88;; in these example comments. 76;; in these example comments.
89(use-package some-other-thing 77(use-package some-other-thing
90 :straight 78 :straight t
91 :init 79 :init
92 (other-thing-mode)) 80 (other-thing-mode))
93 81
@@ -107,8 +95,8 @@ between a new Section header and the previous bit of code.
107 95
108- Write heading comments with 3 semicolons, and regular comments with 2. 96- Write heading comments with 3 semicolons, and regular comments with 2.
109- Write margin comments with 1 semicolon. 97- Write margin comments with 1 semicolon.
110- Leave 1 space between the semicolons and the comment text. 98- Put a space between the semicolon and the text for heading and regular comments.
111- Comments longer than 1 word are capitalized and use punctuation. 99- Do not put a space between the semicolon and the text for margin comments.
112 100
113```elisp 101```elisp
114;;; This is a heading comment 102;;; This is a heading comment
@@ -116,7 +104,7 @@ between a new Section header and the previous bit of code.
116;; Something something something. 104;; Something something something.
117(defun foo (bar) 105(defun foo (bar)
118 (something something 106 (something something
119 something-else)) ; for some other reason 107 something-else)) ;this is a margin comment
120``` 108```
121 109
122 110