How to change brace indentation style in Emacs/ AUCTeX - emacs

I would like to use something like the Allman or BSD style for LaTeX. For example, I would indent the following code like this:
\iflanguage{english}{
\begin{otherlanguage}{brazilian}
}{
\begin{otherlanguage}{english}
}
But AUCTeX indents it like this:
\iflanguage{english}{
\begin{otherlanguage}{brazilian}
}{
\begin{otherlanguage}{english}
}
This question is similar, but the solution does not work since LaTeX is not C-like.
This page describes the variable 'TeX-brace-indent-level', but it controls only {. Does the same exist for }?

Related

How to disable AUCTeX highlighting?

I'm trying to use GNU Emacs 26.3 + AUCTeX 12.2.3 and it seems to work, but the colors it shows in the source code are very annoying, specially in amsmath environment such as align, because it uses only one color for the whole block. I would like to ignore auctex highlighting so the code looks the same as before installing auctex package, this is something like this: source code before AUCTeX
I deleted some strings like "align" from "Font Latex Math Environments" so it doesn't use the font locking for math environments, and now it looks like normal text: current source code
It's better that one color, yes, but there are several commands that doesn't highlight and I would like them to. (Not highlighted commands occurs outside the align too). Another option would be adding a generic alphabetic string next to \ as a keyword so it would be highlighted but I also don't know how to achieve this.

How to add custom indentation rules to align multiple lines of code when creating a language extension?

I'm authoring an extension for Racket (lisp dialect) and I'd like to customize the indentation rules further than just "when line ends with X, indentation +1, else indentation -1". However, as far as I understand it, that exactly is the point of increaseIndentPattern and decreaseIndentPattern in language-configuration.json.
In particular, I'd like to specify some rule that goes like this:
(call-foo first-arg
......... second-arg
......... (third-arg-function foo
..............................bar))
Where the dots denote the auto-indentation (spaces) automatically inserted by VS Code upon pressing return on the preceeding lines. Is it possible to do something like this?

Can Visual Studio Code be prevented from indenting a level deeper after opening braces?

If I enter "foo ()\n\t{\n"
foo ()
{
<- cursor is now here
I'd like it to be at the same level of indent as the line above (4 spaces in this example), not pushed in a level (8 spaces in this example). So:
foo ()
{
<- cursor here and all will be well in the world
I've tried completely turning off all the indent/tab settings I can find. I'm even prepared to hack around with an extension so a pointer to any in-depth documentation around type/tab commands would also be welcome.
Well, erm, there is an Editor Setting in Preferences, where you can adjust the tabs "editor.tabSize": 4, but I don't there is any level scaling, but I've also discovered a little "hack". If you make double slashes after
{//
and hit return it looks like this:
{//
Hello_world!!
}
Kind of silly, I guess.

Remove here-doc syntax coloring on emacs

Hi is there a way to remove the here-doc syntax highlighting in emacs useing cperl-mode
It is highlighting the entire thing as a "String" which is technically correct but I do not want it to do that. When i program in pico/nano I make my own regular expressions to do syntax highlighting and it works great because it colors the here-docs like it colors the rest. It would be nice to learn how to create or where to insert my existing syntax highlighting regex's.
For example
print <<EOF;
This is not colored but "this is colored liek a string"
EOF
In emacs the entire thing is colored like a string which I dislike. How can i either turn here-doc syntax coloring off or edit the regular expressions directly like i do with pico?

Emacs cperl-mode make if more ergonomic

I am using emacs cperl-mode. When I type
if(
it gives me the code template:
if(<cursor goes here>){
}
But I want to make it like this:
if(<cursor goes here>){
<tab, according to the mode>
}
So after I wrote the condition inside 'if', I won't need to click <End> <Enter> <tab> and will only need to click <Down arrow>.
The same method can be used for the similar cases: while, for, etc.
I use Yasnippet to cover this case:
YASnippet is a template system for Emacs. It allows you to type an
abbreviation and automatically expand it into function templates.
Bundled language templates includes: C, C++, C#, Perl, Python, Ruby,
SQL, LaTeX, HTML, CSS and more. The snippet syntax is inspired from
TextMate's syntax, you can even import most TextMate templates to
YASnippet.
Your case would be just i f tab condition tab then block.
In cperl-mode you have following default templates:
eval, for, fore, if, ife, ifee, sub, unless, while, xfore, xif, xunless, xwhile
and - what's even more awesome - you can easily create your own templates or use an existing collection of yasnippet snippets for many languages.