Mercurial > emacs
comparison lisp/simple.el @ 83652:5b644ae74c91
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 846-851)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 88-92)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 242-244)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-31
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 13 Aug 2007 13:51:08 +0000 |
parents | 65663fcd2caa e5a68f18fcb9 |
children | 2a69b973fae2 |
comparison
equal
deleted
inserted
replaced
83651:47230f3f349b | 83652:5b644ae74c91 |
---|---|
4319 "*Regexp to match lines which should not be auto-filled." | 4319 "*Regexp to match lines which should not be auto-filled." |
4320 :type '(choice (const :tag "None" nil) | 4320 :type '(choice (const :tag "None" nil) |
4321 regexp) | 4321 regexp) |
4322 :group 'fill) | 4322 :group 'fill) |
4323 | 4323 |
4324 (defvar comment-line-break-function 'comment-indent-new-line | |
4325 "*Mode-specific function which line breaks and continues a comment. | |
4326 | |
4327 This function is only called during auto-filling of a comment section. | |
4328 The function should take a single optional argument, which is a flag | |
4329 indicating whether it should use soft newlines.") | |
4330 | |
4331 ;; This function is used as the auto-fill-function of a buffer | 4324 ;; This function is used as the auto-fill-function of a buffer |
4332 ;; when Auto-Fill mode is enabled. | 4325 ;; when Auto-Fill mode is enabled. |
4333 ;; It returns t if it really did any work. | 4326 ;; It returns t if it really did any work. |
4334 ;; (Actually some major modes use a different auto-fill function, | 4327 ;; (Actually some major modes use a different auto-fill function, |
4335 ;; but this one is the default one.) | 4328 ;; but this one is the default one.) |
4399 ;; Otherwise, if a comment prefix or fill-prefix is inserted, | 4392 ;; Otherwise, if a comment prefix or fill-prefix is inserted, |
4400 ;; point will end up before it rather than after it. | 4393 ;; point will end up before it rather than after it. |
4401 (if (save-excursion | 4394 (if (save-excursion |
4402 (skip-chars-backward " \t") | 4395 (skip-chars-backward " \t") |
4403 (= (point) fill-point)) | 4396 (= (point) fill-point)) |
4404 (funcall comment-line-break-function t) | 4397 (default-indent-new-line t) |
4405 (save-excursion | 4398 (save-excursion |
4406 (goto-char fill-point) | 4399 (goto-char fill-point) |
4407 (funcall comment-line-break-function t))) | 4400 (default-indent-new-line t))) |
4408 ;; Now do justification, if required | 4401 ;; Now do justification, if required |
4409 (if (not (eq justify 'left)) | 4402 (if (not (eq justify 'left)) |
4410 (save-excursion | 4403 (save-excursion |
4411 (end-of-line 0) | 4404 (end-of-line 0) |
4412 (justify-current-line justify nil t))) | 4405 (justify-current-line justify nil t))) |
4416 (if (>= (current-column) prev-column) | 4409 (if (>= (current-column) prev-column) |
4417 (setq give-up t)))))) | 4410 (setq give-up t)))))) |
4418 ;; Justify last line. | 4411 ;; Justify last line. |
4419 (justify-current-line justify t t) | 4412 (justify-current-line justify t t) |
4420 t))) | 4413 t))) |
4414 | |
4415 (defvar comment-line-break-function 'comment-indent-new-line | |
4416 "*Mode-specific function which line breaks and continues a comment. | |
4417 This function is called during auto-filling when a comment syntax | |
4418 is defined. | |
4419 The function should take a single optional argument, which is a flag | |
4420 indicating whether it should use soft newlines.") | |
4421 | |
4422 (defun default-indent-new-line (&optional soft) | |
4423 "Break line at point and indent. | |
4424 If a comment syntax is defined, call `comment-indent-new-line'. | |
4425 | |
4426 The inserted newline is marked hard if variable `use-hard-newlines' is true, | |
4427 unless optional argument SOFT is non-nil." | |
4428 (interactive) | |
4429 (if comment-start | |
4430 (funcall comment-line-break-function soft) | |
4431 ;; Insert the newline before removing empty space so that markers | |
4432 ;; get preserved better. | |
4433 (if soft (insert-and-inherit ?\n) (newline 1)) | |
4434 (save-excursion (forward-char -1) (delete-horizontal-space)) | |
4435 (delete-horizontal-space) | |
4436 | |
4437 (if (and fill-prefix (not adaptive-fill-mode)) | |
4438 ;; Blindly trust a non-adaptive fill-prefix. | |
4439 (progn | |
4440 (indent-to-left-margin) | |
4441 (insert-before-markers-and-inherit fill-prefix)) | |
4442 | |
4443 (cond | |
4444 ;; If there's an adaptive prefix, use it unless we're inside | |
4445 ;; a comment and the prefix is not a comment starter. | |
4446 (fill-prefix | |
4447 (indent-to-left-margin) | |
4448 (insert-and-inherit fill-prefix)) | |
4449 ;; If we're not inside a comment, just try to indent. | |
4450 (t (indent-according-to-mode)))))) | |
4421 | 4451 |
4422 (defvar normal-auto-fill-function 'do-auto-fill | 4452 (defvar normal-auto-fill-function 'do-auto-fill |
4423 "The function to use for `auto-fill-function' if Auto Fill mode is turned on. | 4453 "The function to use for `auto-fill-function' if Auto Fill mode is turned on. |
4424 Some major modes set this.") | 4454 Some major modes set this.") |
4425 | 4455 |
4495 (defvaralias 'indicate-unused-lines 'indicate-empty-lines) | 4525 (defvaralias 'indicate-unused-lines 'indicate-empty-lines) |
4496 (defvaralias 'default-indicate-unused-lines 'default-indicate-empty-lines) | 4526 (defvaralias 'default-indicate-unused-lines 'default-indicate-empty-lines) |
4497 | 4527 |
4498 (defun toggle-truncate-lines (&optional arg) | 4528 (defun toggle-truncate-lines (&optional arg) |
4499 "Toggle whether to fold or truncate long lines for the current buffer. | 4529 "Toggle whether to fold or truncate long lines for the current buffer. |
4500 With arg, truncate long lines iff arg is positive. | 4530 With prefix argument ARG, truncate long lines if ARG is positive, |
4501 Note that in side-by-side windows, truncation is always enabled." | 4531 otherwise don't truncate them. Note that in side-by-side |
4532 windows, truncation is always enabled." | |
4502 (interactive "P") | 4533 (interactive "P") |
4503 (setq truncate-lines | 4534 (setq truncate-lines |
4504 (if (null arg) | 4535 (if (null arg) |
4505 (not truncate-lines) | 4536 (not truncate-lines) |
4506 (> (prefix-numeric-value arg) 0))) | 4537 (> (prefix-numeric-value arg) 0))) |
4519 (defvar overwrite-mode-binary " Bin Ovwrt" | 4550 (defvar overwrite-mode-binary " Bin Ovwrt" |
4520 "The string displayed in the mode line when in binary overwrite mode.") | 4551 "The string displayed in the mode line when in binary overwrite mode.") |
4521 | 4552 |
4522 (defun overwrite-mode (arg) | 4553 (defun overwrite-mode (arg) |
4523 "Toggle overwrite mode. | 4554 "Toggle overwrite mode. |
4524 With arg, turn overwrite mode on iff arg is positive. | 4555 With prefix argument ARG, turn overwrite mode on if ARG is positive, |
4525 In overwrite mode, printing characters typed in replace existing text | 4556 otherwise turn it off. In overwrite mode, printing characters typed |
4526 on a one-for-one basis, rather than pushing it to the right. At the | 4557 in replace existing text on a one-for-one basis, rather than pushing |
4527 end of a line, such characters extend the line. Before a tab, | 4558 it to the right. At the end of a line, such characters extend the line. |
4528 such characters insert until the tab is filled in. | 4559 Before a tab, such characters insert until the tab is filled in. |
4529 \\[quoted-insert] still inserts characters in overwrite mode; this | 4560 \\[quoted-insert] still inserts characters in overwrite mode; this |
4530 is supposed to make it easier to insert characters when necessary." | 4561 is supposed to make it easier to insert characters when necessary." |
4531 (interactive "P") | 4562 (interactive "P") |
4532 (setq overwrite-mode | 4563 (setq overwrite-mode |
4533 (if (if (null arg) (not overwrite-mode) | 4564 (if (if (null arg) (not overwrite-mode) |
4535 'overwrite-mode-textual)) | 4566 'overwrite-mode-textual)) |
4536 (force-mode-line-update)) | 4567 (force-mode-line-update)) |
4537 | 4568 |
4538 (defun binary-overwrite-mode (arg) | 4569 (defun binary-overwrite-mode (arg) |
4539 "Toggle binary overwrite mode. | 4570 "Toggle binary overwrite mode. |
4540 With arg, turn binary overwrite mode on iff arg is positive. | 4571 With prefix argument ARG, turn binary overwrite mode on if ARG is |
4541 In binary overwrite mode, printing characters typed in replace | 4572 positive, otherwise turn it off. In binary overwrite mode, printing |
4542 existing text. Newlines are not treated specially, so typing at the | 4573 characters typed in replace existing text. Newlines are not treated |
4543 end of a line joins the line to the next, with the typed character | 4574 specially, so typing at the end of a line joins the line to the next, |
4544 between them. Typing before a tab character simply replaces the tab | 4575 with the typed character between them. Typing before a tab character |
4545 with the character typed. | 4576 simply replaces the tab with the character typed. \\[quoted-insert] |
4546 \\[quoted-insert] replaces the text at the cursor, just as ordinary | 4577 replaces the text at the cursor, just as ordinary typing characters do. |
4547 typing characters do. | |
4548 | 4578 |
4549 Note that binary overwrite mode is not its own minor mode; it is a | 4579 Note that binary overwrite mode is not its own minor mode; it is a |
4550 specialization of overwrite mode, entered by setting the | 4580 specialization of overwrite mode, entered by setting the |
4551 `overwrite-mode' variable to `overwrite-mode-binary'." | 4581 `overwrite-mode' variable to `overwrite-mode-binary'." |
4552 (interactive "P") | 4582 (interactive "P") |
4557 'overwrite-mode-binary)) | 4587 'overwrite-mode-binary)) |
4558 (force-mode-line-update)) | 4588 (force-mode-line-update)) |
4559 | 4589 |
4560 (define-minor-mode line-number-mode | 4590 (define-minor-mode line-number-mode |
4561 "Toggle Line Number mode. | 4591 "Toggle Line Number mode. |
4562 With arg, turn Line Number mode on iff arg is positive. | 4592 With arg, turn Line Number mode on if arg is positive, otherwise |
4563 When Line Number mode is enabled, the line number appears | 4593 turn it off. When Line Number mode is enabled, the line number |
4564 in the mode line. | 4594 appears in the mode line. |
4565 | 4595 |
4566 Line numbers do not appear for very large buffers and buffers | 4596 Line numbers do not appear for very large buffers and buffers |
4567 with very long lines; see variables `line-number-display-limit' | 4597 with very long lines; see variables `line-number-display-limit' |
4568 and `line-number-display-limit-width'." | 4598 and `line-number-display-limit-width'." |
4569 :init-value t :global t :group 'mode-line) | 4599 :init-value t :global t :group 'mode-line) |
4570 | 4600 |
4571 (define-minor-mode column-number-mode | 4601 (define-minor-mode column-number-mode |
4572 "Toggle Column Number mode. | 4602 "Toggle Column Number mode. |
4573 With arg, turn Column Number mode on iff arg is positive. | 4603 With arg, turn Column Number mode on if arg is positive, |
4574 When Column Number mode is enabled, the column number appears | 4604 otherwise turn it off. When Column Number mode is enabled, the |
4575 in the mode line." | 4605 column number appears in the mode line." |
4576 :global t :group 'mode-line) | 4606 :global t :group 'mode-line) |
4577 | 4607 |
4578 (define-minor-mode size-indication-mode | 4608 (define-minor-mode size-indication-mode |
4579 "Toggle Size Indication mode. | 4609 "Toggle Size Indication mode. |
4580 With arg, turn Size Indication mode on iff arg is positive. When | 4610 With arg, turn Size Indication mode on if arg is positive, |
4581 Size Indication mode is enabled, the size of the accessible part | 4611 otherwise turn it off. When Size Indication mode is enabled, the |
4582 of the buffer appears in the mode line." | 4612 size of the accessible part of the buffer appears in the mode line." |
4583 :global t :group 'mode-line) | 4613 :global t :group 'mode-line) |
4584 | 4614 |
4585 (defgroup paren-blinking nil | 4615 (defgroup paren-blinking nil |
4586 "Blinking matching of parens and expressions." | 4616 "Blinking matching of parens and expressions." |
4587 :prefix "blink-matching-" | 4617 :prefix "blink-matching-" |
5112 (defvar choose-completion-string-functions nil | 5142 (defvar choose-completion-string-functions nil |
5113 "Functions that may override the normal insertion of a completion choice. | 5143 "Functions that may override the normal insertion of a completion choice. |
5114 These functions are called in order with four arguments: | 5144 These functions are called in order with four arguments: |
5115 CHOICE - the string to insert in the buffer, | 5145 CHOICE - the string to insert in the buffer, |
5116 BUFFER - the buffer in which the choice should be inserted, | 5146 BUFFER - the buffer in which the choice should be inserted, |
5117 MINI-P - non-nil iff BUFFER is a minibuffer, and | 5147 MINI-P - non-nil if BUFFER is a minibuffer, and |
5118 BASE-SIZE - the number of characters in BUFFER before | 5148 BASE-SIZE - the number of characters in BUFFER before |
5119 the string being completed. | 5149 the string being completed. |
5120 | 5150 |
5121 If a function in the list returns non-nil, that function is supposed | 5151 If a function in the list returns non-nil, that function is supposed |
5122 to have inserted the CHOICE in the BUFFER, and possibly exited | 5152 to have inserted the CHOICE in the BUFFER, and possibly exited |
5741 (defvar vis-mode-saved-buffer-invisibility-spec nil | 5771 (defvar vis-mode-saved-buffer-invisibility-spec nil |
5742 "Saved value of `buffer-invisibility-spec' when Visible mode is on.") | 5772 "Saved value of `buffer-invisibility-spec' when Visible mode is on.") |
5743 | 5773 |
5744 (define-minor-mode visible-mode | 5774 (define-minor-mode visible-mode |
5745 "Toggle Visible mode. | 5775 "Toggle Visible mode. |
5746 With argument ARG turn Visible mode on iff ARG is positive. | 5776 With argument ARG turn Visible mode on if ARG is positive, otherwise |
5777 turn it off. | |
5747 | 5778 |
5748 Enabling Visible mode makes all invisible text temporarily visible. | 5779 Enabling Visible mode makes all invisible text temporarily visible. |
5749 Disabling Visible mode turns off that effect. Visible mode | 5780 Disabling Visible mode turns off that effect. Visible mode |
5750 works by saving the value of `buffer-invisibility-spec' and setting it to nil." | 5781 works by saving the value of `buffer-invisibility-spec' and setting it to nil." |
5751 :lighter " Vis" | 5782 :lighter " Vis" |