unofficial mirror of emacs-devel@gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).