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

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Tue, 24 Mar 2015 19:54:01 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20192 in the body.
You can then email your comments to 20192 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20192; Package emacs. (Tue, 24 Mar 2015 19:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 24 Mar 2015 19:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] for C or C++ sources (ff-find-other-file) now has a symmetric
 mapping
Date: Tue, 24 Mar 2015 12:54:11 -0700
[Message part 1 (text/plain, inline)]
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.

[0001-for-C-or-C-sources-ff-find-other-file-now-has-a-symm.patch (text/x-diff, inline)]
From 9175ffbbd0691fe2084933e47b4d6649ad243f5d Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20192; Package emacs. (Tue, 23 Feb 2016 10:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 20192 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 20192 <at> debbugs.gnu.org
Subject: Re: bug#20192: [PATCH] for C or C++ sources (ff-find-other-file) now
 has a symmetric mapping
Date: Tue, 23 Feb 2016 21:44:43 +1100
Dima Kogan <dima <at> secretsauce.net> writes:

> `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.

I think this sounds like a reasonable addition, but that's not a
function I've ever used, so I can't really say.  Does anybody object to
this change?

--- 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"))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20192; Package emacs. (Sun, 21 May 2017 23:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 20192 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Dima Kogan <dima <at> secretsauce.net>, 20192 <at> debbugs.gnu.org
Subject: Re: bug#20192: [PATCH] for C or C++ sources (ff-find-other-file) now
 has a symmetric mapping
Date: Sun, 21 May 2017 19:25:21 -0400
tags 20192 fixed
close 20192 26.1
quit

Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Dima Kogan <dima <at> secretsauce.net> writes:
>
>> `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.
>
> I think this sounds like a reasonable addition, but that's not a
> function I've ever used, so I can't really say.  Does anybody object to
> this change?

Seems like a straightforward improvement, pushed to master [1: 08848e33ba].

[1: 08848e33ba]: 2017-05-21 17:43:02 -0400
  Make ff-find-other-file symmetric for C++ (Bug#20192)
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=08848e33baf16d3137b171205f51839d8fcf7d06




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 21 May 2017 23:24:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 20192 <at> debbugs.gnu.org and Dima Kogan <dima <at> secretsauce.net> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 21 May 2017 23:24:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Jun 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.