diff options
| author | Richard M. Stallman | 2005-06-23 21:26:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-06-23 21:26:31 +0000 |
| commit | d6281b4ece25236adc46e8d91ac4331dbb737dc2 (patch) | |
| tree | 71f301cd2f372a418d8e5b7d0101bff3b799af05 | |
| parent | 0a66defc195e4b8ad36cbe676d1d603f714c87b6 (diff) | |
| download | emacs-d6281b4ece25236adc46e8d91ac4331dbb737dc2.tar.gz emacs-d6281b4ece25236adc46e8d91ac4331dbb737dc2.zip | |
(set-variable): Args renamed; doc fix.
(line-move-1): When there are overlays around, use vertical-motion.
| -rw-r--r-- | lisp/simple.el | 81 |
1 files changed, 49 insertions, 32 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 3e00b075ea4..9f99f2d2b60 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3433,18 +3433,28 @@ Outline mode sets this." | |||
| 3433 | ;; Now move a line. | 3433 | ;; Now move a line. |
| 3434 | (end-of-line) | 3434 | (end-of-line) |
| 3435 | ;; If there's no invisibility here, move over the newline. | 3435 | ;; If there's no invisibility here, move over the newline. |
| 3436 | (if (and (not (integerp selective-display)) | 3436 | (let ((pos-before (point)) |
| 3437 | (not (line-move-invisible-p (point)))) | 3437 | line-done) |
| 3438 | (if (eobp) | ||
| 3439 | (if (not noerror) | ||
| 3440 | (signal 'end-of-buffer nil) | ||
| 3441 | (setq done t))) | ||
| 3442 | (when (and (not done) | ||
| 3443 | (not (integerp selective-display)) | ||
| 3444 | (not (line-move-invisible-p (point)))) | ||
| 3438 | ;; We avoid vertical-motion when possible | 3445 | ;; We avoid vertical-motion when possible |
| 3439 | ;; because that has to fontify. | 3446 | ;; because that has to fontify. |
| 3440 | (if (eobp) | 3447 | (forward-line 1) |
| 3441 | (if (not noerror) | 3448 | ;; If there are overlays in and around |
| 3442 | (signal 'end-of-buffer nil) | 3449 | ;; the text we moved over, we need to be |
| 3443 | (setq done t)) | 3450 | ;; sophisticated. |
| 3444 | (forward-line 1)) | 3451 | (unless (overlays-in (max (1- pos-before) (point-min)) |
| 3452 | (min (1+ (point)) (point-max))) | ||
| 3453 | (setq line-done t))) | ||
| 3445 | ;; Otherwise move a more sophisticated way. | 3454 | ;; Otherwise move a more sophisticated way. |
| 3446 | ;; (What's the logic behind this code?) | 3455 | ;; (What's the logic behind this code?) |
| 3447 | (and (zerop (vertical-motion 1)) | 3456 | (and (not done) (not line-done) |
| 3457 | (zerop (vertical-motion 1)) | ||
| 3448 | (if (not noerror) | 3458 | (if (not noerror) |
| 3449 | (signal 'end-of-buffer nil) | 3459 | (signal 'end-of-buffer nil) |
| 3450 | (setq done t)))) | 3460 | (setq done t)))) |
| @@ -3454,18 +3464,24 @@ Outline mode sets this." | |||
| 3454 | ;; it just goes in the other direction. | 3464 | ;; it just goes in the other direction. |
| 3455 | (while (and (< arg 0) (not done)) | 3465 | (while (and (< arg 0) (not done)) |
| 3456 | (beginning-of-line) | 3466 | (beginning-of-line) |
| 3457 | (if (or (bobp) | 3467 | (let ((pos-before (point)) |
| 3458 | (and (not (integerp selective-display)) | 3468 | line-done) |
| 3459 | (not (line-move-invisible-p (1- (point)))))) | 3469 | (if (bobp) |
| 3460 | (if (bobp) | ||
| 3461 | (if (not noerror) | ||
| 3462 | (signal 'beginning-of-buffer nil) | ||
| 3463 | (setq done t)) | ||
| 3464 | (forward-line -1)) | ||
| 3465 | (if (zerop (vertical-motion -1)) | ||
| 3466 | (if (not noerror) | 3470 | (if (not noerror) |
| 3467 | (signal 'beginning-of-buffer nil) | 3471 | (signal 'beginning-of-buffer nil) |
| 3468 | (setq done t)))) | 3472 | (setq done t))) |
| 3473 | (when (and (not done) | ||
| 3474 | (not (integerp selective-display)) | ||
| 3475 | (not (line-move-invisible-p (1- (point))))) | ||
| 3476 | (forward-line -1) | ||
| 3477 | (unless (overlays-in (max (1- (point)) (point-min)) | ||
| 3478 | (min (1+ pos-before) (point-max))) | ||
| 3479 | (setq line-done t))) | ||
| 3480 | (and (not done) (not line-done) | ||
| 3481 | (zerop (vertical-motion -1)) | ||
| 3482 | (if (not noerror) | ||
| 3483 | (signal 'beginning-of-buffer nil) | ||
| 3484 | (setq done t)))) | ||
| 3469 | (unless done | 3485 | (unless done |
| 3470 | (setq arg (1+ arg)) | 3486 | (setq arg (1+ arg)) |
| 3471 | (while (and ;; Don't move over previous invis lines | 3487 | (while (and ;; Don't move over previous invis lines |
| @@ -4504,10 +4520,11 @@ Each action has the form (FUNCTION . ARGS)." | |||
| 4504 | (defvar set-variable-value-history nil | 4520 | (defvar set-variable-value-history nil |
| 4505 | "History of values entered with `set-variable'.") | 4521 | "History of values entered with `set-variable'.") |
| 4506 | 4522 | ||
| 4507 | (defun set-variable (var val &optional make-local) | 4523 | (defun set-variable (variable value &optional make-local) |
| 4508 | "Set VARIABLE to VALUE. VALUE is a Lisp object. | 4524 | "Set VARIABLE to VALUE. VALUE is a Lisp object. |
| 4509 | When using this interactively, enter a Lisp object for VALUE. | 4525 | VARIABLE should be a user option variable name, a Lisp variable |
| 4510 | If you want VALUE to be a string, you must surround it with doublequotes. | 4526 | meant to be customized by users. You should enter VALUE in Lisp syntax, |
| 4527 | so if you want VALUE to be a string, you must surround it with doublequotes. | ||
| 4511 | VALUE is used literally, not evaluated. | 4528 | VALUE is used literally, not evaluated. |
| 4512 | 4529 | ||
| 4513 | If VARIABLE has a `variable-interactive' property, that is used as if | 4530 | If VARIABLE has a `variable-interactive' property, that is used as if |
| @@ -4520,9 +4537,9 @@ With a prefix argument, set VARIABLE to VALUE buffer-locally." | |||
| 4520 | (interactive | 4537 | (interactive |
| 4521 | (let* ((default-var (variable-at-point)) | 4538 | (let* ((default-var (variable-at-point)) |
| 4522 | (var (if (symbolp default-var) | 4539 | (var (if (symbolp default-var) |
| 4523 | (read-variable (format "Set variable (default %s): " default-var) | 4540 | (read-variable (format "Set variable (default %s): " default-var) |
| 4524 | default-var) | 4541 | default-var) |
| 4525 | (read-variable "Set variable: "))) | 4542 | (read-variable "Set variable: "))) |
| 4526 | (minibuffer-help-form '(describe-variable var)) | 4543 | (minibuffer-help-form '(describe-variable var)) |
| 4527 | (prop (get var 'variable-interactive)) | 4544 | (prop (get var 'variable-interactive)) |
| 4528 | (prompt (format "Set %s%s to value: " var | 4545 | (prompt (format "Set %s%s to value: " var |
| @@ -4543,22 +4560,22 @@ With a prefix argument, set VARIABLE to VALUE buffer-locally." | |||
| 4543 | 'set-variable-value-history))))) | 4560 | 'set-variable-value-history))))) |
| 4544 | (list var val current-prefix-arg))) | 4561 | (list var val current-prefix-arg))) |
| 4545 | 4562 | ||
| 4546 | (and (custom-variable-p var) | 4563 | (and (custom-variable-p variable) |
| 4547 | (not (get var 'custom-type)) | 4564 | (not (get variable 'custom-type)) |
| 4548 | (custom-load-symbol var)) | 4565 | (custom-load-symbol variable)) |
| 4549 | (let ((type (get var 'custom-type))) | 4566 | (let ((type (get variable 'custom-type))) |
| 4550 | (when type | 4567 | (when type |
| 4551 | ;; Match with custom type. | 4568 | ;; Match with custom type. |
| 4552 | (require 'cus-edit) | 4569 | (require 'cus-edit) |
| 4553 | (setq type (widget-convert type)) | 4570 | (setq type (widget-convert type)) |
| 4554 | (unless (widget-apply type :match val) | 4571 | (unless (widget-apply type :match value) |
| 4555 | (error "Value `%S' does not match type %S of %S" | 4572 | (error "Value `%S' does not match type %S of %S" |
| 4556 | val (car type) var)))) | 4573 | value (car type) variable)))) |
| 4557 | 4574 | ||
| 4558 | (if make-local | 4575 | (if make-local |
| 4559 | (make-local-variable var)) | 4576 | (make-local-variable variable)) |
| 4560 | 4577 | ||
| 4561 | (set var val) | 4578 | (set variable value) |
| 4562 | 4579 | ||
| 4563 | ;; Force a thorough redisplay for the case that the variable | 4580 | ;; Force a thorough redisplay for the case that the variable |
| 4564 | ;; has an effect on the display, like `tab-width' has. | 4581 | ;; has an effect on the display, like `tab-width' has. |