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

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

[elpa] master c8d65f6 1/3: Fix --last-keyword


From: Ingo Lohmar
Subject: [elpa] master c8d65f6 1/3: Fix --last-keyword
Date: Thu, 26 Nov 2015 20:58:11 +0000

branch: master
commit c8d65f6404dafc8ebb91260731e370db9fab0d42
Author: Ingo Lohmar <address@hidden>
Commit: Ingo Lohmar <address@hidden>

    Fix --last-keyword
    
    - work for (< 1 (point-min)), fixes #7
    - always return nil (instead of keyword "") if there is not a single
      keyword before point
---
 company-statistics.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/company-statistics.el b/company-statistics.el
index b982c48..aaee5d2 100644
--- a/company-statistics.el
+++ b/company-statistics.el
@@ -184,12 +184,14 @@ number)."
 font-lock-keyword-face up to point, or nil."
   (let ((face-pos (point)))
     (while (and (number-or-marker-p face-pos)
-                (< 1 face-pos)
+                (< (point-min) face-pos)
                 (not (eq (get-text-property (1- face-pos) 'face)
                          'font-lock-keyword-face)))
       (setq face-pos
             (previous-single-property-change face-pos 'face nil (point-min))))
-    (when (and (number-or-marker-p face-pos))      ;else eval to nil
+    (when (and (number-or-marker-p face-pos)
+               (eq (get-text-property (max (point-min) (1- face-pos)) 'face)
+                   'font-lock-keyword-face))
       (list :keyword
             (buffer-substring-no-properties
              (previous-single-property-change face-pos 'face nil (point-min))



reply via email to

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