docs(emacs-lisp): insert :added: properties in demos

To help identify when they (and future functions/macros) were added.
This commit is contained in:
Henrik Lissner 2022-06-17 14:43:36 +02:00
parent cb03d3258d
commit d67dcf1940
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -3,7 +3,8 @@
This file contains demos of Doom's public API; its core library, macros, and This file contains demos of Doom's public API; its core library, macros, and
autodefs. It is used by the =elisp-demos= package to display examples of their autodefs. It is used by the =elisp-demos= package to display examples of their
usage from their documentation (e.g. =SPC h f add-hook\!=). usage in the documentation displayed by either ~describe-function~ or
~helpful-function~ (on [[kbd:][SPC h f]]).
* Table of Contents :TOC_3: * Table of Contents :TOC_3:
- [[#core-lib][core-lib]] - [[#core-lib][core-lib]]
@ -37,6 +38,9 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
* core-lib * core-lib
** add-hook! ** add-hook!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; With only one hook and one function, this is identical to `add-hook'. In that ;; With only one hook and one function, this is identical to `add-hook'. In that
;; case, use that instead. ;; case, use that instead.
@ -65,7 +69,13 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
#+end_src #+end_src
** TODO add-transient-hook! ** TODO add-transient-hook!
:PROPERTIES:
:added: pre-3.0.0
:END:
** after! ** after!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;;; `after!' will take: ;;; `after!' will take:
@ -92,6 +102,9 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
(after! python ...) (after! python ...)
#+end_src #+end_src
** appendq! ** appendq!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(let ((x '(a b c))) (let ((x '(a b c)))
(appendq! x '(c d e)) (appendq! x '(c d e))
@ -113,6 +126,9 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
: (a b c c d e f g h) : (a b c c d e f g h)
** custom-set-faces! ** custom-set-faces!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(custom-set-faces! (custom-set-faces!
'(outline-1 :weight normal) '(outline-1 :weight normal)
@ -145,6 +161,9 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
#+end_src #+end_src
** custom-theme-set-faces! ** custom-theme-set-faces!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(custom-theme-set-faces! 'doom-one (custom-theme-set-faces! 'doom-one
'(outline-1 :weight normal) '(outline-1 :weight normal)
@ -177,14 +196,26 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
#+end_src #+end_src
** TODO defer-feature! ** TODO defer-feature!
:PROPERTIES:
:added: pre-3.0.0
:END:
** TODO defer-until! ** TODO defer-until!
:PROPERTIES:
:added: pre-3.0.0
:END:
** disable-packages! ** disable-packages!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; Disable packages enabled by DOOM ;; Disable packages enabled by DOOM
(disable-packages! some-package second-package) (disable-packages! some-package second-package)
#+end_src #+end_src
** doom! ** doom!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(doom! :completion (doom! :completion
company company
@ -215,6 +246,9 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
#+end_src #+end_src
** file-exists-p! ** file-exists-p!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(file-exists-p! "init.el" doom-emacs-dir) (file-exists-p! "init.el" doom-emacs-dir)
#+end_src #+end_src
@ -232,11 +266,17 @@ usage from their documentation (e.g. =SPC h f add-hook\!=).
: /home/hlissner/.emacs.d/LICENSE : /home/hlissner/.emacs.d/LICENSE
** cmd! ** cmd!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(map! "C-j" (cmd! (newline) (indent-according-to-mode))) (map! "C-j" (cmd! (newline) (indent-according-to-mode)))
#+end_src #+end_src
** cmd!! ** cmd!!
:PROPERTIES:
:added: pre-3.0.0
:END:
When ~newline~ is passed a numerical prefix argument (=C-u 5 M-x newline=), it When ~newline~ is passed a numerical prefix argument (=C-u 5 M-x newline=), it
inserts N newlines. We can use ~cmd!!~ to easily create a keybinds that bakes in inserts N newlines. We can use ~cmd!!~ to easily create a keybinds that bakes in
the prefix arg into the command call: the prefix arg into the command call:
@ -256,6 +296,9 @@ Or to create aliases for functions that behave differently:
#+end_src #+end_src
** cmds! ** cmds!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(map! :i [tab] (cmds! (and (featurep! :editor snippets) (map! :i [tab] (cmds! (and (featurep! :editor snippets)
(bound-and-true-p yas-minor-mode) (bound-and-true-p yas-minor-mode)
@ -276,12 +319,18 @@ Or to create aliases for functions that behave differently:
#+end_src #+end_src
** kbd! ** kbd!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(map! "," (kbd! "SPC") (map! "," (kbd! "SPC")
";" (kbd! ":")) ";" (kbd! ":"))
#+end_src #+end_src
** letenv! ** letenv!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(letenv! (("SHELL" "/bin/sh")) (letenv! (("SHELL" "/bin/sh"))
(shell-command-to-string "echo $SHELL")) (shell-command-to-string "echo $SHELL"))
@ -291,6 +340,9 @@ Or to create aliases for functions that behave differently:
: "/bin/sh\n" : "/bin/sh\n"
** load! ** load!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;;; Lets say we're in ~/.doom.d/config.el ;;; Lets say we're in ~/.doom.d/config.el
(load! "lisp/module") ; loads ~/.doom.d/lisp/module.el (load! "lisp/module") ; loads ~/.doom.d/lisp/module.el
@ -302,6 +354,9 @@ Or to create aliases for functions that behave differently:
#+end_src #+end_src
** map! ** map!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(map! :map magit-mode-map (map! :map magit-mode-map
:m "C-r" 'do-something ; C-r in motion state :m "C-r" 'do-something ; C-r in motion state
@ -397,6 +452,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
#+end_src #+end_src
** package! ** package!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; To install a package that can be found on ELPA or any of the sources ;; To install a package that can be found on ELPA or any of the sources
;; specified in `straight-recipe-repositories': ;; specified in `straight-recipe-repositories':
@ -429,6 +487,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
#+end_src #+end_src
** pushnew! ** pushnew!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(let ((list '(a b c))) (let ((list '(a b c)))
(pushnew! list 'c 'd 'e) (pushnew! list 'c 'd 'e)
@ -439,6 +500,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
: (e d a b c) : (e d a b c)
** prependq! ** prependq!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(let ((x '(a b c))) (let ((x '(a b c)))
(prependq! x '(c d e)) (prependq! x '(c d e))
@ -460,11 +524,17 @@ These are side-by-side comparisons, showing how to bind keys with and without
: (c d e f g h a b c) : (c d e f g h a b c)
** quiet! ** quiet!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; Enters recentf-mode without extra output ;; Enters recentf-mode without extra output
(quiet! (recentf-mode +1)) (quiet! (recentf-mode +1))
#+end_src #+end_src
** remove-hook! ** remove-hook!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; With only one hook and one function, this is identical to `remove-hook'. In ;; With only one hook and one function, this is identical to `remove-hook'. In
;; that case, use that instead. ;; that case, use that instead.
@ -483,6 +553,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
(remove-hook! (one-mode second-mode) (setq v 5) (setq a 2)) (remove-hook! (one-mode second-mode) (setq v 5) (setq a 2))
#+end_src #+end_src
** setq! ** setq!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Each of these have a setter associated with them, which must be triggered in ;; Each of these have a setter associated with them, which must be triggered in
;; order for their new values to have an effect. ;; order for their new values to have an effect.
@ -491,6 +564,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
evil-want-C-d-scroll nil) evil-want-C-d-scroll nil)
#+end_src #+end_src
** setq-hook! ** setq-hook!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; Set multiple variables after a hook ;; Set multiple variables after a hook
(setq-hook! 'markdown-mode-hook (setq-hook! 'markdown-mode-hook
@ -503,6 +579,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
#+end_src #+end_src
** unsetq-hook! ** unsetq-hook!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
(unsetq-hook! 'markdown-mode-hook line-spacing) (unsetq-hook! 'markdown-mode-hook line-spacing)
@ -517,6 +596,9 @@ These are side-by-side comparisons, showing how to bind keys with and without
#+end_src #+end_src
** use-package! ** use-package!
:PROPERTIES:
:added: pre-3.0.0
:END:
#+begin_src emacs-lisp :eval no #+begin_src emacs-lisp :eval no
;; Use after-call to load package before hook ;; Use after-call to load package before hook
(use-package! projectile (use-package! projectile