Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 727:540b047ece4d
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 24 Jun 1992 05:09:26 +0000 |
parents | 7a9b4ea68565 |
children | 4f28bd14272c |
comparison
equal
deleted
inserted
replaced
726:5f08efa38dd0 | 727:540b047ece4d |
---|---|
488 (defun indent-sexp (&optional endpos) | 488 (defun indent-sexp (&optional endpos) |
489 "Indent each line of the list starting just after point. | 489 "Indent each line of the list starting just after point. |
490 If optional arg ENDPOS is given, indent each line, stopping when | 490 If optional arg ENDPOS is given, indent each line, stopping when |
491 ENDPOS is encountered." | 491 ENDPOS is encountered." |
492 (interactive) | 492 (interactive) |
493 (let ((indent-stack (list nil)) (next-depth 0) last-depth bol | 493 (let ((indent-stack (list nil)) |
494 outer-loop-done inner-loop-done state this-indent | 494 (next-depth 0) |
495 (last-point (point))) | 495 (starting-point (point)) |
496 (last-point (point)) | |
497 last-depth bol outer-loop-done inner-loop-done state this-indent) | |
496 ;; Get error now if we don't have a complete sexp after point. | 498 ;; Get error now if we don't have a complete sexp after point. |
497 (save-excursion (forward-sexp 1)) | 499 (save-excursion (forward-sexp 1)) |
498 (save-excursion | 500 (save-excursion |
499 (setq outer-loop-done nil) | 501 (setq outer-loop-done nil) |
500 (while (if endpos (< (point) endpos) | 502 (while (if endpos (< (point) endpos) |
527 (progn | 529 (progn |
528 (forward-line 1) | 530 (forward-line 1) |
529 (setcar (nthcdr 5 state) nil)) | 531 (setcar (nthcdr 5 state) nil)) |
530 (setq inner-loop-done t))) | 532 (setq inner-loop-done t))) |
531 (and endpos | 533 (and endpos |
532 (while (<= next-depth 0) | 534 (<= next-depth 0) |
533 (setq indent-stack (append indent-stack (list nil))) | 535 (progn |
534 (setq next-depth (1+ next-depth)) | 536 (setq indent-stack (append indent-stack |
535 (setq last-depth (1+ last-depth)))) | 537 (make-list (- next-depth) nil)) |
538 last-depth (- last-depth next-depth) | |
539 next-depth 0))) | |
536 (or outer-loop-done | 540 (or outer-loop-done |
537 (setq outer-loop-done (<= next-depth 0))) | 541 (setq outer-loop-done (<= next-depth 0))) |
538 (if outer-loop-done | 542 (if outer-loop-done |
539 nil | 543 nil |
540 (while (> last-depth next-depth) | 544 (while (> last-depth next-depth) |
555 (if (and (car indent-stack) | 559 (if (and (car indent-stack) |
556 (>= (car indent-stack) 0)) | 560 (>= (car indent-stack) 0)) |
557 (setq this-indent (car indent-stack)) | 561 (setq this-indent (car indent-stack)) |
558 (let ((val (calculate-lisp-indent | 562 (let ((val (calculate-lisp-indent |
559 (if (car indent-stack) (- (car indent-stack)) | 563 (if (car indent-stack) (- (car indent-stack)) |
560 last-point)))) | 564 starting-point)))) |
561 (if (integerp val) | 565 (if (integerp val) |
562 (setcar indent-stack | 566 (setcar indent-stack |
563 (setq this-indent val)) | 567 (setq this-indent val)) |
564 (setcar indent-stack (- (car (cdr val)))) | 568 (setcar indent-stack (- (car (cdr val)))) |
565 (setq this-indent (car val))))) | 569 (setq this-indent (car val))))) |