aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Aranda2019-10-07 03:59:43 +0200
committerLars Ingebrigtsen2019-10-07 05:00:24 +0200
commit7d46b934ab60fdd58c46391636663ff85594c40b (patch)
treed9864f95abf67e7551aa85163aaab68fd5d1fc43
parent821c96c1b0421e8cf6ae0133402918e4ebc1466f (diff)
downloademacs-7d46b934ab60fdd58c46391636663ff85594c40b.tar.gz
emacs-7d46b934ab60fdd58c46391636663ff85594c40b.zip
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).
-rw-r--r--lisp/wid-edit.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index a5999c0de8d..4d1a609809d 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -58,6 +58,10 @@
58(require 'cl-lib) 58(require 'cl-lib)
59(eval-when-compile (require 'subr-x)) ; when-let 59(eval-when-compile (require 'subr-x)) ; when-let
60 60
61;; The `string' widget completion uses this.
62(declare-function ispell-get-word "ispell"
63 (following &optional extra-otherchars))
64
61;;; Compatibility. 65;;; Compatibility.
62 66
63(defun widget-event-point (event) 67(defun widget-event-point (event)
@@ -3074,7 +3078,12 @@ as the value."
3074 "A string." 3078 "A string."
3075 :tag "String" 3079 :tag "String"
3076 :format "%{%t%}: %v" 3080 :format "%{%t%}: %v"
3077 :complete-function 'ispell-complete-word 3081 :complete (lambda (widget)
3082 (require 'ispell)
3083 (let ((start (save-excursion (nth 1 (ispell-get-word nil)))))
3084 (if (< start (widget-field-start widget))
3085 (message "No word to complete inside field")
3086 (ispell-complete-word))))
3078 :prompt-history 'widget-string-prompt-value-history) 3087 :prompt-history 'widget-string-prompt-value-history)
3079 3088
3080(define-widget 'regexp 'string 3089(define-widget 'regexp 'string