From: Dmitry Gutov Date: Sun, 17 Mar 2013 23:00:11 +0000 (+0400) Subject: company-clang-guess-prefix: don't error out when no such file X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/292684bd46ca5c9eb5a4ee6942b92f92896a716e company-clang-guess-prefix: don't error out when no such file --- diff --git a/company-clang.el b/company-clang.el index 63486d0a7..160b9f8a9 100644 --- a/company-clang.el +++ b/company-clang.el @@ -1,6 +1,6 @@ ;;; company-clang.el --- A company-mode completion back-end for clang -;; Copyright (C) 2009, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2011, 2013 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -77,7 +77,7 @@ Prefix files (-include ...) can be selected with ;; Prefixes seem to be called .pch. Pre-compiled headers do, too. ;; So we look at the magic number to rule them out. (let* ((file (company-clang--guess-pch-file buffer-file-name)) - (magic-number (company-clang--file-substring file 0 4))) + (magic-number (and file (company-clang--file-substring file 0 4)))) (unless (member magic-number '("CPCH" "gpch")) file)))