Comments (2)
Hey there! And thanks, I'm glad you like it.
You can replace def-package!
with use-package
. They're aliases. It's there just for consistency (with my emacs.d) and in case I need to wrap use-package in some functionality later. add-hook!
is a convenience macro for adding 1-to-many, many-to-many, or many-to-1 functions to hooks. In any case, here is my config without any of my private macros:
(use-package highlight-indentation
:commands (highlight-indentation-mode highlight-indentation-current-column-mode)
:config
(defun doom|inject-trailing-whitespace (&optional start end)
"The opposite of `delete-trailing-whitespace'. Injects whitespace into
buffer so that `highlight-indentation-mode' will display uninterrupted indent
markers. This whitespace is stripped out on save, as not to affect the resulting
file."
(interactive (progn (barf-if-buffer-read-only)
(if (use-region-p)
(list (region-beginning) (region-end))
(list nil nil))))
(unless indent-tabs-mode
(save-match-data
(save-excursion
(let ((end-marker (copy-marker (or end (point-max))))
(start (or start (point-min))))
(goto-char start)
(while (and (re-search-forward "^$" end-marker t) (< (point) end-marker))
(let (line-start line-end next-start next-end)
(save-excursion
;; Check previous line indent
(forward-line -1)
(setq line-start (point)
line-end (save-excursion (back-to-indentation) (point)))
;; Check next line indent
(forward-line 2)
(setq next-start (point)
next-end (save-excursion (back-to-indentation) (point)))
;; Back to origin
(forward-line -1)
;; Adjust indent
(let* ((line-indent (- line-end line-start))
(next-indent (- next-end next-start))
(indent (min line-indent next-indent)))
(insert (make-string (if (zerop indent) 0 (1+ indent)) ? )))))
(forward-line 1)))))
(set-buffer-modified-p nil))
nil)
(defun highlight-indentation-handle-whitespace ()
(if (or highlight-indentation-mode highlight-indentation-current-column-mode)
(progn
(doom|inject-trailing-whitespace)
(add-hook 'before-save-hook #'delete-trailing-whitespace nil t)
(add-hook 'after-save-hook #'doom|inject-trailing-whitespace nil t))
(remove-hook 'before-save-hook #'delete-trailing-whitespace t)
(remove-hook 'after-save-hook #'doom|inject-trailing-whitespace t)
(delete-trailing-whitespace)))
(add-hook 'highlight-indentation-mode-hook 'highlight-indentation-handle-whitespace)
(add-hook 'highlight-indentation-current-column-mode-hook 'highlight-indentation-handle-whitespace)
However, I must disagree with adding highlight-indentation to doom-themes. There are multiple such plugins, each with their own pros and cons for different languages; I can't suppot all of them nor can I presume to guess every user's needs. I also think it's trivial enough for a user to implement themselves (my config notwithstanding).
doom-one does set the highlight indentation faces however (so they'll be colored appropriately if you do use any of those plugins).
from themes.
Many thanks ! Works like a charm.
from themes.
Related Issues (20)
- doom-gruvbox's ANSI magenta isn't magenta
- treemacs modeline HOT 1
- "Operators" syntax class ignoring variables HOT 1
- doom-one-comment-bg missing HOT 1
- doom-xcode: Assignt different colors to functions and variables
- ediff theming doesn't have any colour hightlight HOT 4
- Warning: nil value is invalid, use ‘unspecified’ instead HOT 18
- The color of function parameter is not correct HOT 3
- Line numbers in doom-monokai-pro theme are barely visible. HOT 1
- spacegrey org mode headings are hard to distinguish from text
- Files named .project in emacs have treemacs icons that are green and twice as big as others HOT 3
- [Theme request] inky color scheme flexoki
- Support `gud-highlight-current-line-face`
- Org fontification extension assumes org-indent is loaded
- [Theme request] Everforest port
- `:box` attribute `:style none` is invalid in latest Emacs 30 HOT 1
- Warning: nil value is invalid, use ‘unspecified’ instead HOT 3
- error while installing the badger theme HOT 1
- Add support for icons in lsp symbols and breadcrumbs HOT 1
- Slant inconsistent in solarized-light vs solarized-dark HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from themes.