doc/adding editorconfig and hl-column-fill documentation (#3815)

* doc/adding editor config and hl-column-fill docs

* Adding inaugural versons to the modules

* Making the requested edits

* adding in some more spaces

* redoing the review

* ui/fill-column: correct & expand readme

Co-authored-by: Henrik Lissner <henrik@lissner.net>
This commit is contained in:
Jeetaditya Chatterjee 2021-03-06 03:35:06 +00:00 committed by GitHub
parent 494d87d0b4
commit 2fa0dca041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 154 additions and 9 deletions

View file

@ -1,18 +1,71 @@
#+TITLE: :tools editorconfig
#+TITLE: tools/editorconfig
#+DATE: August 22, 2020
#+SINCE: 2.0.9
#+STARTUP: inlineimages nofold
Editorconfig integration for Doom.
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#adding-major-modes][Adding Major Modes]]
- [[#troubleshooting][Troubleshooting]]
* Table of Contents :TOC:
- [[Module Flags][Module Flags]]
- [[Prerequisites][Prerequisites]]
- [[Configuration][Configuration]]
* Description
Add EditorConfig integration for Doom
* Module Flags
#+BEGIN_QUOTE
EditorConfig helps maintain consistent coding styles for multiple developers
working on the same project across various editors and IDEs. The EditorConfig
project consists of a file format for defining coding styles and a collection of
text editor plugins that enable editors to read the file format and adhere to
defined styles. EditorConfig files are easily readable and they work nicely with
version control systems.
#+END_QUOTE
This module...
+ Adds support for editorconfig properties through the plugin
+ Provides a rudimentary back-end for editorconfig parsing
** Maintainers
This module has no dedicated maintainers
** Module Flags
This module provides no flags.
** Plugins
+ [[https://github.com/editorconfig/editorconfig-emacs][editorconfig-emacs]]
* Prerequisites
~editorconfig~ is an optional requirement of this package. The elisp-only
implementation may be sufficient, but has fewer features.
The ~editorconfig~ binary is an optional requirement of this module.
the elisp only implementation may be sufficient, but has fewer features
and is slower in most cases. You may get an advantage by installing
[[https://github.com/editorconfig#contributing][one of the many]] EditorConfig core implementations either from your
package manager or from source
* Features
You will need to write an ~.editorconfig~ file in your project
(this is usually in the root of your project) you can find out about all the
properties [[https://editorconfig.org/#example-file][here]]
* Configuration
** Adding Major Modes
If you don't know the indentation variable(s), use =SPC h v= to search for variables that have =indent=, =offset= or =tab-width= in their name. Likely prefixed with the plugin they belong to. e.g. rustic-indent-offset).
#+BEGIN_SRC emacs-lisp
(after! editorconfig
;; This entry already exists in `editorconfig-indentation-alist'; it is being used
;; as an example.
(add-to-list 'editorconfig-indentation-alist '(c-mode c-basic-offset))
(add-to-list 'editorconfig-indentation-alist '(coffee-mode coffee-tab-width)))
#+END_SRC
If you do not know the indentation variable/variables, (in the major mode in
question use =SPC h v= to look for any variable that has =indent=, =offset=
or =tab-width= in its name.)
* TODO Troubleshooting

View file

@ -0,0 +1,92 @@
#+TITLE: ui/fill-column
#+DATE: August 23, 2020
#+SINCE: 2.0.9
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#setting-fill-column-globally][Setting fill-column globally]]
- [[#setting-fill-column-for-the-current-buffer-or-mode][Setting fill-column for the current buffer or mode]]
- [[#hl-fill-column-only-configuring-the-look-of-the-indicator][(hl-fill-column only) Configuring the look of the indicator]]
- [[#troubleshooting][Troubleshooting]]
* Description
This module provides a fill column indicator to make it obvious when a line
reaches or surpasses the 80th column. This serves as a reminder to keep lines
short for accessibility and/or convenience. [[https://www.emacswiki.org/emacs/EightyColumnRule][Read more about this on the Emacs
Wiki page]].
#+begin_quote
This module is deprecated and will be removed once Doom drops Emacs 26.x
support. This is because the built-in ~display-fill-column-indicator-mode~ (in
27 and newer) replaces it, and enabling it is a trivial one-liner, which doesn't
warrant a module: ~(global-display-fill-column-indicator-mode +1)~
#+end_quote
** Maintainers
This module has no dedicated maintainers.
** Module Flags
This module provides no flags.
** Plugins
+ [[https://github.com/laishulu/hl-fill-column][hl-fill-column]]* (unless Emacs >=27)
* Prerequisites
This module has no prerequisites.
* Features
The behavior of this module varies slightly depending on your version of Emacs:
+ In Emacs 26.x, text beyond ~fill-column~ will be highlighted.
+ In Emacs 27 and newer, a line is drawn down the right side at column 80.
* Configuration
** Setting fill-column globally
This column limit is controlled by the ~fill-column~ variable (default: ~80~).
This variable is buffer-local, therefore, to change this globally, you must use
~setq-default~:
#+BEGIN_SRC emacs-lisp
(setq-default fill-column 100)
#+END_SRC
~hl-fill-column-mode~ (or ~display-fill-column-indicator-mode~ on Emacs 27+)
must be restarted to see the change.
** Setting fill-column for the current buffer or mode
The ~setq-hook!~ convenience macro makes settings ~fill-column~ for a particular
mode (or modes) easy:
#+BEGIN_SRC emacs-lisp
(setq-hook! 'org-mode-hook fill-column 100)
(setq-hook! 'python-mode-hook fill-column 72)
(setq-hook! js2-mode fill-column 72)
(setq-hook! '(ruby-mode rustic-mode python-mode-hook) fill-column 80)
#+END_SRC
Any open buffers in these modes must be restarted to see the change.
** (hl-fill-column only) Configuring the look of the indicator
To change the appears of hl-fill-column's highlight, change the
~hl-fill-column-face~ face. Doom provides the ~custom-set-faces!~ macro to help
you do this:
#+BEGIN_SRC emacs-lisp
(custom-set-faces!
'(hl-fill-column-face :background "red"
:foreground "blue"
:inverse-video t))
#+END_SRC
See =M-x helpful-function RET custom-set-faces\!= for demos and documentation
for this macro.
* TODO Troubleshooting