emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master b20726c 026/173: string-prefix-p signals error on nil in E


From: Dmitry Gutov
Subject: [elpa] master b20726c 026/173: string-prefix-p signals error on nil in Emacs < 25
Date: Thu, 23 Jun 2016 00:28:35 +0000 (UTC)

branch: master
commit b20726c7b64dafdd10bd3ba44750e9acaad12b6f
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    string-prefix-p signals error on nil in Emacs < 25
    
    Fixes #332
---
 company-clang.el    |    2 +-
 test/clang-tests.el |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/company-clang.el b/company-clang.el
index 79bd5bd..cc392e4 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -145,7 +145,7 @@ or automatically through a custom 
`company-clang-prefix-guesser'."
 
 (defun company-clang--annotation (candidate)
   (let ((ann (company-clang--annotation-1 candidate)))
-    (if (not (string-prefix-p "(*)" ann))
+    (if (not (and ann (string-prefix-p "(*)" ann)))
         ann
       (with-temp-buffer
         (insert ann)
diff --git a/test/clang-tests.el b/test/clang-tests.el
index f2d55cc..abe690b 100644
--- a/test/clang-tests.el
+++ b/test/clang-tests.el
@@ -48,3 +48,7 @@
 (ert-deftest company-clang-func-ptr-annotation ()
   (let ((str (propertize "foo" 'meta "void (*)(int) foo")))
     (should (equal (company-clang 'annotation str) "(*)(int)"))))
+
+(ert-deftest company-clang-null-annotation ()
+  (let ((str "char"))
+    (should (null (company-clang 'annotation str)))))



reply via email to

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