mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-03 11:33:37 +00:00
Only complete words inside of the string widget
* lisp/wid-edit.el ('string widget): Peek the word that ispell-complete-word will try to complete, and only offer completions when the word is inside of the field (bug#11046).
This commit is contained in:
parent
821c96c1b0
commit
7d46b934ab
@ -58,6 +58,10 @@
|
||||
(require 'cl-lib)
|
||||
(eval-when-compile (require 'subr-x)) ; when-let
|
||||
|
||||
;; The `string' widget completion uses this.
|
||||
(declare-function ispell-get-word "ispell"
|
||||
(following &optional extra-otherchars))
|
||||
|
||||
;;; Compatibility.
|
||||
|
||||
(defun widget-event-point (event)
|
||||
@ -3074,7 +3078,12 @@ as the value."
|
||||
"A string."
|
||||
:tag "String"
|
||||
:format "%{%t%}: %v"
|
||||
:complete-function 'ispell-complete-word
|
||||
:complete (lambda (widget)
|
||||
(require 'ispell)
|
||||
(let ((start (save-excursion (nth 1 (ispell-get-word nil)))))
|
||||
(if (< start (widget-field-start widget))
|
||||
(message "No word to complete inside field")
|
||||
(ispell-complete-word))))
|
||||
:prompt-history 'widget-string-prompt-value-history)
|
||||
|
||||
(define-widget 'regexp 'string
|
||||
|
Loading…
Reference in New Issue
Block a user