diff options
| -rw-r--r-- | lisp/wid-edit.el | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index deed46ddcda..355d3da6419 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el | |||
| @@ -801,18 +801,18 @@ Recommended as a parent keymap for modes using widgets.") | |||
| 801 | (define-key map "\M-\t" 'widget-complete) | 801 | (define-key map "\M-\t" 'widget-complete) |
| 802 | (define-key map "\C-m" 'widget-field-activate) | 802 | (define-key map "\C-m" 'widget-field-activate) |
| 803 | ;; Since the widget code uses a `field' property to identify fields, | 803 | ;; Since the widget code uses a `field' property to identify fields, |
| 804 | ;; ordinary beginning-of-line/end-of-line do the right thing. | 804 | ;; ordinary beginning-of-line does the right thing. |
| 805 | ;; (define-key map "\C-a" 'widget-beginning-of-line) | 805 | ;; (define-key map "\C-a" 'widget-beginning-of-line) |
| 806 | ;; (define-key map "\C-e" 'widget-end-of-line) | 806 | (define-key map "\C-e" 'widget-end-of-line) |
| 807 | map) | 807 | map) |
| 808 | "Keymap used inside an editable field.") | 808 | "Keymap used inside an editable field.") |
| 809 | 809 | ||
| 810 | (defvar widget-text-keymap | 810 | (defvar widget-text-keymap |
| 811 | (let ((map (copy-keymap widget-keymap))) | 811 | (let ((map (copy-keymap widget-keymap))) |
| 812 | ;; Since the widget code uses a `field' property to identify fields, | 812 | ;; Since the widget code uses a `field' property to identify fields, |
| 813 | ;; ordinary beginning-of-line/end-of-line do the right thing. | 813 | ;; ordinary beginning-of-line does the right thing. |
| 814 | ;; (define-key map "\C-a" 'widget-beginning-of-line) | 814 | ;; (define-key map "\C-a" 'widget-beginning-of-line) |
| 815 | ;; (define-key map "\C-e" 'widget-end-of-line) | 815 | (define-key map "\C-e" 'widget-end-of-line) |
| 816 | map) | 816 | map) |
| 817 | "Keymap used inside a text field.") | 817 | "Keymap used inside a text field.") |
| 818 | 818 | ||
| @@ -987,9 +987,22 @@ With optional ARG, move across that many fields." | |||
| 987 | (widget-move (- arg))) | 987 | (widget-move (- arg))) |
| 988 | 988 | ||
| 989 | ;; Since the widget code uses a `field' property to identify fields, | 989 | ;; Since the widget code uses a `field' property to identify fields, |
| 990 | ;; ordinary beginning-of-line/end-of-line do the right thing. | 990 | ;; ordinary beginning-of-line does the right thing. |
| 991 | (defalias 'widget-beginning-of-line 'beginning-of-line) | 991 | (defalias 'widget-beginning-of-line 'beginning-of-line) |
| 992 | (defalias 'widget-end-of-line 'end-of-line) | 992 | |
| 993 | (defun widget-end-of-line () | ||
| 994 | "Go to end of field or end of line, whichever is first. | ||
| 995 | Trailing spaces at the end of padded fields are not considered part of | ||
| 996 | the field." | ||
| 997 | (interactive) | ||
| 998 | ;; Ordinary end-of-line does the right thing, because we're inside | ||
| 999 | ;; text with a `field' property. | ||
| 1000 | (end-of-line) | ||
| 1001 | (unless (eolp) | ||
| 1002 | ;; ... except that we want to ignore trailing spaces in fields that | ||
| 1003 | ;; aren't terminated by a newline, because they are used as padding, | ||
| 1004 | ;; and ignored when extracting the entered value of the field. | ||
| 1005 | (skip-chars-backward " " (field-beginning (1- (point)))))) | ||
| 993 | 1006 | ||
| 994 | (defun widget-kill-line () | 1007 | (defun widget-kill-line () |
| 995 | "Kill to end of field or end of line, whichever is first." | 1008 | "Kill to end of field or end of line, whichever is first." |