diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 21:33:43 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 21:33:43 +0000 |
commit | d2bd8a826b779e007b3b3c57279090f11d7e1c41 (patch) | |
tree | 6de8bdc5ca6f0b6941526772f4b9626044c04c1d | |
parent | 11dc6b8bbb654ebff47328ddf1abd35ff0fc17eb (diff) | |
download | chromium_src-d2bd8a826b779e007b3b3c57279090f11d7e1c41.zip chromium_src-d2bd8a826b779e007b3b3c57279090f11d7e1c41.tar.gz chromium_src-d2bd8a826b779e007b3b3c57279090f11d7e1c41.tar.bz2 |
Fix for configs where the Chrome checkout is under user's home directory (in which case buffer-file-truename returns a path starting with ~).
BUG=none
Review URL: http://codereview.chromium.org/8872013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113664 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | tools/emacs/flymake-chromium.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/emacs/flymake-chromium.el b/tools/emacs/flymake-chromium.el index 070fada..8adb0db 100644 --- a/tools/emacs/flymake-chromium.el +++ b/tools/emacs/flymake-chromium.el @@ -18,9 +18,17 @@ (defcustom cr-flymake-ninja-executable "ninja" "Ninja executable location; either in $PATH or explicitly given.") +(defun cr-flymake-absbufferpath () + "Return the absolute path to the current buffer, or nil if the + current buffer has no path." + (when buffer-file-truename + (expand-file-name buffer-file-truename))) + (defun cr-flymake-chromium-src () "Return chromium's src/ directory, or nil on failure." - (locate-dominating-file buffer-file-truename cr-flymake-ninja-build-file)) + (let ((srcdir (locate-dominating-file + (cr-flymake-absbufferpath) cr-flymake-ninja-build-file))) + (when srcdir (expand-file-name srcdir)))) (defun cr-flymake-string-prefix-p (prefix str) "Return non-nil if PREFIX is a prefix of STR (23.2 has string-prefix-p but @@ -33,8 +41,8 @@ we're under chromium/src/." (when (and (cr-flymake-chromium-src) (cr-flymake-string-prefix-p - (cr-flymake-chromium-src) buffer-file-truename)) - (substring buffer-file-truename (length (cr-flymake-chromium-src))))) + (cr-flymake-chromium-src) (cr-flymake-absbufferpath))) + (substring (cr-flymake-absbufferpath) (length (cr-flymake-chromium-src))))) (defun cr-flymake-from-build-to-src-root () "Return a path fragment for getting from the build.ninja file to src/." |