<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DevMemo – emacs</title><link>https://devmemo.gitlab.io/categories/emacs/</link><description>Recent content in emacs on DevMemo</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 26 Aug 2023 21:16:11 +0000</lastBuildDate><atom:link href="https://devmemo.gitlab.io/categories/emacs/index.xml" rel="self" type="application/rss+xml"/><item><title>Blog: How To Debug Emacs Cpp Indentation</title><link>https://devmemo.gitlab.io/blog/how_to_debug_emacs_cpp_indentation/</link><pubDate>Sat, 26 Aug 2023 21:16:11 +0000</pubDate><guid>https://devmemo.gitlab.io/blog/how_to_debug_emacs_cpp_indentation/</guid><description>
&lt;h2 id="do-syntactic-analysis">Do Syntactic Analysis&lt;/h2>
&lt;p>Do &lt;code>c-show-syntactic-information&lt;/code> or &lt;code>C-c C-s&lt;/code> to get an syntactic analysis first, you should get something like this&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>Syntactic analysis: ((statement-block-intro 930))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>At the same time, emacs will also highlight the anchor point.&lt;/p>
&lt;h2 id="set-c-set-offset">Set &lt;code>c-set-offset&lt;/code>&lt;/h2>
&lt;p>Do the following to adjust the indentation.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>(defun c-indentation-hook ()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (c-set-offset &amp;#39;statement-block-intro 2)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(add-hook &amp;#39;c-mode-common-hook &amp;#39;c-indentation-hook)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You&amp;rsquo;ll need to reopen the file to allow the above change to take effect.&lt;/p></description></item></channel></rss>