summaryrefslogtreecommitdiff
path: root/lisp/ffap.el
diff options
context:
space:
mode:
authorRĂ¼diger Sonderfeld <ruediger@c-plusplus.de>2013-10-18 19:35:20 -0700
committerGlenn Morris <rgm@gnu.org>2013-10-18 19:35:20 -0700
commit7deed4bf2aab3b92f3b3d1d46fd6717b245c72d1 (patch)
treef992c2944c71263cf6fd0c3aeab560da63501bb0 /lisp/ffap.el
parent7bcb455b5fd40a6301e5f506eeea43a5ca291b07 (diff)
downloademacs-7deed4bf2aab3b92f3b3d1d46fd6717b245c72d1.tar.gz
ffap.el: handle "/usr/include/c++/<version>" directories.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00387.html * lisp/ffap.el (ffap-alist): Use ffap-c++-mode for c++-mode. (ffap-c++-path): New variable. (ffap-c++-mode): New function.
Diffstat (limited to 'lisp/ffap.el')
-rw-r--r--lisp/ffap.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 737de8b5991..62bcb304710 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -769,7 +769,7 @@ This uses `ffap-file-exists-string', which may try adding suffixes from
;; (lisp-interaction-mode . ffap-el-mode) ; maybe
(finder-mode . ffap-el-mode) ; type {C-h p} and try it
(help-mode . ffap-el-mode) ; maybe useful
- (c++-mode . ffap-c-mode) ; search ffap-c-path
+ (c++-mode . ffap-c++-mode) ; search ffap-c++-path
(cc-mode . ffap-c-mode) ; same
("\\.\\([chCH]\\|cc\\|hh\\)\\'" . ffap-c-mode) ; stdio.h
(fortran-mode . ffap-fortran-mode) ; FORTRAN requested by MDB
@@ -866,6 +866,28 @@ URL, or nil. If nil, search the alist for further matches.")
(defun ffap-c-mode (name)
(ffap-locate-file name t ffap-c-path))
+(defvar ffap-c++-path
+ (let ((c++-include-dir (with-temp-buffer
+ (when (eq 0 (ignore-errors
+ (call-process "g++" nil t nil "-v")))
+ (goto-char (point-min))
+ (if (re-search-forward "--with-gxx-include-dir=\
+\\([^[:space:]]+\\)"
+ nil 'noerror)
+ (match-string 1)
+ (when (re-search-forward "gcc version \
+\\([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\\)"
+ nil 'noerror)
+ (expand-file-name (match-string 1)
+ "/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"))
(defun ffap-fortran-mode (name)