Mercurial > emacs
changeset 58578:3b4942fd58d8
(widget-narrow-to-field): New function.
(widget-complete): Use it.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 27 Nov 2004 12:50:34 +0000 |
parents | 038e5e4c2177 |
children | 5b1b799663a2 |
files | lisp/wid-edit.el |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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.