Remove the gnu style indentation from struct functions in c++ - emacs

I am using emacs. I have set the indentation style as "linux", but for functions in structm somehow the indentation style turns out to be gnu. How do I remove it?
What I have is this:
struct Graph{
vector<lld> *adj;
lld V;
Graph(lld V_)
{
V=V_;
adj=new vector<lld>[V+1];
}
}
What I want is this:
struct Graph{
vector<lld> *adj;
lld V;
Graph(lld V_)
{
V=V_;
adj=new vector<lld>[V+1];
}
}

This is a way to achieve that:
(add-hook 'c-mode-common-hook (lambda () (c-set-offset 'inline-open 0)))

Related

Is there a way to customize breadcrumbs in Emacs Orgmode?

When I set org-agenda-prefix-format with %b, I got all higher levels headline shown in the agenda .Is there any way to show only parent level, without other higher levels shown.
I have tried:
'((todo . " %-25(concat \"[\"(truncate-string-to-width (car (last
(org-get-outline-path))) 21 nil nil t) \"]\")"))
It works ok with todo.
However, when I tried on agenda:
'((agenda . " %-25(concat \"[\"(truncate-string-to-width (car (last
(org-get-outline-path))) 21 nil nil t) \"]\")"))
my custom command:
("n" "Agenda and all TODOs"
((agenda "" nil)
(alltodo "" nil))
nil)
did not work, only agenda but no todo shown.
update:
If there is no agenda items for today, the agenda view shows ok with both todo and agenda. However, If there is an agenda items for today, the todo won't show any more. Does my org-agenda-prefix-format config affect the timeline or something? This really makes me confused.

VS Code indent width 4, but still have tab width 8, how?

I have an old code base that uses a weird indentation style. It uses tab width 8, but indents 4 notches, replacing 8 spaces by tabs where possible.
Code should look like this:
____if (foo) {
TAB---->if (bar) {
TAB---->____something();
TAB---->}
____}
I have installed the EditorConfig for Visual Studio Code extension and my .editorconfig has this:
root = true
[*]
insert_final_newline = true
indent_size = 4
tab_width = 8
But the existing code looks like this:
____if (foo) {
TAB>if (bar) {
TAB>____something();
TAB>}
____}
When I add indent_style = tab, the existing code looks correct again, but when I type new code, I get this:
____if (foo) { // after hitting Enter on this line the next line is indented too far:
TAB---->____something
____}
How can I achieve the desired display and indentation behavior?
This is a bug / missing feature in VSCode itself: https://github.com/microsoft/vscode/issues/10339

How do i change the way visual studio code auto corrects curly braces?

I prefer my curly braces looking like this:
function eg()
{
}
But when I try to format my code, vscode auto corrects to this:
function eg() {
}
Is there any plugins that I can download or setting that I can tweak to change this?
Try :
"javascript.format.placeOpenBraceOnNewLineForFunctions": true;
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": true;
"typescript.format.placeOpenBraceOnNewLineForControlBlocks": true;
"typescript.format.placeOpenBraceOnNewLineForFunctions": true;

Advanced indent settings in Visual Studio

I'm using VS2013 and I'd like to change indentation. However, Visual's settings aren't enough for me. I'd like it to auto indent it like this:
int function()
{
int a=1;
while (a)
{
if(a>0)
{
a=0;
return;
}
}
}
Are there any plugins, or anything like this to help me with indentation?

How tool-bar button in emacs works? [duplicate]

This question already has answers here:
How to add a tool-bar button in emacs?
(2 answers)
Closed 8 years ago.
i have a problem to add a tool-bar button in emacs.
I can run it with eval-buffer but not with my .emacs. When i add it with eval-buffer my button leave my toolbar after a scroll.
;;; Code:
(defun omar-hotel ()
"another nonce menu function"
(interactive)
(message "hotel, motel, holiday inn"))
(define-key-after global-map [tool-bar omar-button]
'(menu-item "Hotel" omar-hotel
:image (image :type xpm :file "/usr/share/emacs/23.4/etc/images/jump-to.xpm")
:help "OMG Omar!"
))
i also tried to add-hook like that but that's doesn't works.
(add-hook 'after-init-hook
(lambda ()
(define-key-after global-map [tool-bar omar-button]
'(menu-item "Hotel" omar-hotel
:image (image :type xpm :file "/usr/share/emacs/23.4/etc/images/jump-to.xpm")
:help "OMG Omar!"
))
))
Hi i found a simple solution to add a toolbar button "spell" is the image in /usr/share/emacs/23.4/etc/images/
(defun omar-hotel ()
"another nonce menu function"
(interactive)
(message "hotel, motel, holiday inn"))
(tool-bar-add-item "spell" 'omar-hotel
'omar-hotel
:help "Run fonction omar-hotel")