diff options
Diffstat (limited to 'cape.el')
| -rw-r--r-- | cape.el | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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) |
