From c1e21065ac8e79c57105cbdf86e63b4822009fbf Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Sun, 10 Apr 2022 03:04:22 +0000 Subject: [PATCH] fix flyspell and theme loading --- config.org | 145 ++++++++++++++++++++++++++--------------------- 1 files changed, 80 insertions(+), 65 deletions(-) diff --git a/config.org b/config.org index 9e81ea7..8a03153 100644 --- a/config.org +++ b/config.org @@ -22,48 +22,36 @@ Theme switcher, using a cond allows loading of many preconfigured themes which can be switched between easily. Zenburn theme is my default. #+BEGIN_SRC emacs-lisp - (setq emacs-theme 'zenburn) - (defun disable-all-themes () (dolist (i custom-enabled-themes) (disable-theme i))) - (cond ((eq emacs-theme 'zenburn) - (use-package zenburn-theme - :init - (disable-all-themes) - :config - (load-theme 'zenburn t))) - ((eq emacs-theme 'doom-one) - (use-package doom-themes - :init - (disable-all-themes) - :config - (setq doom-themes-enable-bolt t - doom-themes-enable-italic t) - (load-theme 'doom-one t) - (doom-themes-visual-bell-config) - (doom-themes-org-config))) - ((eq emacs-theme 'nord) - (use-package nord-theme - :init - (disable-all-themes) - :config - (load-theme 'nord t))) - ((eq emacs-theme 'solarized) - (use-package solarized-theme - :init - (disable-all-themes) - :config - (load-theme 'solarized-dark t))) - ((eq emacs-theme 'jetbrains-darcula) - (use-package jetbrains-darcula-theme - :init - (disable-all-themes) - :config - (load-theme 'jetbrains-darcula t))) - ((eq emacs-theme 'none) - (disable-all-themes))) + (defun set-theme (theme) + "Set the theme with theme downloading" + (interactive "SWhat theme to load? ") + (cond ((eq theme 'zenburn) + (use-package zenburn-theme)) + ((string-match-p "^doom" "doom-one") + (use-package doom-themes + :config + (setq doom-themes-enable-bolt t + doom-themes-enable-italic t) + (doom-themes-visual-bell-config) + (doom-themes-org-config))) + ((eq theme 'nord) + (use-package nord-theme)) + ((eq theme 'solarized) + (use-package solarized-theme)) + ((eq theme 'jetbrains-darcula) + (use-package jetbrains-darcula-theme)) + ((eq theme 'none) + (disable-all-themes))) + (setq emacs-theme theme) + (when (not (eq theme 'none)) + (load-theme theme t)) + (message (format "Theme set to: %s" theme))) + + (set-theme 'zenburn) #+END_SRC ** Default font @@ -104,20 +92,11 @@ Use aspell for spellchecking. Auto-enable in latex and org as they're the main writing modes. #+BEGIN_SRC emacs-lisp - ;; (require 'ispell) - ;; (setq-default ispell-program-name "aspell") - ;; (setq-default ispell-local-dictionary "en_AU") - ;; (add-hook 'tex-mode-hook 'flyspell-mode) - ;; (add-hook 'latex-mode-hook 'flyspell-mode) - ;; (add-hook 'TeX-mode-hook 'flyspell-mode) - ;; (add-hook 'LaTeX-mode-hook 'flyspell-mode) - ;; (add-hook 'latex-mode-hook 'flyspell-buffer) - ;; (add-hook 'org-mode-hook 'flyspell-mode) - ;; (add-hook 'org-mode-hook 'flyspell-buffer) - ;; (diminish 'flyspell-mode) (use-package flyspell - :hook (tex-mode latex-mode TeX-mode LaTeX-mode org-mode) + :hook ((tex-mode latex-mode TeX-mode LaTeX-mode org-mode text-mode) . flyspell-mode) :diminish flyspell-mode + :init + (require 'ispell) :config (setq-default ispell-program-name "aspell") (setq-default ispell-local-dictionary "en_AU")) @@ -178,23 +157,22 @@ ** Helm core Helm aids the user interface for emacs. Adds visual and auto-complete feedback for emacs commands. #+BEGIN_SRC emacs-lisp - (use-package helm-config - :ensure helm + (use-package helm :bind (("M-x" . helm-M-x) ("C-x C-f" . helm-find-files) ("M-y" . helm-show-kill-ring) ("C-x b" . helm-mini) ("C-c h o" . helm-occur)) :config - (setq helm-M-x-fuzzy-match t) - (setq helm-buffers-fuzzy-matching t - helm-recentf-fuzzy-match t) - (setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window + (setq helm-mode-fuzzy-match t + helm-completion-in-regionfuzzy-match t + helm-split-window-inside-p t ; open helm buffer inside current window, not occupy whole other window helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source. helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp. helm-scroll-amount 8 ; scroll 8 lines other window using M-<next>/M-<prior> helm-ff-file-name-history-use-recentf t - helm-echo-input-in-header-line t) + helm-echo-input-in-header-line t + completion-styles '(flex)) (defun spacemacs//helm-hide-minibuffer-maybe () "Hide minibuffer in Helm session if we use the header line as input field." (when (with-helm-buffer helm-echo-input-in-header-line) @@ -208,7 +186,12 @@ 'spacemacs//helm-hide-minibuffer-maybe) (helm-mode 1)) #+END_SRC - +*** Helm git +Give helm git awareness. +#+BEGIN_SRC emacs-lisp + (use-package helm-ls-git + :bind (("C-x C-d" . helm-browse-project))) +#+END_SRC ** Projectile Projectile is project management framework for emacs. Helps in navigation and management of projects. @@ -714,6 +697,12 @@ (use-package highlight-indentation :hook (prog-mode . highlight-indentation-mode)) #+END_SRC + +** Auto revert mode +Update unchanged buffers if underlying file changes. +#+BEGIN_SRC emacs-lisp + (global-auto-revert-mode) +#+END_SRC * Mode line tweaks Diminish is used but is included in init.el such that it can be used throughout this document ** Spaceline @@ -724,7 +713,6 @@ (require 'spaceline-config) (setq spaceline-buffer-encoding-abbrev-p t) (setq spaceline-line-column-p t) - (setq spaceline-line-p t) (setq powerline-default-separator (quote arrow)) (spaceline-spacemacs-theme) (spaceline-helm-mode)) @@ -800,7 +788,8 @@ rust-mode sh-mode ;; verilog-mode - go-mode) . lsp)) + go-mode + python-mode) . lsp)) :init (setq lsp-keymap-prefix "C-c l") :commands lsp @@ -905,7 +894,7 @@ (add-hook 'magit-process-prompt-functions #'magit-process-general-yn-prompt-hook) #+END_SRC -*** Gerrit integration +*** COMMENT Gerrit integration Gerrit takes ~origin:refs/for/master~ as a destination. Enable magit to work with its oddities. #+BEGIN_SRC emacs-lisp @@ -958,6 +947,18 @@ ("M-RET" . 'srefactor-refactor-at-point) :map c++-mode-map ("M-RET" . 'srefactor-refactor-at-point))) +#+END_SRC + +** Tree sitter +Parser library. +Provides better syntax highlighting and some other neat features. +#+BEGIN_SRC emacs-lisp + (use-package tree-sitter + :diminish t) + (use-package tree-sitter-langs + :config + (global-tree-sitter-mode) + (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)) #+END_SRC ** Language specific configs @@ -1027,16 +1028,20 @@ (setq-local clang-format-style nil) (setq-local clang-format-style (concat "{BasedOnStyle: LLVM," "IndentWidth: " (format "%s" tab-width) "," + "TabWidth: " (format "%s" tab-width) "," "UseTab: " (if (eq indent-tabs-mode nil) "Never" "AlignWithSpaces") "," "BreakBeforeBraces: Linux," "AllowShortIfStatementsOnASingleLine: false," - "IndentCaseLabels: false}")))) + "PointerAlignment: Left," + "IndentCaseBlocks: true," + "IndentCaseLabels: false," + "SortUsingDeclarations: true}")))) + (add-hook 'c-mode-common-hook 'set-clang-format-style) - (use-package clang-format - :hook (c-mode-common . (set-clang-format-style))) + (use-package clang-format) ;; (defun clang-format-on-save () ;; (add-hook 'before-save-hook 'clang-format-buffer nil t)) @@ -1279,6 +1284,15 @@ #+BEGIN_SRC emacs-lisp (use-package company-go) #+END_SRC +*** Python +**** COMMENT LSP server +Use jedi, idk why. +#+BEGIN_SRC emacs-lisp + (use-package lsp-jedi + :config + (add-to-list 'lsp-disabled-clients 'pyls) + (add-to-list 'lsp-enabled-clients 'jedi)) +#+END_SRC * Org mode ** Up to date org Pull the latest org mode from the repository, rather than the org which comes with emacs. @@ -1367,7 +1381,8 @@ Call pandoc on org buffer from org export. Need to add ~#+OPTIONS: H:99~ to enable large level header exports. #+BEGIN_SRC emacs-lisp - (use-package ox-pandoc) + (when (executable-find "pandoc") + (use-package ox-pandoc)) #+END_SRC *** COMMENT Dokuwiki Wiki -- Gitblit v1.9.3