all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Semantic lexer based indent region function
@ 2021-05-17  5:19 Anand Tamariya
  0 siblings, 0 replies; only message in thread
From: Anand Tamariya @ 2021-05-17  5:19 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

Here is a Semantic lexer based indent region function for formatting code
in Emacs. It should work for Java and javascript. Feel free to use it if
you like the output or customize it to suit your needs.
*Screenshots:*
https://lifeofpenguin.blogspot.com/2021/05/semantic-lexer-based-indent-region.html

*Code:* semantic-indent-region
<https://gitlab.com/atamariya/emacs/-/blob/js-format/lisp/cedet/semantic/java.el#L1502>
 Features

   - Removes redundant whitespace. Multiple new lines are replaced by two
   new lines to mark paragraph separation.
   - Uses tab for indent and fill-column width to wrap lines (hard wrap).
   Set values for *tab-width* and *fill-column* as per your preference.
   - Adds one indent for each level of nested code.
   - Splits line on semi-colon.

Regards,
Anand

[-- Attachment #2: Type: text/html, Size: 1305 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-17  5:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-17  5:19 Semantic lexer based indent region function Anand Tamariya

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.