# HG changeset patch # User Eli Zaretskii # Date 1101559834 0 # Node ID 3b4942fd58d818979789fa68d494c418cdb22834 # Parent 038e5e4c217778f2e927212c00c7b502b8f9765c (widget-narrow-to-field): New function. (widget-complete): Use it. diff -r 038e5e4c2177 -r 3b4942fd58d8 lisp/wid-edit.el --- a/lisp/wid-edit.el Sat Nov 27 12:29:12 2004 +0000 +++ b/lisp/wid-edit.el Sat Nov 27 12:50:34 2004 +0000 @@ -1085,14 +1085,23 @@ :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.