summaryrefslogtreecommitdiff
path: root/lisp/ffap.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-02-22 00:34:02 -0800
committerGlenn Morris <rgm@gnu.org>2012-02-22 00:34:02 -0800
commitac2eceeee1884be2a4187f5daa3b186cbd6f5a15 (patch)
tree7ce08f35766b87b47cbc692a36a12c3bfde53e7a /lisp/ffap.el
parent40ace058dc04202e2e21e4754b7ed8fe08b124c3 (diff)
downloademacs-ac2eceeee1884be2a4187f5daa3b186cbd6f5a15.tar.gz
Fixes related to /usr/include path on multiarch systems
* lisp/ffap.el (ffap-c-path): * lisp/man.el (Man-header-file-path): Handle multiarch. Fixes: debbugs:10702
Diffstat (limited to 'lisp/ffap.el')
-rw-r--r--lisp/ffap.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el
index c3797536f19..99017d27490 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -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))