I think I found an ideal solution for me in some custom macros I just wrote, so no change to SE needed. Looks like the ability to change syntax indent and indent with spaces/tabs for the current buffer only without updating the beautifier profile already exists. I created new commands that I have bound to keys to allow me to do whatever I like.
I was able to create the following key bindings to serve all my purposes:
Ctrl+Alt+2 setTabAndIndent2 Set indent and tab size to 2 in current buffer and in language settings/beautifier profile
Shift+Alt+2 setTabAndIndent2Buf Set indent and tab size to 2 in current buffer only
Ctrl+Alt+4 setTabAndIndent4 Set indent and tab size to 4 in current buffer and in language settings/beautifier profile
Shift+Alt+4 setTabAndIndent4Buf Set indent and tab size to 4 in current buffer only
Ctrl+Alt+8 setTabAndIndent8 Set indent and tab size to 8 in current buffer and in language settings/beautifier profile
Shift+Alt+8 setTabAndIndent8Buf Set indent and tab size to 8 in current buffer only
Ctrl+Alt+S setIndentWithSpaces Change to indent with spaces in current buffer and in language settings/beautifier profile
Shift+Alt+S setIndentWithSpacesBuf Change to indent with spaces in current buffer only
Ctrl+Alt+T setIndentWithTabs Change to indent with tabs in current buffer and in language settings/beautifier profile
Shift+Alt+T setIndentWithTabsBuf Change to indent with tabs in current buffer only
Ctrl+Alt+U updateAllTabsWithLanguageSettings Update all buffers that are the same lang as current buffer with language settings/beautifier profile for indent/tab size/indent with tabs/spaces
Below is the macro code:
/**
* Sets the tab and indent spacing both current buffer and
* language settings/beautifier profile.
*
* @param indentSize
*/
_command void setTabAndIndent(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndentLang(indentSize);
setTabAndIndentBuf(indentSize);
}
/**
* Sets the tab and indent spacing in the language settings/beautifier profile, but
* does not update the current buffer.
*
* @param indentSize
*/
_command void setTabAndIndentLang(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
// Below 2 lines taken from revertCurrentBuffer() in macros/adaptiveformatting.e
bufId := _mdi.p_child;
_str langId=bufId.p_LangId;
LanguageSettings.setSyntaxIndent(langId, indentSize);
_str tabSizeStr = '+'indentSize;
// _message_box('tabSizeStr = 'tabSizeStr);
LanguageSettings.setTabs(langId, tabSizeStr);
}
/**
* Sets the tab and indent spacing in the current buffer, but
* not in the language settings/beautifier profile.
*
* @param indentSize
*/
_command void setTabAndIndentBuf(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
// _str langId = _Filename2LangId(p_buf_name);
// Below 2 lines taken from revertCurrentBuffer() in macros/adaptiveformatting.e
bufId := _mdi.p_child;
_str langId=bufId.p_LangId;
bufId.p_SyntaxIndent = indentSize;
_str tabSizeStr = '+'indentSize;
// _message_box('tabSizeStr = 'tabSizeStr);
bufId.p_tabs = tabSizeStr;
}
/**
* Sets the tab and indent spacing to 2 in both current buffer
* and language settings/beautifier profile.
*
*/
_command void setTabAndIndent2(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndent(2);
}
/**
* Sets the tab and indent spacing to 2 in current buffer, but
* not in the language settings/beautifier profile. Useful for binding to a key.
*
*/
_command void setTabAndIndent2Buf(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndentBuf(2);
}
/**
* Sets the tab and indent spacing to 4 in both current buffer
* and language settings/beautifier profile.
*
*/
_command void setTabAndIndent4(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndent(4);
}
/**
* Sets the tab and indent spacing to 4 in current buffer, but
* not in the language settings/beautifier profile. Useful for binding to a key.
*
*/
_command void setTabAndIndent4Buf(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndentBuf(4);
}
/**
* Sets the tab and indent spacing to 8 in both current buffer
* and language settings/beautifier profile.
*
*/
_command void setTabAndIndent8(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndent(8);
}
/**
* Sets the tab and indent spacing to 8 in current buffer, but
* not in the language settings/beautifier profile. Useful for binding to a key.
*
*/
_command void setTabAndIndent8Buf(int indentSize=2) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setTabAndIndentBuf(8);
}
/**
* Sets the indent with tabs or indent with spaces in both the
* current buffer and in the language settings/beautifier profile.
*
* @param tabTrueSpacesFalse true=indent with tabs,
* false=indent with spaces
*/
_command void setIndentWithTabsOrSpaces(bool tabTrueSpacesFalse=false) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setIndentWithTabsOrSpacesLang(tabTrueSpacesFalse);
setIndentWithTabsOrSpacesBuf(tabTrueSpacesFalse);
}
/**
* Sets the indent with tabs or indent with spaces in the
* language settings/beautifier profile, but not in the current
* buffer.
*
* @param tabTrueSpacesFalse true=indent with tabs,
* false=indent with spaces
*/
_command void setIndentWithTabsOrSpacesLang(bool tabTrueSpacesFalse=false) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
bufId := _mdi.p_child;
_str langId=bufId.p_LangId;
LanguageSettings.setIndentWithTabs(langId, tabTrueSpacesFalse);
}
/**
* Sets the indent with tabs or indent with spaces in the
* current buffer but not in the language settings/beautifier
* profile.
*
* @param tabTrueSpacesFalse true=indent with tabs,
* false=indent with spaces
*/
_command void setIndentWithTabsOrSpacesBuf(bool tabTrueSpacesFalse=false) name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
bufId := _mdi.p_child;
_str langId=bufId.p_LangId;
bufId.p_indent_with_tabs = tabTrueSpacesFalse;
}
/**
* Sets indent with spaces in both the current buffer and in the
* language settings/beautifier profile.
*
* Useful for binding to a key.
*/
_command void setIndentWithSpaces() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setIndentWithTabsOrSpaces(false);
}
/**
* Sets indent with spaces in the current buffer only and NOT in
* the language settings/beautifier profile.
*
* Useful for binding to a key.
*/
_command void setIndentWithSpacesBuf() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setIndentWithTabsOrSpacesBuf(false);
}
/**
* Sets indent with tabs in both the current buffer and in the
* language settings/beautifier profile.
*
* Useful for binding to a key.
*/
_command void setIndentWithTabs() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setIndentWithTabsOrSpaces(true);
}
/**
* Sets indent with tabs in the current buffer only and NOT in
* the language settings/beautifier profile.
*
* Useful for binding to a key.
*/
_command void setIndentWithTabsBuf() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
setIndentWithTabsOrSpacesBuf(true);
}
/**
* This command will update all buffers that are the same
* language as the current buffer with the languages
* settings/beautifier profile values of:
*
* syntax indent
* tab size
* indent with spaces/tabs
*
*/
_command void updateAllTabsWithLanguageSettings() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_MARK)
{
bufId := _mdi.p_child;
_str langId=bufId.p_LangId;
typeless indent_with_tabs_save = LanguageSettings.getIndentWithTabs(langId);
typeless indentSize = LanguageSettings.getSyntaxIndent(langId);
typeless tabsSizeStr = LanguageSettings.getTabs(langId);
// Copied this from:
// _update_buffers_for_all_languages()
// in: macros/alllanguages.e
_safe_hidden_window();
int view_id=0;
save_view(view_id);
int first_buf_id=p_buf_id;
// Loop over each buffer.
for (;;) {
// get the language for this buffer
currentLang := p_LangId;
if ( currentLang == langId )
{
p_indent_with_tabs = indent_with_tabs_save;
p_SyntaxIndent = indentSize;
p_tabs = tabsSizeStr;
}
// Copied below from:
// _update_buffers_for_all_languages()
// in: macros/alllanguages.e
// go to our next buffer
_next_buffer('HN');
if ( p_buf_id==first_buf_id ) {
break;
}
}
// Copied below from:
// _update_buffers_for_all_languages()
// in: macros/alllanguages.e
activate_window(view_id);
}