diff --git a/ha-org.org b/ha-org.org index 87581cb..f0bcacf 100644 --- a/ha-org.org +++ b/ha-org.org @@ -696,7 +696,7 @@ Bindings specific to org files: Limit the number of exporters to the ones that I would use: #+name: ox-exporters #+begin_src emacs-lisp -(setq org-export-backends '(ascii html icalendar md odt)) + (setq org-export-backends '(ascii html md texinfo odt)) #+end_src I have a special version of tweaked [[file:elisp/ox-confluence.el][Confluence exporter]] for my org files: @@ -711,15 +711,16 @@ I have a special version of tweaked [[file:elisp/ox-confluence.el][Confluence ex And Graphviz configuration using [[https://github.com/ppareit/graphviz-dot-mode][graphviz-dot-mode]]: #+begin_src emacs-lisp -(use-package graphviz-dot-mode - :mode "\\.dot\\'" - :init - (setq tab-width 4 - graphviz-dot-indent-width 2 - graphviz-dot-auto-indent-on-newline t - graphviz-dot-auto-indent-on-braces t - graphviz-dot-auto-indent-on-semi t)) + (use-package graphviz-dot-mode + :mode "\\.dot\\'" + :init + (setq tab-width 4 + graphviz-dot-indent-width 2 + graphviz-dot-auto-indent-on-newline t + graphviz-dot-auto-indent-on-braces t + graphviz-dot-auto-indent-on-semi t)) #+end_src + *** HTML Style I’m not afraid of HTML, but I like the idea of doing my HTML work in a Lisp-like way using the [[https://github.com/tonyaldon/jack][jack-html project]]: diff --git a/ha-programming-ansible.org b/ha-programming-ansible.org index 90d1972..6d88ef4 100644 --- a/ha-programming-ansible.org +++ b/ha-programming-ansible.org @@ -33,25 +33,25 @@ Moving by lines is our default navigation mode, but for Yaml and Python, that do The obvious keybindings are ~M-h/j/k/l~ … but that is used … well, somewhat. In org files, this is a way to move the outline of subtrees around. Useful, and =spatial-navigate= wouldn’t be helpful in org files anyway. -#+begin_src emacs-lisp - (use-package spatial-navigate - :straight (:repo "https://codeberg.org/ideasman42/emacs-spatial-navigate") - :config - (pretty-hydra-define spatial-navigate (:color amaranth :quit-key "q") - ("Box" - (("k" spatial-navigate-backward-vertical-box "up") - ("j" spatial-navigate-forward-vertical-box "Down") - ("h" spatial-navigate-backward-horizontal-box "Down") - ("l" spatial-navigate-forward-horizontal-box "Down")) - "Bar" - (("K" spatial-navigate-backward-vertical-bar "up") - ("J" spatial-navigate-forward-vertical-bar "Down") - ("H" spatial-navigate-backward-horizontal-bar "Down") - ("L" spatial-navigate-forward-horizontal-bar "Down"))))) +#+begin_src emacs-lisp :tangle no + (use-package spatial-navigate + :straight (:repo "https://codeberg.org/ideasman42/emacs-spatial-navigate") + :config + (pretty-hydra-define spatial-navigate (:color amaranth :quit-key "q") + ("Box" + (("k" spatial-navigate-backward-vertical-box "up") + ("j" spatial-navigate-forward-vertical-box "Down") + ("h" spatial-navigate-backward-horizontal-box "Down") + ("l" spatial-navigate-forward-horizontal-box "Down")) + "Bar" + (("K" spatial-navigate-backward-vertical-bar "up") + ("J" spatial-navigate-forward-vertical-bar "Down") + ("H" spatial-navigate-backward-horizontal-bar "Down") + ("L" spatial-navigate-forward-horizontal-bar "Down"))))) #+end_src And we can attach this menu to the “g” section: -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle no (use-package spatial-navigate :general (:states '(normal visual motion operator) @@ -115,9 +115,6 @@ Doing a lot of [[https://github.com/yoshiki/yaml-mode][YAML work]], but the =ya ("h" ha-yaml-prev-section "Previous")))))) #+end_src -#+RESULTS: -: major-mode-hydras/yaml-ts-mode/body - Allow this mode in Org blocks: #+begin_src emacs-lisp :results silent (add-to-list 'org-babel-load-languages '(yaml-ts . t)) @@ -202,12 +199,20 @@ I adapted this code from the [[https://github.com/emacsmirror/poly-ansible][poly #+end_src We need to make sure the =mixed-pitch-mode= doesn’t screw things up. + #+begin_src emacs-lisp (add-hook 'poly-yaml-jinja2-mode-hook (lambda () (mixed-pitch-mode -1))) - - ;; (add-hook 'yaml-ts-mode-hook 'poly-yaml-jinja2-mode) #+end_src -#+begin_src yaml-ts + +We /can/ hook this up to Org, via: + +#+begin_src emacs-lisp + (add-to-list 'org-babel-load-languages '(poly-yaml-jinja2 . t)) +#+end_src + +Now we can use either =yaml-ts= or =poly-yaml-jinja2= (which perhaps we should make an alias?): + +#+begin_src poly-yaml-jinja2 :tangle no --- # Let's see how this works - name: Busta move @@ -244,6 +249,7 @@ The YAML files get access Ansible’s documentation using the [[https://github.c #+begin_src emacs-lisp (use-package ansible-doc + :after yaml-ts-mode :hook (yaml-ts-mode . ansible-doc-mode) :config ;; (add-to-list 'exec-path (expand-file-name "~/.local/share/mise/installs/python/3.10/bin/ansible-doc")) diff --git a/ha-programming.org b/ha-programming.org index 419f772..156a3f3 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -213,6 +213,7 @@ Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Spe #+begin_src emacs-lisp (use-package flycheck + :straight (:host github :repo "flycheck/flycheck") :init (setq next-error-message-highlight t) :bind (:map flycheck-error-list-mode-map @@ -1115,7 +1116,6 @@ Most project =README= files and other documentation use [[https://jblevins.org/p Also, I like Markdown is look like a word processor, similarly to my org files: #+begin_src emacs-lisp (use-package markdown-mode - :straight (:host github :repo "jrblevin/markdown-mode") :mode ((rx ".md" string-end) . gfm-mode) :init (setq markdown-command (expand-file-name "markdown" "~/bin") markdown-open-command (expand-file-name "markdown-open" "~/bin") @@ -1135,38 +1135,25 @@ Also, I like Markdown is look like a word processor, similarly to my org files: ", e" '("export" . markdown-export) ", p" '("preview" . markdown-preview))) #+end_src + Note that the markdown-specific commands use the ~C-c C-c~ and ~C-c C-s~ prefixes. -With the =markdown-header-scaling= set, we no longer need to color the headers in Markdown, nor many of the /garish/ colors. +Let’s make sure that [[https://www.flycheck.org/en/latest/languages.html#markdown][markdown]] is proper using [[https://pypi.org/project/pymarkdownlnt/][PyMarkdown]]. First, get the script installed globally: + +#+begin_src sh + pip install pymarkdown +#+end_src + +And then we can use it. For some reason, the =pymarkdown= (which I need to use from work) doesn’t seem to be part of the version of Flycheck available on Melpa, so… + #+begin_src emacs-lisp (use-package markdown-mode - :after org + :after flycheck :config - (let ((default-color (face-attribute 'default :foreground))) - (set-face-attribute 'markdown-italic-face nil :foreground 'unspecified) - (set-face-attribute 'markdown-bold-face nil :foreground 'unspecified) - (set-face-attribute 'markdown-pre-face nil - :foreground (face-attribute 'org-code :foreground)) - (set-face-attribute 'markdown-code-face nil - :background (face-attribute 'org-block :background)) - (set-face-attribute 'markdown-language-keyword-face nil - :foreground (face-attribute 'org-block-begin-line :foreground)) - (set-face-attribute 'markdown-url-face nil - :foreground (face-attribute 'font-lock-comment-face :foreground)) - (set-face-attribute 'markdown-header-face nil - :font ha-variable-header-font - :foreground default-color) - (when window-system - (dolist (level '(1 2 3 4)) - (let ((md-level (make-face (make-symbol (format "markdown-header-face-%d" level)))) - (org-level (nth (1- level) org-level-faces))) - (message "Setting %s size %.1f to %s" org-level (face-attribute org-level :height) md-level) - (print `(set-face-attribute ,md-level nil - :height ,(face-attribute org-level :height))) - (set-face-attribute md-level nil :foreground default-color - :height (face-attribute org-level :height))))))) - + (setq flycheck-markdown-pymarkdown-config ".pymarkdown.yml") + (flycheck-may-enable-checker 'markdown-pymarkdown)) + ;; defcustom flycheck-markdown-pymarkdown-config #+end_src Both the =markdown-command= and the =markdown-open-command= variables are called to render (and preview) a Markdown file (~C-c C-c o~), and calls the following scripts (which in turn, call =pandoc= as I depend on this for other org-related features):