From 5c672b1d0e7e1f1dd7f9d03ae11a4bb1246f439a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 4 Apr 2024 13:42:34 -0400 Subject: [PATCH] fix(cc): make *.c(c|pp) siblings of *.h(h|pp) files I backported `find-sibling-file` in 198fe82 and included with it some rudimentary `find-sibling-rules` rules for C++ and others. The C++ rule made *.h(h|pp) files the siblings of *.c(c|pp) files, but not vice versa, so users couldn't jump back to the source file with `find-sibling-file`; a second rule is necessary. These may be combinable, considering `find-sibling-file` deletes the current buffer's filename from the list of candidates... Fix: #7795 Ref: 198fe82b6d49 --- modules/lang/cc/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 9b1c2acc3..c4b0ce5ad 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -78,7 +78,8 @@ This is ignored by ccls.") :return "return" :yield "#require") - (add-to-list 'find-sibling-rules '("/\\([^/]+\\)\\.c\\(c\\|pp\\)\\'" "\\1.\\(h\\|hh\\|hpp\\)")) + (add-to-list 'find-sibling-rules '("/\\([^/]+\\)\\.c\\(c\\|pp\\)?\\'" "\\1.h\\(h\\|pp\\)?\\'")) + (add-to-list 'find-sibling-rules '("/\\([^/]+\\)\\.h\\(h\\|pp\\)?\\'" "\\1.c\\(c\\|pp\\)?\\'")) (when (modulep! +tree-sitter) (add-hook! '(c-mode-local-vars-hook