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: [PATCH] Add support for C++ headers to `ffap'. Date: Thu, 19 Sep 2013 23:51 +0200 Message-ID: <2138438.X5SagT3ZR0@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 1379627487 16009 80.91.229.3 (19 Sep 2013 21:51:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Sep 2013 21:51:27 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 19 23:51:29 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 1VMm8H-0004s6-4d for ged-emacs-devel@m.gmane.org; Thu, 19 Sep 2013 23:51:29 +0200 Original-Received: from localhost ([::1]:53278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMm8G-0003vB-FZ for ged-emacs-devel@m.gmane.org; Thu, 19 Sep 2013 17:51:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMm87-0003mt-5x for emacs-devel@gnu.org; Thu, 19 Sep 2013 17:51:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMm81-0005eE-6h for emacs-devel@gnu.org; Thu, 19 Sep 2013 17:51:19 -0400 Original-Received: from ptmx.org ([178.63.28.110]:34214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMm81-0005e6-0P for emacs-devel@gnu.org; Thu, 19 Sep 2013 17:51:13 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by ptmx.org (Postfix) with ESMTP id EAFFB2A88A; Thu, 19 Sep 2013 23:51:10 +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 Ztu2HXEuzUny; Thu, 19 Sep 2013 23:51:05 +0200 (CEST) Original-Received: from descartes.localnet (chello080108246092.7.14.vie.surfer.at [80.108.246.92]) by ptmx.org (Postfix) with ESMTPSA id 3E27D2157D; Thu, 19 Sep 2013 23:51:05 +0200 (CEST) User-Agent: KMail/4.10.5 (Linux/3.8.0-30-generic; KDE/4.10.5; x86_64; ; ) 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:163488 Archived-At: Using only `ffap-c-mode' does not work for C++ headers from libstdc++. Those headers are usually stored in "/usr/include/c++//". * lisp/ffap.el (ffap-c++-path): New variable. (ffap-c++-mode): New function. (ffap-alist): Use `ffap-c++-mode' for `c++-mode'. Signed-off-by: R=C3=BCdiger Sonderfeld --- lisp/ffap.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lisp/ffap.el b/lisp/ffap.el index 737de8b..14700ad 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,22 @@ (defvar ffap-c-path (defun ffap-c-mode (name) (ffap-locate-file name t ffap-c-path)) =20 +(defvar ffap-c++-path + (let ((g++-version (with-temp-buffer + (when (=3D 0 (ignore-errors + (call-process "g++" nil t nil "-v"= ))) + (goto-char (point-min)) + (when (re-search-forward "gcc version=20 \\([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\\)" + nil 'noerror) + (match-string 1)))))) + (if g++-version + (cons (concat "/usr/include/c++/" g++-version) 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) --=20 1.8.4