]> git.eshelyaron.com Git - emacs.git/commitdiff
(widget-narrow-to-field): New function.
authorEli Zaretskii <eliz@gnu.org>
Sat, 27 Nov 2004 12:50:34 +0000 (12:50 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 27 Nov 2004 12:50:34 +0000 (12:50 +0000)
(widget-complete): Use it.

lisp/wid-edit.el

index 05ef4b95658831b0956d90fc62f5a12982ac34ab..f659518ee0298d4700086f0a74d410039987ff5d 100644 (file)
@@ -1085,14 +1085,23 @@ the field."
   :type 'function
   :group 'widgets)
 
+(defun widget-narrow-to-field ()
+  "Narrow to field"
+  (interactive)
+  (let ((field (widget-field-find (point))))
+    (if field
+       (narrow-to-region (line-beginning-position) (line-end-position)))))
+
 (defun widget-complete ()
   "Complete content of editable field from point.
 When not inside a field, move to the previous button or field."
   (interactive)
   (let ((field (widget-field-find (point))))
     (if field
-       (widget-apply field :complete)
-      (error "Not in an editable field"))))
+       (save-restriction
+         (widget-narrow-to-field)
+         (widget-apply field :complete))
+         (error "Not in an editable field"))))
 
 ;;; Setting up the buffer.