From 61b4dd0437c5195567a400856fd6b7c47267f390 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sun, 10 Apr 2022 21:21:41 +0200 Subject: [PATCH] Set fill-column for doom configuration to 80 --- .dir-locals.el | 1 + config.el | 48 +++++++++++++++++++--------------- init.el | 22 ++++++++-------- modules/term/vterm/README.org | 6 +++-- modules/term/vterm/autoload.el | 38 +++++++++++++++------------ 5 files changed, 65 insertions(+), 50 deletions(-) create mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..5e6380c --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1 @@ +((nil . ((fill-column . 80)))) diff --git a/config.el b/config.el index 36743c3..7d7e540 100644 --- a/config.el +++ b/config.el @@ -35,12 +35,11 @@ (setq doom-theme 'doom-one) (add-hook 'doom-load-theme-hook (lambda () - (progn - (set-face-attribute 'font-lock-constant-face nil :weight 'bold) - (set-face-attribute 'font-lock-function-name-face nil :weight 'bold) - (set-face-attribute 'font-lock-keyword-face nil :weight 'bold) - (set-face-attribute 'font-lock-type-face nil :weight 'bold) - (set-face-attribute 'show-paren-match nil :background nil)))) + (set-face-attribute 'font-lock-constant-face nil :weight 'bold) + (set-face-attribute 'font-lock-function-name-face nil :weight 'bold) + (set-face-attribute 'font-lock-keyword-face nil :weight 'bold) + (set-face-attribute 'font-lock-type-face nil :weight 'bold) + (set-face-attribute 'show-paren-match nil :background nil))) (after! whitespace (set-face-attribute 'whitespace-line nil :background nil)) ;; This determines the style of line numbers in effect. If set to `nil', line @@ -95,7 +94,8 @@ (delete org-agenda-section +doom-dashboard-menu-sections)) ;; Remove the silly doom newline advice. -(advice-remove 'newline-and-indent #'+default--newline-indent-and-continue-comments-a) +(advice-remove 'newline-and-indent + #'+default--newline-indent-and-continue-comments-a) ;; I actually like it when Emacs recenters the screen while scrolling. This may ;; be an issue in large files. When that becomes an issue add an exception here. @@ -113,23 +113,25 @@ ;; ----------------------------------------------------------------------------- ;; Always open magit in other window. -(after! magit (setq magit-display-buffer-function #'magit-display-buffer-traditional)) +(after! magit + (setq magit-display-buffer-function #'magit-display-buffer-traditional)) ;; Don't use the LSP formatter. (after! lsp (setq +format-with-lsp nil)) ;; Python virtualenv configuration. -(after! lsp-pyright (setq lsp-pyright-venv-path (concat (getenv "HOME") "/.virtualenvs"))) +(after! lsp-pyright + (setq lsp-pyright-venv-path (concat (getenv "HOME") "/.virtualenvs"))) ;; Rainbow delimiters in all prog-mode buffers. (add-hook! prog-mode #'rainbow-delimiters-mode-enable) ;; Make TRAMP easier to use for sudo on remote hosts. (after! tramp - ;; This line proxies all sudo connections via an ssh connection to the provided hostname. + ;; Proxy all sudo connections via an ssh connection to the provided hostname. (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) - ;; This rule is an exception to the above so that local sudo does not proxy via ssh. This has to - ;; be added last so that it is the first element of the list. + ;; This rule is an exception to the above so that local sudo does not proxy + ;; via ssh. This has to be added last so that it is the first element. (add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))) ;; Extra VTerm configuration. @@ -200,9 +202,12 @@ ;; Always indent. Why would I ever want to insert a tab? tab-always-indent t ;; Default indentation size - applies even when indent-tabs-mode is nil. - tab-width 8 - ;; Highlight lines that are too long in whitespace mode. - whitespace-line-column fill-column) + tab-width 8) + +;; Highlight lines that are too long in whitespace mode. We set this with a hook +;; after local variables as fill-column is often set through dir-locals. +(add-hook 'hack-local-variables-hook + (lambda () (setq-local whitespace-line-column fill-column))) ;; CamelCase as separate words. (global-subword-mode +1) @@ -210,9 +215,9 @@ ;; Doom emacs recommends `visual-line-mode' as it claims wrapping is expensive. (global-visual-line-mode +1) -;; But "C-e" behaves differently in `visual-line-mode' than when they are -;; wrapped. It goes to the end of the visual line, not the logical line. This -;; can be fixed by defining the following aliases. +;; But "C-e" behaves differently in `visual-line-mode' than when wrapping. It +;; goes to the end of the visual line, not the logical line. This can be fixed +;; by defining the following aliases. (defalias #'end-of-visual-line #'end-of-line) (defalias #'beginning-of-visual-line #'beginning-of-line) @@ -245,9 +250,10 @@ "M-o" #'other-window "C-x o" #'other-popup ;; Kill current buffer without prompting. - :desc "kill-buffer" "C-x k" (lambda () - (interactive) - (let (kill-buffer-query-functions) (kill-buffer))) + :desc "kill-buffer" + "C-x k" (lambda () + (interactive) + (let (kill-buffer-query-functions) (kill-buffer))) ;; Scroll up/down, but keep point in place. "C-<" (lambda() (interactive) diff --git a/init.el b/init.el index 7198f3d..1c11cca 100644 --- a/init.el +++ b/init.el @@ -41,7 +41,7 @@ ;;nav-flash ; blink cursor line after big motions ;;neotree ; a project drawer, like NERDTree for vim ophints ; highlight the region an operation acts on - (popup +defaults) ; tame sudden yet inevitable temporary windows + (popup +defaults) ; tame sudden yet inevitable temporary windows ;;tabs ; a tab bar for Emacs ;;treemacs ; a project drawer, like neotree but cooler ;;unicode ; extended unicode support for various languages @@ -55,7 +55,7 @@ ;;(evil +everywhere); come to the dark side, we have cookies file-templates ; auto-snippets for empty files fold ; (nigh) universal code folding - format ; automated prettiness + format ; automated prettiness ;;god ; run Emacs commands without modifier keys ;;lispy ; vim for lisp, for people who don't like vim ;;multiple-cursors ; editing in many places at once @@ -68,8 +68,8 @@ :emacs dired ; making dired pretty [functional] electric ; smarter, keyword-based electric-indent - (ibuffer +icons) ; interactive buffer management - (undo +tree) ; persistent, smarter undo for your inevitable mistakes + (ibuffer +icons) ; interactive buffer management + (undo +tree) ; persistent, smarter undo for your inevitable mistakes vc ; version-control and Emacs, sitting in a tree :term @@ -79,7 +79,7 @@ vterm ; the best terminal emulation in Emacs :checkers - syntax ; tasing you for every semicolon you forget + syntax ; tasing you for every semicolon you forget ;;(spell +flyspell) ; tasing you for misspelling mispelling ;;grammar ; tasing grammar mistake every you make @@ -91,9 +91,9 @@ ;;docker ;;editorconfig ; let someone else argue about tabs vs spaces ;;ein ; tame Jupyter notebooks with emacs - (eval +overlay) ; run code, run (also, repls) + (eval +overlay) ; run code, run (also, repls) ;;gist ; interacting with github gists - lookup ; navigate your code and its documentation + lookup ; navigate your code and its documentation lsp ; M-x vscode magit ; a git porcelain for Emacs ;;make ; run make tasks from Emacs @@ -107,7 +107,7 @@ ;;upload ; map local to remote projects via ssh/ftp :os - (:if IS-MAC macos) ; improve compatibility with macOS + (:if IS-MAC macos); improve compatibility with macOS ;;tty ; improve the terminal Emacs experience :lang @@ -143,7 +143,7 @@ ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) ;;julia ; a better, faster MATLAB ;;kotlin ; a better, slicker Java(Script) - (latex +latexmk) ; writing papers in Emacs has never been so fun + (latex +latexmk) ; writing papers in Emacs has never been so fun ;;lean ; for folks with too much to prove ;;ledger ; be audit you can be ;;lua ; one-based indices? one-based indices @@ -155,14 +155,14 @@ ;;php ; perl's insecure younger brother ;;plantuml ; diagrams for confusing people more ;;purescript ; javascript, but functional - (python +lsp +pyright) ; beautiful is better than ugly + (python +lsp +pyright); beautiful is better than ugly ;;qt ; the 'cutest' gui framework ever ;;racket ; a DSL for DSLs ;;raku ; the artist formerly known as perl6 ;;rest ; Emacs as a REST client ;;rst ; ReST in peace ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;scala ; java, but good ;;(scheme +guile) ; a fully conniving family of lisps sh ; she sells {ba,z,fi}sh shells on the C xor diff --git a/modules/term/vterm/README.org b/modules/term/vterm/README.org index 71fcf38..4bdc377 100644 --- a/modules/term/vterm/README.org +++ b/modules/term/vterm/README.org @@ -18,9 +18,11 @@ This module provides a terminal emulator powered by libvterm. The following commands are available to open it: + ~+vterm/other-window~ (=C-c o t=): Opens vterm in other window -+ ~+vterm/project/other-window~ (=C-c o p=): Opens vterm in the current project in other window ++ ~+vterm/project/other-window~ (=C-c o p=): Opens vterm in the current project + in other window + ~+vterm/here~ (=C-c o T=): Opens vterm in the current window -+ ~+vterm/project/here~ (=C-c o P=): Opens vterm in the current project in the current window ++ ~+vterm/project/here~ (=C-c o P=): Opens vterm in the current project in the + current window These commands will first try to find an existing suitable vterm buffer and open it. If one does not exist, they will create a new one. If the current buffer is diff --git a/modules/term/vterm/autoload.el b/modules/term/vterm/autoload.el index eb4d190..f28f7d8 100644 --- a/modules/term/vterm/autoload.el +++ b/modules/term/vterm/autoload.el @@ -35,7 +35,8 @@ If current buffer is not in vterm-mode: Returns the vterm buffer" (unless (fboundp 'module-load) - (user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm")) + (user-error + "Your build of Emacs lacks dynamic modules support and cannot load vterm")) (let ((vterm-buffer-name (+vterm--buffer-name))) (if (string= major-mode "vterm-mode") (funcall spawn-fn vterm-buffer-name) @@ -45,17 +46,20 @@ Returns the vterm buffer" (funcall spawn-fn vterm-buffer-name)))))) (defun +vterm--spawn-or-switch-with-project (spawn-fn switch-fn) - "Open using `spawn-fn' or switch to active vterm using `switch-fn' in a project. + "Open with `spawn-fn' or switch to active vterm with `switch-fn' in a project. Returns the vterm buffer" (let ((project-root (doom-project-root))) (unless project-root - (user-error "vterm/project/* cannot find a project, because you are not in a project")) + (user-error + "vterm/project cannot find a project, because you are not in a project")) (let ((default-directory project-root)) (+vterm--spawn-or-switch spawn-fn switch-fn)))) (defun +vterm--other-window (other-window-fn current-window-fn) - "Open or switch using `other-window-fn' unless current buffer is doom-dashboard. + "Open or switch with `other-window-fn'. + +Unless current buffer is doom-dashboard. Returns the vterm buffer." (if (equal major-mode #'+doom-dashboard-mode) @@ -73,12 +77,13 @@ buffer is the doom-dashboard, vterm opens in the current window. Returns the vterm buffer." (interactive) - (+vterm--other-window (lambda () - (+vterm--spawn-or-switch #'vterm-other-window - #'switch-to-buffer-other-window)) - (lambda () - (+vterm--spawn-or-switch #'+vterm--vterm - #'switch-to-buffer)))) + (+vterm--other-window + (lambda () + (+vterm--spawn-or-switch #'vterm-other-window + #'switch-to-buffer-other-window)) + (lambda () + (+vterm--spawn-or-switch #'+vterm--vterm + #'switch-to-buffer)))) ;;;###autoload (defun +vterm/project/other-window () @@ -91,12 +96,13 @@ buffer is the doom-dashboard, vterm opens in the current window. Returns the vterm buffer." (interactive) - (+vterm--other-window (lambda () - (+vterm--spawn-or-switch-with-project #'vterm-other-window - #'switch-to-buffer-other-window)) - (lambda () - (+vterm--spawn-or-switch-with-project #'+vterm--window - #'switch-to-buffer)))) + (+vterm--other-window + (lambda () + (+vterm--spawn-or-switch-with-project #'vterm-other-window + #'switch-to-buffer-other-window)) + (lambda () + (+vterm--spawn-or-switch-with-project #'+vterm--window + #'switch-to-buffer)))) ;;;###autoload (defun +vterm/here ()