[emacs] add naming conventions
[~bandali/configs] / emacs / init.org
index b0570d3..5aa530e 100644 (file)
@@ -5,9 +5,18 @@
 
 TODO: description
 
 
 TODO: description
 
-TODO: toc
+* Contents                                                   :toc_1:noexport:
+
+- [[#intro][Intro]]
+- [[#header][Header]]
+- [[#initial-setup][Initial setup]]
+- [[#config][Config]]
+- [[#footer][Footer]]
 
 * Header
 
 * Header
+:PROPERTIES:
+:CUSTOM_ID: header
+:END:
 
 ** First line
 
 
 ** First line
 
@@ -50,7 +59,28 @@ file.
 ;; THIS FILE IS AUTO-GENERATED FROM `init.org'.
 #+end_src
 
 ;; THIS FILE IS AUTO-GENERATED FROM `init.org'.
 #+end_src
 
+** Naming conventions
+
+The conventions below were inspired by [[https://github.com/hlissner/doom-emacs][Doom]]'s conventions, found
+[[https://github.com/hlissner/doom-emacs/blob/5dacbb7cb1c6ac246a9ccd15e6c4290def67757c/core/core.el#L3-L17][here]]. Naturally, I use my initials, =ab=, instead of =doom=.
+
+#+begin_src emacs-lisp :comments none
+;; Naming conventions:
+;;
+;;   ab-...   public variables or non-interactive functions
+;;   ab--...  private anything (non-interactive), not safe for direct use
+;;   ab/...   an interactive function; safe for M-x or keybinding
+;;   ab:...   an evil operator, motion, or command
+;;   ab|...   a hook function
+;;   ab*...   an advising function
+;;   ab@...   a hydra command
+;;   ab!...   a macro
+#+end_src
+
 * Initial setup
 * Initial setup
+:PROPERTIES:
+:CUSTOM_ID: initial-setup
+:END:
 
 #+begin_src emacs-lisp :comments none
 ;;; Code:
 
 #+begin_src emacs-lisp :comments none
 ;;; Code:
@@ -63,10 +93,10 @@ Measure and display startup time. Also, temporarily increase
 collection frequency. Taken from [[https://github.com/dieggsy/dotfiles/tree/3d95bc08033920e077855caf545a975eba52d28d/emacs.d#startup-time][here]].
 
 #+begin_src emacs-lisp
 collection frequency. Taken from [[https://github.com/dieggsy/dotfiles/tree/3d95bc08033920e077855caf545a975eba52d28d/emacs.d#startup-time][here]].
 
 #+begin_src emacs-lisp
-(defconst aminb/emacs-start-time (current-time))
-(defconst aminb/gc-cons-threshold gc-cons-threshold)
-(defconst aminb/gc-cons-percentage gc-cons-percentage)
-(defvar aminb/file-name-handler-alist file-name-handler-alist)
+(defconst ab--emacs-start-time (current-time))
+(defconst ab--gc-cons-threshold gc-cons-threshold)
+(defconst ab--gc-cons-percentage gc-cons-percentage)
+(defvar ab--file-name-handler-alist file-name-handler-alist)
 (setq gc-cons-threshold 400000000
       gc-cons-percentage 0.6
       file-name-handler-alist nil
 (setq gc-cons-threshold 400000000
       gc-cons-percentage 0.6
       file-name-handler-alist nil
@@ -80,11 +110,11 @@ Reset the variables back to default after init.
 (add-hook
  'after-init-hook
  `(lambda ()
 (add-hook
  'after-init-hook
  `(lambda ()
-    (setq gc-cons-threshold aminb/gc-cons-threshold
-         gc-cons-percentage aminb/gc-cons-percentage
-         file-name-handler-alist aminb/file-name-handler-alist)
+    (setq gc-cons-threshold ab--gc-cons-threshold
+         gc-cons-percentage ab--gc-cons-percentage
+         file-name-handler-alist ab--file-name-handler-alist)
     (let ((elapsed (float-time (time-subtract (current-time)
     (let ((elapsed (float-time (time-subtract (current-time)
-                                             aminb/emacs-start-time))))
+                                             ab--emacs-start-time))))
       (message "Loading %s...done (%.3fs) [after-init]"
               ,load-file-name elapsed))))
 #+end_src
       (message "Loading %s...done (%.3fs) [after-init]"
               ,load-file-name elapsed))))
 #+end_src
@@ -143,7 +173,7 @@ hacker.
 *** =use-package=
 
 #+begin_quote
 *** =use-package=
 
 #+begin_quote
-A use-package declaration for simplifying your .emacs.
+A use-package declaration for simplifying your .emacs
 #+end_quote
 
 =use-package= is an awesome utility for managing and configuring
 #+end_quote
 
 =use-package= is an awesome utility for managing and configuring
@@ -159,7 +189,7 @@ performance. So let's install it using =striaght.el= and have it use
 ** No littering in =~/.emacs.d=
 
 #+begin_quote
 ** No littering in =~/.emacs.d=
 
 #+begin_quote
-Help keeping ~/.emacs.d clean.
+Help keeping ~/.emacs.d clean
 #+end_quote
 
 By default, even for Emacs' built-in packages, the configuration files
 #+end_quote
 
 By default, even for Emacs' built-in packages, the configuration files
@@ -200,6 +230,11 @@ variable.
       version-control t)
 #+end_src
 
       version-control t)
 #+end_src
 
+* Config
+:PROPERTIES:
+:CUSTOM_ID: config
+:END:
+
 ** Org
 
 #+begin_src emacs-lisp
 ** Org
 
 #+begin_src emacs-lisp
@@ -209,6 +244,9 @@ variable.
 #+end_src
 
 * Footer
 #+end_src
 
 * Footer
+:PROPERTIES:
+:CUSTOM_ID: footer
+:END:
 
 #+begin_src emacs-lisp :comments none
 ;;; init.el ends here
 
 #+begin_src emacs-lisp :comments none
 ;;; init.el ends here