1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

(widget-narrow-to-field): New function.

(widget-complete): Use it.
This commit is contained in:
Eli Zaretskii 2004-11-27 12:50:34 +00:00
parent 77cafc7a48
commit 301f9235f6

View 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.