Emacs: Maintaining proper indentation in indentation-sensitive programming languages

As codebases grow, maintaining proper indentation becomes increasingly difficult, especially in languages like Python or YAML, where indentation is not just a matter of style but an important part of the syntax. When working with large code blocks or deeply nested structures, it’s easy to lose track of the correct indentation level, leading to errors and decreased readability. In this post, we’ll explore Emacs packages and an Elisp code snippet that can help manage indentation in these indentation-sensitive languages. Code snippet: Indenting new lines based on previous non-blank line The following code snippet configures Emacs to indent based on the … Continue reading

Emacs: YAML file code Folding and Outlining

Working with long and complex YAML files can be a daunting task. In such cases, code folding becomes an invaluable tool, allowing the collapse and expansion of sections of the file and enhancing readability and navigation. This makes it easier to focus on specific parts of the code without being overwhelmed by the entire document. To address this need, I would like to introduce you to outline-indent.el, a minor mode for Emacs that brings code folding and outlining capabilities to Emacs, making editing YAML and other languages more efficient and enjoyable. How to change the Ellipsis (...) to (▼)? The … Continue reading