From 2f56971066f672292b99275e52d2921d12b8a1da Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Mon, 27 Apr 2015 11:30:56 +0000 Subject: Fixed at-point detection (bis). --- coq/coq.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coq/coq.el b/coq/coq.el index 42ceb2e3..45a0c7c1 100644 --- a/coq/coq.el +++ b/coq/coq.el @@ -727,18 +727,23 @@ Return nil if S is nil." s)) (defun coq-is-symbol-or-punct (c) - (or (equal (char-syntax c) ?\.) (equal (char-syntax c) ?\_))) + "Return non nil if character C is a punctuation or a symbol constituent. +If C is nil, return nil." + (when c + (or (equal (char-syntax c) ?\.) (equal (char-syntax c) ?\_)))) (defun coq-grab-punctuation-left (pos) + "Return a string made of punctuations chars found immediately before position POS." (let ((res nil) (currpos pos)) - (while (and (coq-is-symbol-or-punct (char-before currpos))) + (while (coq-is-symbol-or-punct (char-before currpos)) (setq res (concat (char-to-string (char-before currpos)) res)) (setq currpos (- currpos 1))) res)) (defun coq-grab-punctuation-right (pos) + "Return a string made of punctuations chars found immediately after position POS." (let ((res nil) (currpos pos)) (while (coq-is-symbol-or-punct (char-after currpos)) -- cgit v1.2.3