summaryrefslogtreecommitdiff
path: root/cape.el
diff options
context:
space:
mode:
Diffstat (limited to 'cape.el')
-rw-r--r--cape.el21
1 files changed, 19 insertions, 2 deletions
diff --git a/cape.el b/cape.el
index 0b1ef45..368522e 100644
--- a/cape.el
+++ b/cape.el
@@ -466,8 +466,10 @@ If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
(cape--interactive #'cape-symbol)
- (let ((bounds (cape--bounds 'symbol)))
- `(,(car bounds) ,(cdr bounds)
+ (pcase-let ((`(,beg . ,end) (cape--bounds 'symbol)))
+ (when (eq (char-after beg) ?')
+ (setq beg (1+ beg) end (max beg end)))
+ `(,beg ,end
,(cape--table-with-properties obarray :category 'symbol)
:exclusive no ,@cape--symbol-properties))))
@@ -1013,6 +1015,21 @@ case sensitive instead."
`(,beg ,end ,(cape--noninterruptible-table table) ,@plist)))))
;;;###autoload
+(defun cape-repair-misbehaving-capf (capf)
+ "Repair a misbehaving CAPF."
+ (catch 'cape--misbehaving-capf
+ (save-mark-and-excursion
+ (atomic-change-group
+ (pcase (funcall capf)
+ ((and res `(,beg ,end ,_table . ,_plist)
+ (guard (integer-or-marker-p beg))
+ (guard (integer-or-marker-p end)))
+ (ignore beg end)
+ res)
+ (_
+ (throw 'cape--misbehaving-capf nil)))))))
+
+;;;###autoload
(defun cape-interactive-capf (capf)
"Create interactive completion function from CAPF."
(lambda (&optional interactive)