GNU bug report logs -
#74410
31.0.50; completion-at-point doesn't work in custom buffers
Previous Next
Full log
View this message in rfc822 format
>> Currently this works only when typing 'M-x completion-at-point RET',
>> not by 'M-C-i' that is bound to 'widget-complete'. Maybe
>> 'M-C-i' should be rebound to 'completion-at-point' in widgets?
>
> Maybe it would make even more sense to just remove the `widget-complete`
> binding since M-TAB should already be bound appropriately, but the
> problem is that we don't know that the code which inserts the widget
> into a buffer has properly setup the `completion-at-point-functions`
> hook for `completion-at-point` to work.
>
> Maybe we should try and detect when that is not the case and emit
> a warning if so (with the hope to be able to obsolete `widget-complete`
> in some future version).
Or to make the binding conditional with something like this:
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index ba99847f488..0701442447c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1079,7 +1079,10 @@ widget-global-map
(defvar widget-field-keymap
(let ((map (copy-keymap widget-keymap)))
(define-key map "\C-k" #'widget-kill-line)
- (define-key map "\M-\t" #'widget-complete)
+ (define-key map "\M-\t" `(menu-item "" 'widget-complete
+ :filter ,(lambda (cmd)
+ (unless completion-at-point-functions
+ cmd))))
(define-key map "\C-m" #'widget-field-activate)
;; Since the widget code uses a `field' property to identify fields,
;; ordinary beginning-of-line does the right thing.
This bug report was last modified 204 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.