]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix --last-keyword
authorIngo Lohmar <i.lohmar@gmail.com>
Fri, 13 Nov 2015 12:40:51 +0000 (13:40 +0100)
committerIngo Lohmar <i.lohmar@gmail.com>
Fri, 13 Nov 2015 12:40:51 +0000 (13:40 +0100)
- 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

index b982c487bd03a6714ccdbb6e44a7b045c4d3a46f..aaee5d21b1c3e810f00c59481869ffcd8d0523b9 100644 (file)
@@ -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))