Some Emacs commands that aren’t designed specifically for editing programs are useful for that nonetheless.
The Emacs commands that operate on words, sentences and paragraphs are useful for editing code. Most symbol names contain words (see Words), while sentences can be found in strings and comments (see Sentences). As for paragraphs, they are defined in most programming language modes to begin and end at blank lines (see Paragraphs). Therefore, judicious use of blank lines to make the program clearer will also provide useful chunks of text for the paragraph commands to work on. Auto Fill mode, if enabled in a programming language major mode, indents the new lines which it creates.
Superword mode is a buffer-local minor mode that causes editing and
motion commands to treat symbols (e.g., ‘this_is_a_symbol’) as words.
When Superword mode is enabled, the minor mode indicator
appears in the mode line. See also the similar
(see MixedCase Words).
Apart from Hideshow mode (see Hideshow minor mode), another way to selectively display parts of a program is to use the selective display feature (see Selective Display). Programming modes often also support Outline minor mode (see Outline Mode), which can be used with the Foldout package (see Folding Editing).
Prettify Symbols mode is a buffer-local minor mode that replaces
certain strings with more attractive versions for display purposes.
For example, in Emacs Lisp mode, it replaces the string ‘lambda’
with the Greek lambda character ‘λ’. In a TeX buffer, it will
replace ‘\alpha’ … ‘\omega’ and other math macros with
their Unicode characters. You may wish to use this in non-programming
modes as well. You can customize the mode by adding more entries to
prettify-symbols-alist. More elaborate customization is
available via customizing
its default value
prettify-symbols-default-compose-p is not
appropriate. There is also a global version,
global-prettify-symbols-mode, which enables the mode in all
buffers that support it.
The symbol at point can be shown in its original form. This is
controlled by the variable
nil, the original form of symbol at point will be
restored for as long as point is at it.