From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?R=FCdiger?= Sonderfeld Newsgroups: gmane.emacs.devel Subject: Re: [PATCH 2] Add support for C++ headers to `ffap'. Date: Tue, 01 Oct 2013 00:11:01 +0200 Message-ID: <3329488.PbsQCtPhet@descartes> References: <2138438.X5SagT3ZR0@descartes> <5477680.YgUupvPcjf@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1380579079 12327 80.91.229.3 (30 Sep 2013 22:11:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 30 Sep 2013 22:11:19 +0000 (UTC) Cc: Thien-Thi Nguyen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 01 00:11:22 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VQlgV-0006nm-TS for ged-emacs-devel@m.gmane.org; Tue, 01 Oct 2013 00:11:20 +0200 Original-Received: from localhost ([::1]:51854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQlgV-0004HC-0o for ged-emacs-devel@m.gmane.org; Mon, 30 Sep 2013 18:11:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQlgN-0004CQ-BM for emacs-devel@gnu.org; Mon, 30 Sep 2013 18:11:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQlgH-0007bb-BM for emacs-devel@gnu.org; Mon, 30 Sep 2013 18:11:11 -0400 Original-Received: from ptmx.org ([178.63.28.110]:43743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQlgG-0007bL-Pa; Mon, 30 Sep 2013 18:11:05 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by ptmx.org (Postfix) with ESMTP id 5115B2ABED; Tue, 1 Oct 2013 00:11:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at ptmx.org Original-Received: from ptmx.org ([127.0.0.1]) by localhost (ptmx.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2lFEU4+5m1nb; Tue, 1 Oct 2013 00:11:02 +0200 (CEST) Original-Received: from descartes.localnet (chello080108246092.7.14.vie.surfer.at [80.108.246.92]) by ptmx.org (Postfix) with ESMTPSA id B6F81213D2; Tue, 1 Oct 2013 00:11:02 +0200 (CEST) User-Agent: KMail/4.10.5 (Linux/3.8.0-30-generic; KDE/4.10.5; x86_64; ; ) In-Reply-To: <5477680.YgUupvPcjf@descartes> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 178.63.28.110 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:163748 Archived-At: *ping* Any comment about the updated version? Regards, R=C3=BCdiger Sonderfeld On Friday 20 September 2013 12:10:55 R=C3=BCdiger Sonderfeld wrote: > This updated version also checks if GCC was configured with > `--with-gxx-include-dir=3D'. >=20 > --- 8< ------------------------------------------------------------- = >8 --- >=20 > Using only `ffap-c-mode' does not work for C++ headers from > libstdc++. Those headers are usually stored in > "/usr/include/c++//". >=20 > * lisp/ffap.el (ffap-c++-path): New variable. > (ffap-c++-mode): New function. > (ffap-alist): Use `ffap-c++-mode' for `c++-mode'. >=20 > Signed-off-by: R=C3=BCdiger Sonderfeld > --- > lisp/ffap.el | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) >=20 > diff --git a/lisp/ffap.el b/lisp/ffap.el > index 737de8b..79539a4 100644 > --- a/lisp/ffap.el > +++ b/lisp/ffap.el > @@ -769,7 +769,7 @@ (defvar ffap-alist > ;; (lisp-interaction-mode . ffap-el-mode) ; maybe > (finder-mode . ffap-el-mode)=09; type {C-h p} and try it > (help-mode . ffap-el-mode)=09=09; maybe useful > - (c++-mode . ffap-c-mode)=09=09; search ffap-c-path > + (c++-mode . ffap-c++-mode)=09=09; search ffap-c++-path > (cc-mode . ffap-c-mode)=09=09; same > ("\\.\\([chCH]\\|cc\\|hh\\)\\'" . ffap-c-mode) ; stdio.h > (fortran-mode . ffap-fortran-mode)=09; FORTRAN requested by MDB > @@ -866,6 +866,28 @@ (defvar ffap-c-path > (defun ffap-c-mode (name) > (ffap-locate-file name t ffap-c-path)) >=20 > +(defvar ffap-c++-path > + (let ((c++-include-dir (with-temp-buffer > + (when (eq 0 (ignore-errors > + (call-process "g++" nil t n= il > "-v"))) + (goto-char (point-min)) > + (if (re-search-forward > "--with-gxx-include-dir=3D\ +\\([^[:space:]]+\\)" > + nil 'noerror) > + (match-string 1) > + (when (re-search-forward "gcc version= \ > +\\([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\\)" > + nil 'noerror) > + (expand-file-name (match-string 1) > + =20 > "/usr/include/c++/"))))))) + (if c++-include-dir > + (cons c++-include-dir ffap-c-path) > + ffap-c-path)) > + "List of directories to search for include files.") > + > +(defun ffap-c++-mode (name) > + (ffap-locate-file name t ffap-c++-path)) > + > (defvar ffap-fortran-path '("../include" "/usr/include")) >=20 > (defun ffap-fortran-mode (name)