emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114715: ffap.el: handle "/usr/include/c++/<version>


From: Glenn Morris
Subject: [Emacs-diffs] trunk r114715: ffap.el: handle "/usr/include/c++/<version>" directories.
Date: Sat, 19 Oct 2013 02:35:25 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114715
revision-id: address@hidden
parent: address@hidden
author: RĂ¼diger Sonderfeld <address@hidden>
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-18 19:35:20 -0700
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/ffap.el                   ffap.el-20091113204419-o5vbwnq5f7feedwu-953
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-10-19 00:39:31 +0000
+++ b/lisp/ChangeLog    2013-10-19 02:35:20 +0000
@@ -1,3 +1,10 @@
+2013-10-19  RĂ¼diger Sonderfeld  <address@hidden>
+
+       * ffap.el: Handle "/usr/include/c++/<version>" directories.
+       (ffap-alist): Use ffap-c++-mode for c++-mode.
+       (ffap-c++-path): New variable.
+       (ffap-c++-mode): New function.
+
 2013-10-19  Joe Vornehm Jr.  <address@hidden>  (tiny change)
 
        * ido.el (dired-other-frame): Only list directories.  (Bug#15638)

=== modified file 'lisp/ffap.el'
--- a/lisp/ffap.el      2013-08-09 23:08:46 +0000
+++ b/lisp/ffap.el      2013-10-19 02:35:20 +0000
@@ -769,7 +769,7 @@
     ;; (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 @@
 (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]