Commits

Anonymous committed ed427bf

Respect XEmacs backspace and delete behaviour, quail.e

  • Participants
  • Parent commits 65f8516

Comments (0)

Files changed (2)

+2010-02-18  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* quail.el (quail-translation-keymap)
+	(quail-simple-translation-keymap):
+	Changes these variables to reflect XEmacs backspace behaviour.
+	(quail-delete-backward-char): Rename this, to better reflect what
+	is in simple.el. Provide an alias for anyone else who uses the old
+	name.
+	(quail-backward-or-forward-delete-char): New function, a Quail
+	equivalent of #'backward-or-forward-delete-char.
+
 2010-02-18  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* quail.el (quail-mode-map): 
 ;;;    (define-key map "\e" '(keymap (t . quail-execute-non-quail-command)))
     (define-key map [?\C-\ ] 'quail-select-current)
     (define-key map [tab] 'quail-completion)
-    (define-key map [delete] 'quail-delete-last-char)
-    (define-key map [backspace] 'quail-delete-last-char)
+    (define-key map [delete] 'quail-backward-or-forward-delete-char)
+    (define-key map [backspace] 'quail-delete-backward-char)
     (let ((meta-map (make-sparse-keymap)))
       (when (characterp meta-prefix-char)
 	(define-key map (char-to-string meta-prefix-char) meta-map))
     (while (< i 127)
       (define-key map (char-to-string i) 'quail-self-insert-command)
       (setq i (1+ i)))
-    (define-key map "\177" 'quail-delete-last-char)
-    (define-key map [delete] 'quail-delete-last-char)
-    (define-key map [backspace] 'quail-delete-last-char)
+    (define-key map [delete] 'quail-backward-or-forward-delete-char)
+    (define-key map [backspace] 'quail-delete-backward-char)
 ;;; This interferes with handling of escape sequences on non-X terminals.
 ;;;    (define-key map "\e" '(keymap (t . quail-execute-non-quail-command)))
     (let ((meta-map (make-sparse-keymap)))
   (quail-delete-region)
   (quail-terminate-translation))
 
-(defun quail-delete-last-char ()
+(defun quail-delete-backward-char ()
   "Delete the last input character from the current Quail key sequence."
   (interactive)
   (if (= (length quail-current-key) 1)
     (setq quail-current-key (substring quail-current-key 0 -1))
     (quail-update-translation (quail-translate-key))))
 
+(define-compatible-function-alias
+  'quail-delete-last-char
+  'quail-delete-backward-char)
+
+(defun quail-backward-or-forward-delete-char (arg)
+  "Delete either one input character backwards or one character forwards.
+
+Which direction depends on the variable `delete-key-deletes-forward' and
+whether the BackSpace keysym exists on your keyboard.  If there is no
+BackSpace keysym, this function always deletes one character backwards.
+
+With ARG (interactively, a prefix argument; see `universal-argument'),
+delete that number of characters, only if deleting forwards."
+  (interactive "*p")
+  (if (delete-forward-p)
+      (delete-char arg)
+    (quail-delete-backward-char)))
+
 ;; For conversion mode.
 
 (defun quail-conversion-backward-char ()