Mercurial > hg > xemacs-beta
comparison lisp/simple.el @ 446:1ccc32a20af4 r21-2-38
Import from CVS: tag r21-2-38
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:37:21 +0200 |
parents | 576fb035e263 |
children | 3078fd1074e8 |
comparison
equal
deleted
inserted
replaced
445:34f3776fcf0e | 446:1ccc32a20af4 |
---|---|
303 Leave one space or none, according to the context." | 303 Leave one space or none, according to the context." |
304 (interactive "*") | 304 (interactive "*") |
305 (save-excursion | 305 (save-excursion |
306 (delete-horizontal-space) | 306 (delete-horizontal-space) |
307 (if (or (looking-at "^\\|\\s)") | 307 (if (or (looking-at "^\\|\\s)") |
308 (save-excursion (forward-char -1) | 308 (save-excursion (backward-char 1) |
309 (looking-at "$\\|\\s(\\|\\s'"))) | 309 (looking-at "$\\|\\s(\\|\\s'"))) |
310 nil | 310 nil |
311 (insert ?\ )))) | 311 (insert ?\ )))) |
312 | 312 |
313 (defun delete-horizontal-space () | 313 (defun delete-horizontal-space () |
420 (let ((count arg)) | 420 (let ((count arg)) |
421 (save-excursion | 421 (save-excursion |
422 (while (and (> count 0) (not (bobp))) | 422 (while (and (> count 0) (not (bobp))) |
423 (if (eq (char-before (point)) ?\t) ; XEmacs | 423 (if (eq (char-before (point)) ?\t) ; XEmacs |
424 (let ((col (current-column))) | 424 (let ((col (current-column))) |
425 (forward-char -1) | 425 (backward-char 1) |
426 (setq col (- col (current-column))) | 426 (setq col (- col (current-column))) |
427 (insert-char ?\ col) | 427 (insert-char ?\ col) |
428 (delete-char 1))) | 428 (delete-char 1))) |
429 (forward-char -1) | 429 (backward-char 1) |
430 (setq count (1- count))))) | 430 (setq count (1- count))))) |
431 (delete-backward-char arg killp) | 431 (delete-backward-char arg killp) |
432 ;; XEmacs: In overwrite mode, back over columns while clearing them out, | 432 ;; XEmacs: In overwrite mode, back over columns while clearing them out, |
433 ;; unless at end of line. | 433 ;; unless at end of line. |
434 (and overwrite-mode (not (eolp)) | 434 (and overwrite-mode (not (eolp)) |
438 "*If non-nil, the DEL key will erase one character forwards. | 438 "*If non-nil, the DEL key will erase one character forwards. |
439 If nil, the DEL key will erase one character backwards." | 439 If nil, the DEL key will erase one character backwards." |
440 :type 'boolean | 440 :type 'boolean |
441 :group 'editing-basics) | 441 :group 'editing-basics) |
442 | 442 |
443 (defcustom backward-delete-function 'backward-delete-char | 443 (defcustom backward-delete-function 'delete-backward-char |
444 "*Function called to delete backwards on a delete keypress. | 444 "*Function called to delete backwards on a delete keypress. |
445 If `delete-key-deletes-forward' is nil, `backward-or-forward-delete-char' | 445 If `delete-key-deletes-forward' is nil, `backward-or-forward-delete-char' |
446 calls this function to erase one character backwards. Default value | 446 calls this function to erase one character backwards. Default value |
447 is 'backward-delete-char, with 'backward-delete-char-untabify being a | 447 is `delete-backward-char', with `backward-delete-char-untabify' being a |
448 popular alternate setting." | 448 popular alternate setting." |
449 :type 'function | 449 :type 'function |
450 :group 'editing-basics) | 450 :group 'editing-basics) |
451 | 451 |
452 ;; Trash me, baby. | 452 ;; Trash me, baby. |
2344 "Interchange characters around point, moving forward one character. | 2344 "Interchange characters around point, moving forward one character. |
2345 With prefix arg ARG, effect is to take character before point | 2345 With prefix arg ARG, effect is to take character before point |
2346 and drag it forward past ARG other characters (backward if ARG negative). | 2346 and drag it forward past ARG other characters (backward if ARG negative). |
2347 If no argument and at end of line, the previous two chars are exchanged." | 2347 If no argument and at end of line, the previous two chars are exchanged." |
2348 (interactive "*P") | 2348 (interactive "*P") |
2349 (and (null arg) (eolp) (forward-char -1)) | 2349 (and (null arg) (eolp) (backward-char 1)) |
2350 (transpose-subr 'forward-char (prefix-numeric-value arg))) | 2350 (transpose-subr 'forward-char (prefix-numeric-value arg))) |
2351 | 2351 |
2352 ;;; A very old implementation of transpose-chars from the old days ... | 2352 ;;; A very old implementation of transpose-chars from the old days ... |
2353 (defun transpose-preceding-chars (arg) | 2353 (defun transpose-preceding-chars (arg) |
2354 "Interchange characters before point. | 2354 "Interchange characters before point. |
2355 With prefix arg ARG, effect is to take character before point | 2355 With prefix arg ARG, effect is to take character before point |
2356 and drag it forward past ARG other characters (backward if ARG negative). | 2356 and drag it forward past ARG other characters (backward if ARG negative). |
2357 If no argument and not at start of line, the previous two chars are exchanged." | 2357 If no argument and not at start of line, the previous two chars are exchanged." |
2358 (interactive "*P") | 2358 (interactive "*P") |
2359 (and (null arg) (not (bolp)) (forward-char -1)) | 2359 (and (null arg) (not (bolp)) (backward-char 1)) |
2360 (transpose-subr 'forward-char (prefix-numeric-value arg))) | 2360 (transpose-subr 'forward-char (prefix-numeric-value arg))) |
2361 | 2361 |
2362 | 2362 |
2363 (defun transpose-words (arg) | 2363 (defun transpose-words (arg) |
2364 "Interchange words around point, leaving point at end of them. | 2364 "Interchange words around point, leaving point at end of them. |
2729 (insert prefix) | 2729 (insert prefix) |
2730 (end-of-line 1) | 2730 (end-of-line 1) |
2731 (forward-char 1))))) | 2731 (forward-char 1))))) |
2732 | 2732 |
2733 | 2733 |
2734 ;; XEmacs - extra parameter | 2734 (defun backward-word (&optional count buffer) |
2735 (defun backward-word (arg &optional buffer) | 2735 "Move point backward COUNT words (forward if COUNT is negative). |
2736 "Move backward until encountering the end of a word. | 2736 Normally t is returned, but if an edge of the buffer is reached, |
2737 With argument, do this that many times. | 2737 point is left there and nil is returned. |
2738 In programs, it is faster to call `forward-word' with negative arg." | 2738 |
2739 (interactive "_p") ; XEmacs | 2739 COUNT defaults to 1, and BUFFER defaults to the current buffer." |
2740 (forward-word (- arg) buffer)) | 2740 (interactive "_p") |
2741 | 2741 (forward-word (- (or count 1)) buffer)) |
2742 (defun mark-word (arg) | 2742 |
2743 "Set mark arg words away from point." | 2743 (defun mark-word (&optional count) |
2744 "Mark the text from point until encountering the end of a word. | |
2745 With optional argument COUNT, mark COUNT words." | |
2744 (interactive "p") | 2746 (interactive "p") |
2745 (mark-something 'mark-word 'forward-word arg)) | 2747 (mark-something 'mark-word 'forward-word count)) |
2746 | 2748 |
2747 ;; XEmacs modified | 2749 (defun kill-word (&optional count) |
2748 (defun kill-word (arg) | |
2749 "Kill characters forward until encountering the end of a word. | 2750 "Kill characters forward until encountering the end of a word. |
2751 With optional argument COUNT, do this that many times." | |
2752 (interactive "*p") | |
2753 (kill-region (point) (save-excursion (forward-word count) (point)))) | |
2754 | |
2755 (defun backward-kill-word (&optional count) | |
2756 "Kill characters backward until encountering the end of a word. | |
2750 With argument, do this that many times." | 2757 With argument, do this that many times." |
2751 (interactive "*p") | 2758 (interactive "*p") |
2752 (kill-region (point) (save-excursion (forward-word arg) (point)))) | 2759 (kill-word (- (or count 1)))) |
2753 | |
2754 (defun backward-kill-word (arg) | |
2755 "Kill characters backward until encountering the end of a word. | |
2756 With argument, do this that many times." | |
2757 (interactive "*p") ; XEmacs | |
2758 (kill-word (- arg))) | |
2759 | 2760 |
2760 (defun current-word (&optional strict) | 2761 (defun current-word (&optional strict) |
2761 "Return the word point is on (or a nearby word) as a string. | 2762 "Return the word point is on (or a nearby word) as a string. |
2762 If optional arg STRICT is non-nil, return nil unless point is within | 2763 If optional arg STRICT is non-nil, return nil unless point is within |
2763 or adjacent to a word. | 2764 or adjacent to a word. |
2850 ;; the line there and make it look like a | 2851 ;; the line there and make it look like a |
2851 ;; sentence end. | 2852 ;; sentence end. |
2852 (and (not (bobp)) | 2853 (and (not (bobp)) |
2853 (not bounce) | 2854 (not bounce) |
2854 sentence-end-double-space | 2855 sentence-end-double-space |
2855 (save-excursion (forward-char -1) | 2856 (save-excursion (backward-char 1) |
2856 (and (looking-at "\\. ") | 2857 (and (looking-at "\\. ") |
2857 (not (looking-at "\\. ")))))) | 2858 (not (looking-at "\\. ")))))) |
2858 (setq first nil) | 2859 (setq first nil) |
2859 ;; 97/3/14 jhod: Kinsoku | 2860 ;; 97/3/14 jhod: Kinsoku |
2860 ; (skip-chars-backward "^ \t\n")) | 2861 ; (skip-chars-backward "^ \t\n")) |
2975 ; ;; the line there and make it look like a | 2976 ; ;; the line there and make it look like a |
2976 ; ;; sentence end. | 2977 ; ;; sentence end. |
2977 ; (and (not (bobp)) | 2978 ; (and (not (bobp)) |
2978 ; (not bounce) | 2979 ; (not bounce) |
2979 ; sentence-end-double-space | 2980 ; sentence-end-double-space |
2980 ; (save-excursion (forward-char -1) | 2981 ; (save-excursion (backward-char 1) |
2981 ; (and (looking-at "\\. ") | 2982 ; (and (looking-at "\\. ") |
2982 ; (not (looking-at "\\. ")))))) | 2983 ; (not (looking-at "\\. ")))))) |
2983 ; (setq first nil) | 2984 ; (setq first nil) |
2984 ; (skip-chars-backward "^ \t\n") | 2985 ; (skip-chars-backward "^ \t\n") |
2985 ; ;; If we find nowhere on the line to break it, | 2986 ; ;; If we find nowhere on the line to break it, |
3141 (block-comment-start comstart) | 3142 (block-comment-start comstart) |
3142 (comment-end comment-end)) | 3143 (comment-end comment-end)) |
3143 (and comment-end (not (equal comment-end "")) | 3144 (and comment-end (not (equal comment-end "")) |
3144 ; (if (not comment-multi-line) | 3145 ; (if (not comment-multi-line) |
3145 (progn | 3146 (progn |
3146 (forward-char -1) | 3147 (backward-char 1) |
3147 (insert comment-end) | 3148 (insert comment-end) |
3148 (forward-char 1)) | 3149 (forward-char 1)) |
3149 ; (setq comment-column (+ comment-column (length comment-start)) | 3150 ; (setq comment-column (+ comment-column (length comment-start)) |
3150 ; comment-start "") | 3151 ; comment-start "") |
3151 ; ) | 3152 ; ) |
3152 ) | 3153 ) |
3153 (if (not (eolp)) | 3154 (if (not (eolp)) |
3154 (setq comment-end "")) | 3155 (setq comment-end "")) |
3155 (insert ?\n) | 3156 (insert ?\n) |
3156 (forward-char -1) | 3157 (backward-char 1) |
3157 (indent-for-comment) | 3158 (indent-for-comment) |
3158 (save-excursion | 3159 (save-excursion |
3159 ;; Make sure we delete the newline inserted above. | 3160 ;; Make sure we delete the newline inserted above. |
3160 (end-of-line) | 3161 (end-of-line) |
3161 (delete-char 1))) | 3162 (delete-char 1))) |
3316 (and (> (point) (1+ (point-min))) | 3317 (and (> (point) (1+ (point-min))) |
3317 blink-matching-paren | 3318 blink-matching-paren |
3318 ;; Verify an even number of quoting characters precede the close. | 3319 ;; Verify an even number of quoting characters precede the close. |
3319 (= 1 (logand 1 (- (point) | 3320 (= 1 (logand 1 (- (point) |
3320 (save-excursion | 3321 (save-excursion |
3321 (forward-char -1) | 3322 (backward-char 1) |
3322 (skip-syntax-backward "/\\") | 3323 (skip-syntax-backward "/\\") |
3323 (point))))) | 3324 (point))))) |
3324 (let* ((oldpos (point)) | 3325 (let* ((oldpos (point)) |
3325 (blinkpos) | 3326 (blinkpos) |
3326 (mismatch)) | 3327 (mismatch)) |