comparison lisp/prim/simple.el @ 153:25f70ba0133c r20-3b3

Import from CVS: tag r20-3b3
author cvs
date Mon, 13 Aug 2007 09:38:25 +0200
parents 538048ae2ab8
children 43dd3413c7c7
comparison
equal deleted inserted replaced
152:4c132ee2d62b 153:25f70ba0133c
350 (delete-backward-char arg killp) 350 (delete-backward-char arg killp)
351 ;; XEmacs: In overwrite mode, back over columns while clearing them out, 351 ;; XEmacs: In overwrite mode, back over columns while clearing them out,
352 ;; unless at end of line. 352 ;; unless at end of line.
353 (and overwrite-mode (not (eolp)) 353 (and overwrite-mode (not (eolp))
354 (save-excursion (insert-char ?\ arg)))) 354 (save-excursion (insert-char ?\ arg))))
355
356 (defcustom delete-erases-forward nil
357 "If non-nil, the DEL key will erase one character forwards.
358 If nil, the DEL key will erase one character backwards."
359 :type 'boolean
360 :group 'editing-basics)
361
362 (defcustom backspace-or-delete-hook nil
363 "Hook that is run prior to executing the backspace-or-delete function.
364 Return a non-nil value to indicate that the editing chore has been
365 handled and the backspace-or-delete function will exit without doing
366 anything else."
367 :type 'hook)
368
369 (defun backspace-or-delete (arg)
370 "Delete either one character backwards or one character forwards.
371 Controlled by the state of `delete-erases-forward' and whether the
372 BackSpace keysym even exists on your keyboard. If you don't have a
373 BackSpace keysym, the delete key should always delete one character
374 backwards."
375 (interactive "*P")
376 (unless (run-hook-with-args 'backspace-or-delete-hook arg)
377 (if zmacs-region-active-p
378 (kill-region (point) (mark))
379 (if (and delete-erases-forward
380 (or (eq 'tty (device-type))
381 (x-keysym-on-keyboard-p "BackSpace")))
382 (delete-char (prefix-numeric-value arg))
383 (delete-backward-char (prefix-numeric-value arg))))))
355 384
356 (defun zap-to-char (arg char) 385 (defun zap-to-char (arg char)
357 "Kill up to and including ARG'th occurrence of CHAR. 386 "Kill up to and including ARG'th occurrence of CHAR.
358 Goes backward if ARG is negative; error if CHAR not found." 387 Goes backward if ARG is negative; error if CHAR not found."
359 (interactive "*p\ncZap to char: ") 388 (interactive "*p\ncZap to char: ")