aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Sonderfeld2013-10-18 19:35:20 -0700
committerGlenn Morris2013-10-18 19:35:20 -0700
commit7deed4bf2aab3b92f3b3d1d46fd6717b245c72d1 (patch)
treef992c2944c71263cf6fd0c3aeab560da63501bb0
parent7bcb455b5fd40a6301e5f506eeea43a5ca291b07 (diff)
downloademacs-7deed4bf2aab3b92f3b3d1d46fd6717b245c72d1.tar.gz
emacs-7deed4bf2aab3b92f3b3d1d46fd6717b245c72d1.zip
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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/ffap.el24
2 files changed, 30 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 65060df83ae..6a8946a6228 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-10-19 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de>
2
3 * ffap.el: Handle "/usr/include/c++/<version>" directories.
4 (ffap-alist): Use ffap-c++-mode for c++-mode.
5 (ffap-c++-path): New variable.
6 (ffap-c++-mode): New function.
7
12013-10-19 Joe Vornehm Jr. <joe.vornehm@gmail.com> (tiny change) 82013-10-19 Joe Vornehm Jr. <joe.vornehm@gmail.com> (tiny change)
2 9
3 * ido.el (dired-other-frame): Only list directories. (Bug#15638) 10 * ido.el (dired-other-frame): Only list directories. (Bug#15638)
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
769 ;; (lisp-interaction-mode . ffap-el-mode) ; maybe 769 ;; (lisp-interaction-mode . ffap-el-mode) ; maybe
770 (finder-mode . ffap-el-mode) ; type {C-h p} and try it 770 (finder-mode . ffap-el-mode) ; type {C-h p} and try it
771 (help-mode . ffap-el-mode) ; maybe useful 771 (help-mode . ffap-el-mode) ; maybe useful
772 (c++-mode . ffap-c-mode) ; search ffap-c-path 772 (c++-mode . ffap-c++-mode) ; search ffap-c++-path
773 (cc-mode . ffap-c-mode) ; same 773 (cc-mode . ffap-c-mode) ; same
774 ("\\.\\([chCH]\\|cc\\|hh\\)\\'" . ffap-c-mode) ; stdio.h 774 ("\\.\\([chCH]\\|cc\\|hh\\)\\'" . ffap-c-mode) ; stdio.h
775 (fortran-mode . ffap-fortran-mode) ; FORTRAN requested by MDB 775 (fortran-mode . ffap-fortran-mode) ; FORTRAN requested by MDB
@@ -866,6 +866,28 @@ URL, or nil. If nil, search the alist for further matches.")
866(defun ffap-c-mode (name) 866(defun ffap-c-mode (name)
867 (ffap-locate-file name t ffap-c-path)) 867 (ffap-locate-file name t ffap-c-path))
868 868
869(defvar ffap-c++-path
870 (let ((c++-include-dir (with-temp-buffer
871 (when (eq 0 (ignore-errors
872 (call-process "g++" nil t nil "-v")))
873 (goto-char (point-min))
874 (if (re-search-forward "--with-gxx-include-dir=\
875\\([^[:space:]]+\\)"
876 nil 'noerror)
877 (match-string 1)
878 (when (re-search-forward "gcc version \
879\\([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\\)"
880 nil 'noerror)
881 (expand-file-name (match-string 1)
882 "/usr/include/c++/")))))))
883 (if c++-include-dir
884 (cons c++-include-dir ffap-c-path)
885 ffap-c-path))
886 "List of directories to search for include files.")
887
888(defun ffap-c++-mode (name)
889 (ffap-locate-file name t ffap-c++-path))
890
869(defvar ffap-fortran-path '("../include" "/usr/include")) 891(defvar ffap-fortran-path '("../include" "/usr/include"))
870 892
871(defun ffap-fortran-mode (name) 893(defun ffap-fortran-mode (name)