Mercurial > emacs
comparison lisp/wid-edit.el @ 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 | 7759479de37c |
children | 4b3cfed7370f |
comparison
equal
deleted
inserted
replaced
58577:038e5e4c2177 | 58578:3b4942fd58d8 |
---|---|
1083 "Default function to call for completion inside fields." | 1083 "Default function to call for completion inside fields." |
1084 :options '(ispell-complete-word complete-tag lisp-complete-symbol) | 1084 :options '(ispell-complete-word complete-tag lisp-complete-symbol) |
1085 :type 'function | 1085 :type 'function |
1086 :group 'widgets) | 1086 :group 'widgets) |
1087 | 1087 |
1088 (defun widget-narrow-to-field () | |
1089 "Narrow to field" | |
1090 (interactive) | |
1091 (let ((field (widget-field-find (point)))) | |
1092 (if field | |
1093 (narrow-to-region (line-beginning-position) (line-end-position))))) | |
1094 | |
1088 (defun widget-complete () | 1095 (defun widget-complete () |
1089 "Complete content of editable field from point. | 1096 "Complete content of editable field from point. |
1090 When not inside a field, move to the previous button or field." | 1097 When not inside a field, move to the previous button or field." |
1091 (interactive) | 1098 (interactive) |
1092 (let ((field (widget-field-find (point)))) | 1099 (let ((field (widget-field-find (point)))) |
1093 (if field | 1100 (if field |
1094 (widget-apply field :complete) | 1101 (save-restriction |
1095 (error "Not in an editable field")))) | 1102 (widget-narrow-to-field) |
1103 (widget-apply field :complete)) | |
1104 (error "Not in an editable field")))) | |
1096 | 1105 |
1097 ;;; Setting up the buffer. | 1106 ;;; Setting up the buffer. |
1098 | 1107 |
1099 (defvar widget-field-new nil | 1108 (defvar widget-field-new nil |
1100 "List of all newly created editable fields in the buffer.") | 1109 "List of all newly created editable fields in the buffer.") |