Subject: bug#20192: [PATCH] for C or C++ sources (ff-find-other-file) now has a symmetric mapping

From: Dima Kogan <[email-masked]>
Date: Tue, 24 Mar 2015 12:54:11 -0700

Hi

`cc-other-file-alist' has a mapping of file extensions to switch
between headers and sources, but the mappings weren't completely
symmetric.  In particular .cpp would map to .hh, but .hh would NOT map
to .cpp.  This patch updates the mappings to always contain symmetric
pairs so that repeated invocations of (ff-find-other-file) can toggle
between all pairs of sources/headers.

>From 9175ffbbd0691fe2084933e47b4d6649ad243f5d Mon Sep 17 00:00:00 2001
From: Dima Kogan <[email-masked]>
Date: Tue, 24 Mar 2015 12:53:08 -0700
Subject: [PATCH] for C or C++ sources, (ff-find-other-file) now has a
 symmetric mapping

`cc-other-file-alist' has a mapping of file extensions to switch
between headers and sources, but the mappings weren't completely
symmetric.  In particular .cpp would map to .hh, but .hh would NOT map
to .cpp.  This patch updates the mappings to always contain symmetric
pairs so that repeated invocations of (ff-find-other-file) can toggle
between all pairs of sources/headers.
---
 lisp/find-file.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/find-file.el b/lisp/find-file.el
index 97e95d2..a5d15c5 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -242,11 +242,11 @@ the preceding slash.  The star represents all the subdirectories except
 
 (defcustom cc-other-file-alist
   '(("\\.cc\\'"  (".hh" ".h"))
-    ("\\.hh\\'"  (".cc" ".C"))
+    ("\\.hh\\'"  (".cc" ".C" ".CC" ".cxx" ".cpp" ".c++"))
 
     ("\\.c\\'"   (".h"))
     ("\\.m\\'"   (".h"))
-    ("\\.h\\'"   (".c" ".cc" ".C" ".CC" ".cxx" ".cpp" ".m"))
+    ("\\.h\\'"   (".c" ".cc" ".C" ".CC" ".cxx" ".cpp" ".c++" ".m"))
 
     ("\\.C\\'"   (".H"  ".hh" ".h"))
     ("\\.H\\'"   (".C"  ".CC"))
-- 
2.1.4