![如何强制 Emacs 重置缩进?](https://linux22.com/image/1504344/%E5%A6%82%E4%BD%95%E5%BC%BA%E5%88%B6%20Emacs%20%E9%87%8D%E7%BD%AE%E7%BC%A9%E8%BF%9B%EF%BC%9F.png)
我希望 emacs 在文件的某个特定点自动将其缩进级别重置为 0。
例如:因为我有嵌套的嵌套的嵌套的-..命名空间,所以在C++文件中我想不是在命名空间内缩进整个主体。
#include <vector>
namespace qw {
namespace impl {
using std::vector;
class index_impl {
vector<string> entries;
public:
void add(const string &normalized, const string& original);
string getBestMatch(const string& normalized) const;
};
} // namespace impl_multimap
} // namespace qw
当然,这只在嵌套命名空间中主要实现一个类的情况下才有用。在头文件中,这会造成混淆。所以我想最好的解决方案是添加一个特殊的注释或其他东西。
#include <vector>
namespace qw {
namespace impl {
// -*- indent: 0 -*-
using std::vector;
...
任何其他想法也可以。