From: Eli Zaretskii Date: Sat, 27 Nov 2004 12:50:34 +0000 (+0000) Subject: (widget-narrow-to-field): New function. X-Git-Tag: ttn-vms-21-2-B4~3607 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=301f9235f6be9f0714bcc442fadcd42519173b4e;p=emacs.git (widget-narrow-to-field): New function. (widget-complete): Use it. --- diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 05ef4b95658..f659518ee02 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -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.