Mercurial > hg > xemacs-beta
comparison lisp/simple.el @ 223:2c611d1463a6 r20-4b10
Import from CVS: tag r20-4b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:10:54 +0200 |
parents | 262b8bb4a523 |
children | 85a06df23a9a |
comparison
equal
deleted
inserted
replaced
222:aae4c8b01452 | 223:2c611d1463a6 |
---|---|
1867 (if arg | 1867 (if arg |
1868 (progn | 1868 (progn |
1869 (setq goal-column nil) | 1869 (setq goal-column nil) |
1870 (display-message 'command "No goal column")) | 1870 (display-message 'command "No goal column")) |
1871 (setq goal-column (current-column)) | 1871 (setq goal-column (current-column)) |
1872 (message (substitute-command-keys | 1872 (lmessage 'command |
1873 "Goal column %d (use \\[set-goal-column] with an arg to unset it)") | 1873 "Goal column %d (use %s with an arg to unset it)" |
1874 goal-column)) | 1874 goal-column |
1875 (substitute-command-keys "\\[set-goal-column]"))) | |
1875 nil) | 1876 nil) |
1876 | 1877 |
1877 ;; deleted FSFmacs terminal randomness hscroll-point-visible stuff. | 1878 ;; deleted FSFmacs terminal randomness hscroll-point-visible stuff. |
1878 ;; hscroll-step | 1879 ;; hscroll-step |
1879 ;; hscroll-point-visible | 1880 ;; hscroll-point-visible |
2488 ;; No place to break => stop trying. | 2489 ;; No place to break => stop trying. |
2489 (setq give-up t))))))) | 2490 (setq give-up t))))))) |
2490 | 2491 |
2491 ;; Put FSF one in until I can one or the other working properly, then the | 2492 ;; Put FSF one in until I can one or the other working properly, then the |
2492 ;; other one is history. | 2493 ;; other one is history. |
2493 (defun fsf:do-auto-fill () | 2494 ;(defun fsf:do-auto-fill () |
2494 (let (fc justify | 2495 ; (let (fc justify |
2495 ;; bol | 2496 ; ;; bol |
2496 give-up | 2497 ; give-up |
2497 (fill-prefix fill-prefix)) | 2498 ; (fill-prefix fill-prefix)) |
2498 (if (or (not (setq justify (current-justification))) | 2499 ; (if (or (not (setq justify (current-justification))) |
2499 (null (setq fc (current-fill-column))) | 2500 ; (null (setq fc (current-fill-column))) |
2500 (and (eq justify 'left) | 2501 ; (and (eq justify 'left) |
2501 (<= (current-column) fc)) | 2502 ; (<= (current-column) fc)) |
2502 (save-excursion (beginning-of-line) | 2503 ; (save-excursion (beginning-of-line) |
2503 ;; (setq bol (point)) | 2504 ; ;; (setq bol (point)) |
2504 (and auto-fill-inhibit-regexp | 2505 ; (and auto-fill-inhibit-regexp |
2505 (looking-at auto-fill-inhibit-regexp)))) | 2506 ; (looking-at auto-fill-inhibit-regexp)))) |
2506 nil ;; Auto-filling not required | 2507 ; nil ;; Auto-filling not required |
2507 (if (memq justify '(full center right)) | 2508 ; (if (memq justify '(full center right)) |
2508 (save-excursion (unjustify-current-line))) | 2509 ; (save-excursion (unjustify-current-line))) |
2509 | 2510 |
2510 ;; Choose a fill-prefix automatically. | 2511 ; ;; Choose a fill-prefix automatically. |
2511 (if (and adaptive-fill-mode | 2512 ; (if (and adaptive-fill-mode |
2512 (or (null fill-prefix) (string= fill-prefix ""))) | 2513 ; (or (null fill-prefix) (string= fill-prefix ""))) |
2513 (let ((prefix | 2514 ; (let ((prefix |
2514 (fill-context-prefix | 2515 ; (fill-context-prefix |
2515 (save-excursion (backward-paragraph 1) (point)) | 2516 ; (save-excursion (backward-paragraph 1) (point)) |
2516 (save-excursion (forward-paragraph 1) (point)) | 2517 ; (save-excursion (forward-paragraph 1) (point)) |
2517 ;; Don't accept a non-whitespace fill prefix | 2518 ; ;; Don't accept a non-whitespace fill prefix |
2518 ;; from the first line of a paragraph. | 2519 ; ;; from the first line of a paragraph. |
2519 "^[ \t]*$"))) | 2520 ; "^[ \t]*$"))) |
2520 (and prefix (not (equal prefix "")) | 2521 ; (and prefix (not (equal prefix "")) |
2521 (setq fill-prefix prefix)))) | 2522 ; (setq fill-prefix prefix)))) |
2522 | 2523 |
2523 (while (and (not give-up) (> (current-column) fc)) | 2524 ; (while (and (not give-up) (> (current-column) fc)) |
2524 ;; Determine where to split the line. | 2525 ; ;; Determine where to split the line. |
2525 (let ((fill-point | 2526 ; (let ((fill-point |
2526 (let ((opoint (point)) | 2527 ; (let ((opoint (point)) |
2527 bounce | 2528 ; bounce |
2528 (first t)) | 2529 ; (first t)) |
2529 (save-excursion | 2530 ; (save-excursion |
2530 (move-to-column (1+ fc)) | 2531 ; (move-to-column (1+ fc)) |
2531 ;; Move back to a word boundary. | 2532 ; ;; Move back to a word boundary. |
2532 (while (or first | 2533 ; (while (or first |
2533 ;; If this is after period and a single space, | 2534 ; ;; If this is after period and a single space, |
2534 ;; move back once more--we don't want to break | 2535 ; ;; move back once more--we don't want to break |
2535 ;; the line there and make it look like a | 2536 ; ;; the line there and make it look like a |
2536 ;; sentence end. | 2537 ; ;; sentence end. |
2537 (and (not (bobp)) | 2538 ; (and (not (bobp)) |
2538 (not bounce) | 2539 ; (not bounce) |
2539 sentence-end-double-space | 2540 ; sentence-end-double-space |
2540 (save-excursion (forward-char -1) | 2541 ; (save-excursion (forward-char -1) |
2541 (and (looking-at "\\. ") | 2542 ; (and (looking-at "\\. ") |
2542 (not (looking-at "\\. ")))))) | 2543 ; (not (looking-at "\\. ")))))) |
2543 (setq first nil) | 2544 ; (setq first nil) |
2544 (skip-chars-backward "^ \t\n") | 2545 ; (skip-chars-backward "^ \t\n") |
2545 ;; If we find nowhere on the line to break it, | 2546 ; ;; If we find nowhere on the line to break it, |
2546 ;; break after one word. Set bounce to t | 2547 ; ;; break after one word. Set bounce to t |
2547 ;; so we will not keep going in this while loop. | 2548 ; ;; so we will not keep going in this while loop. |
2548 (if (bolp) | 2549 ; (if (bolp) |
2549 (progn | 2550 ; (progn |
2550 (re-search-forward "[ \t]" opoint t) | 2551 ; (re-search-forward "[ \t]" opoint t) |
2551 (setq bounce t))) | 2552 ; (setq bounce t))) |
2552 (skip-chars-backward " \t")) | 2553 ; (skip-chars-backward " \t")) |
2553 ;; Let fill-point be set to the place where we end up. | 2554 ; ;; Let fill-point be set to the place where we end up. |
2554 (point))))) | 2555 ; (point))))) |
2555 ;; If that place is not the beginning of the line, | 2556 ; ;; If that place is not the beginning of the line, |
2556 ;; break the line there. | 2557 ; ;; break the line there. |
2557 (if (save-excursion | 2558 ; (if (save-excursion |
2558 (goto-char fill-point) | 2559 ; (goto-char fill-point) |
2559 (not (bolp))) | 2560 ; (not (bolp))) |
2560 (let ((prev-column (current-column))) | 2561 ; (let ((prev-column (current-column))) |
2561 ;; If point is at the fill-point, do not `save-excursion'. | 2562 ; ;; If point is at the fill-point, do not `save-excursion'. |
2562 ;; Otherwise, if a comment prefix or fill-prefix is inserted, | 2563 ; ;; Otherwise, if a comment prefix or fill-prefix is inserted, |
2563 ;; point will end up before it rather than after it. | 2564 ; ;; point will end up before it rather than after it. |
2564 (if (save-excursion | 2565 ; (if (save-excursion |
2565 (skip-chars-backward " \t") | 2566 ; (skip-chars-backward " \t") |
2566 (= (point) fill-point)) | 2567 ; (= (point) fill-point)) |
2567 (funcall comment-line-break-function t) | 2568 ; (funcall comment-line-break-function t) |
2568 (save-excursion | 2569 ; (save-excursion |
2569 (goto-char fill-point) | 2570 ; (goto-char fill-point) |
2570 (funcall comment-line-break-function t))) | 2571 ; (funcall comment-line-break-function t))) |
2571 ;; Now do justification, if required | 2572 ; ;; Now do justification, if required |
2572 (if (not (eq justify 'left)) | 2573 ; (if (not (eq justify 'left)) |
2573 (save-excursion | 2574 ; (save-excursion |
2574 (end-of-line 0) | 2575 ; (end-of-line 0) |
2575 (justify-current-line justify nil t))) | 2576 ; (justify-current-line justify nil t))) |
2576 ;; If making the new line didn't reduce the hpos of | 2577 ; ;; If making the new line didn't reduce the hpos of |
2577 ;; the end of the line, then give up now; | 2578 ; ;; the end of the line, then give up now; |
2578 ;; trying again will not help. | 2579 ; ;; trying again will not help. |
2579 (if (>= (current-column) prev-column) | 2580 ; (if (>= (current-column) prev-column) |
2580 (setq give-up t))) | 2581 ; (setq give-up t))) |
2581 ;; No place to break => stop trying. | 2582 ; ;; No place to break => stop trying. |
2582 (setq give-up t)))) | 2583 ; (setq give-up t)))) |
2583 ;; Justify last line. | 2584 ; ;; Justify last line. |
2584 (justify-current-line justify t t) | 2585 ; (justify-current-line justify t t) |
2585 t))) | 2586 ; t))) |
2586 | 2587 |
2587 (defvar normal-auto-fill-function 'do-auto-fill | 2588 (defvar normal-auto-fill-function 'do-auto-fill |
2588 "The function to use for `auto-fill-function' if Auto Fill mode is turned on. | 2589 "The function to use for `auto-fill-function' if Auto Fill mode is turned on. |
2589 Some major modes set this.") | 2590 Some major modes set this.") |
2590 | 2591 |
3216 (interactive "p") | 3217 (interactive "p") |
3217 (if (region-active-p) | 3218 (if (region-active-p) |
3218 (downcase-region (region-beginning) (region-end)) | 3219 (downcase-region (region-beginning) (region-end)) |
3219 (downcase-word arg))) | 3220 (downcase-word arg))) |
3220 | 3221 |
3221 ;;; | 3222 ;; Most of the zmacs code is now in elisp. The only thing left in C |
3222 ;;; Most of the zmacs code is now in elisp. The only thing left in C | 3223 ;; are the variables zmacs-regions, zmacs-region-active-p and |
3223 ;;; are the variables zmacs-regions, zmacs-region-active-p and | 3224 ;; zmacs-region-stays plus the function zmacs_update_region which |
3224 ;;; zmacs-region-stays plus the function zmacs_update_region which | 3225 ;; simply calls the lisp level zmacs-update-region. It must remain |
3225 ;;; calls the lisp level zmacs-update-region. It must remain since it | 3226 ;; for convenience, since it is called by core C code. |
3226 ;;; must be called by core C code. | |
3227 ;;; | |
3228 ;;; Huh? Why couldn't "core C code" just use | |
3229 ;;; call0(Qzmacs_update_region)??? -hniksic | |
3230 | 3227 |
3231 (defvar zmacs-activate-region-hook nil | 3228 (defvar zmacs-activate-region-hook nil |
3232 "Function or functions called when the region becomes active; | 3229 "Function or functions called when the region becomes active; |
3233 see the variable `zmacs-regions'.") | 3230 see the variable `zmacs-regions'.") |
3234 | 3231 |
3636 by default--see the `log-message-ignore-labels' variable): | 3633 by default--see the `log-message-ignore-labels' variable): |
3637 message default label used by the `message' function | 3634 message default label used by the `message' function |
3638 error default label used for reporting errors | 3635 error default label used for reporting errors |
3639 * progress progress indicators like \"Converting... 45%\" | 3636 * progress progress indicators like \"Converting... 45%\" |
3640 * prompt prompt-like messages like \"I-search: foo\" | 3637 * prompt prompt-like messages like \"I-search: foo\" |
3638 * command helper command messages like \"Mark set\" | |
3641 * no-log messages that should never be logged" | 3639 * no-log messages that should never be logged" |
3642 (clear-message label frame stdout-p t) | 3640 (clear-message label frame stdout-p t) |
3643 (append-message label message frame stdout-p)) | 3641 (append-message label message frame stdout-p)) |
3644 | 3642 |
3645 (defun current-message (&optional frame) | 3643 (defun current-message (&optional frame) |