From 2204bb570069004b2dcd672f99a1146a5f54cb62 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Tue, 10 Jun 2025 14:38:44 +0100 Subject: [PATCH 1/2] More legible latex previews --- emacs.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs.org b/emacs.org index 4d06500..18dc65e 100644 --- a/emacs.org +++ b/emacs.org @@ -1230,6 +1230,15 @@ Use org-superstar for nice symbols (successor to org-bullets) #+end_src +Make LaTeX previews (enabled with C-c C-x C-l) a bit bigger than default + +#+begin_src elisp + (setq org-format-latex-options + '(:foreground default :background default :scale 2.0 + :html-foreground "Black" :html-background "Transparent" + :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))) +#+end_src + ** Key bindings As well as some useful agenda-related bindings, we override the From 118348e948be20023ac89b8e07eaaa6d116fa301 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Tue, 10 Jun 2025 14:38:56 +0100 Subject: [PATCH 2/2] Fix flycheck logic On a system with both shellcheck and ruff, the existing code would try to setup flycheck twice. Now we collect a list of modes while working through the file, and set up flycheck if any are present. --- emacs.org | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/emacs.org b/emacs.org index 18dc65e..e9f54c3 100644 --- a/emacs.org +++ b/emacs.org @@ -660,6 +660,12 @@ better with interactive programs like btop. :header-args: :tangle "emacs/.emacs.d/init.el" :mkdirp yes :END: +** Flycheck initial setup +Create a variable to collect flycheck mode hooks +#+begin_src elisp + (setq imrae/flycheck-modes nil) +#+end_src + ** utf-8 Stop freaking out if a file specifies UTF-8 encoding in capitals: #+begin_src elisp @@ -777,10 +783,7 @@ If shellcheck and flycheck are available we can use these for checking Bash scripts. #+BEGIN_SRC elisp (if (executable-find "shellcheck") - (use-package flycheck - :hook ((sh-mode . flycheck-mode)) - :bind (("M-n" . flycheck-next-error) - ("M-p" . flycheck-previous-error)))) + (push 'sh-mode imrae/flycheck-modes)) #+END_SRC ** Fish @@ -852,14 +855,9 @@ If we have ruff, flycheck becomes viable #+begin_src elisp (if (executable-find "ruff") - (use-package flycheck - :hook ((python-mode . flycheck-mode)) - :bind (("M-n" . flycheck-next-error) - ("M-p" . flycheck-previous-error))) - ) + (push 'python-mode imrae/flycheck-modes)) #+end_src - *** Linting and formatters It is useful to call a linter directly from the file. I used to rely on the =flake8= function which seems to have vanished, but @@ -985,6 +983,17 @@ The code lives in =~/.emacs.d/lisp= (provide 'gibbs2) #+end_src +** flycheck +#+begin_src elisp + (if imrae/flycheck-modes + (let ((hooks-list (mapcar (lambda (mode) (cons mode 'flycheck-mode)) imrae/flycheck-modes))) + (use-package flycheck + :hook hooks-list + :bind (("M-n" . flycheck-next-error) + ("M-p" . flycheck-previous-error))) + ) + ) +#+end_src * Pretty symbols :PROPERTIES: