]> code.delx.au - gnu-emacs/blobdiff - lisp/ffap.el
* lisp/minibuffer.el (completion-file-name-table): Complete user names.
[gnu-emacs] / lisp / ffap.el
index c3797536f193c338da3dc2ed8de13840453adcad..52ffc9905ed9ae79ee7e253fb3c2252003fe7178 100644 (file)
@@ -850,9 +850,24 @@ URL, or nil.  If nil, search the alist for further matches.")
   (and (not (string-match "\\.el\\'" name))
        (ffap-locate-file name '(".el") load-path)))
 
+;; FIXME this duplicates the logic of Man-header-file-path.
+;; There should be a single central variable or function for this.
+;; See also (bug#10702):
+;; cc-search-directories, semantic-c-dependency-system-include-path,
+;; semantic-gcc-setup
 (defvar ffap-c-path
-  ;; Need smarter defaults here!  Suggestions welcome.
-  '("/usr/include" "/usr/local/include"))
+  (let ((arch (with-temp-buffer
+                (when (eq 0 (ignore-errors
+                              (call-process "gcc" nil '(t nil) nil
+                                            "-print-multiarch")))
+                  (goto-char (point-min))
+                  (buffer-substring (point) (line-end-position)))))
+        (base '("/usr/include" "/usr/local/include")))
+    (if (zerop (length arch))
+        base
+      (append base (list (expand-file-name arch "/usr/include")))))
+  "List of directories to search for include files.")
+
 (defun ffap-c-mode (name)
   (ffap-locate-file name t ffap-c-path))
 
@@ -1457,7 +1472,7 @@ and the functions `ffap-file-at-point' and `ffap-url-at-point'."
 ;;; Menu support (`ffap-menu'):
 
 (defvar ffap-menu-regexp nil
-  "*If non-nil, overrides `ffap-next-regexp' during `ffap-menu'.
+  "If non-nil, overrides `ffap-next-regexp' during `ffap-menu'.
 Make this more restrictive for faster menu building.
 For example, try \":/\" for URL (and some ftp) references.")