aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-11-03 12:54:52 +0000
committerMiles Bader2000-11-03 12:54:52 +0000
commit0697c66283a8381b503b8d96629ccf4e2bdb41d3 (patch)
treee7bca085b676387c31cd9dbd2b3bf1e0e936df25
parent1fc02b3c4d5a0cabb712b8e6f8d19730e656a2c2 (diff)
downloademacs-0697c66283a8381b503b8d96629ccf4e2bdb41d3.tar.gz
emacs-0697c66283a8381b503b8d96629ccf4e2bdb41d3.zip
(widget-end-of-line): Reinstate, with a new definition, so that trailing
spaces are handled properly. (widget-field-keymap, widget-text-keymap): Likewise C-e binding.
-rw-r--r--lisp/wid-edit.el25
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.
995Trailing spaces at the end of padded fields are not considered part of
996the 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."