diff options
| author | Jim Blandy | 1991-03-06 21:14:11 +0000 |
|---|---|---|
| committer | Jim Blandy | 1991-03-06 21:14:11 +0000 |
| commit | 073c95314fcf91f1e20ab16a006fffe22163f751 (patch) | |
| tree | a8d865f3e07cdd8bd3266e9d8798a6733f183ca1 | |
| parent | 4c8c7ae9dfd5c594e036e2ea3b4189afb40a5fad (diff) | |
| download | emacs-073c95314fcf91f1e20ab16a006fffe22163f751.tar.gz emacs-073c95314fcf91f1e20ab16a006fffe22163f751.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/progmodes/hideif.el | 138 | ||||
| -rw-r--r-- | lisp/progmodes/icon.el | 25 |
2 files changed, 64 insertions, 99 deletions
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 03e8c70d902..4a1b9897808 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el | |||
| @@ -120,14 +120,14 @@ | |||
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | (defvar hide-ifdef-mode-map nil | 122 | (defvar hide-ifdef-mode-map nil |
| 123 | "Keymap used with hide-ifdef mode") | 123 | "Keymap used with Hide-Ifdef mode") |
| 124 | 124 | ||
| 125 | (defconst hide-ifdef-mode-prefix-key "\C-c" | 125 | (defconst hide-ifdef-mode-prefix-key "\C-c" |
| 126 | "Prefix key for all hide-ifdef-mode commands.") | 126 | "Prefix key for all Hide-Ifdef mode commands.") |
| 127 | 127 | ||
| 128 | (defvar hide-ifdef-mode-map-before nil | 128 | (defvar hide-ifdef-mode-map-before nil |
| 129 | "Buffer-local variable to store a copy of the local keymap | 129 | "Buffer-local variable to store a copy of the local keymap |
| 130 | before hide-ifdef-mode modifies it.") | 130 | before `hide-ifdef-mode' modifies it.") |
| 131 | 131 | ||
| 132 | (defun define-hide-ifdef-mode-map () | 132 | (defun define-hide-ifdef-mode-map () |
| 133 | (if hide-ifdef-mode-map | 133 | (if hide-ifdef-mode-map |
| @@ -161,7 +161,6 @@ | |||
| 161 | "Update mode-line by setting buffer-modified to itself." | 161 | "Update mode-line by setting buffer-modified to itself." |
| 162 | (set-buffer-modified-p (buffer-modified-p))) | 162 | (set-buffer-modified-p (buffer-modified-p))) |
| 163 | 163 | ||
| 164 | |||
| 165 | (defvar hide-ifdef-mode nil | 164 | (defvar hide-ifdef-mode nil |
| 166 | "non-nil when hide-ifdef-mode is activated.") | 165 | "non-nil when hide-ifdef-mode is activated.") |
| 167 | 166 | ||
| @@ -178,35 +177,35 @@ | |||
| 178 | (cons '(hide-ifdef-mode " Ifdef") | 177 | (cons '(hide-ifdef-mode " Ifdef") |
| 179 | minor-mode-alist))) | 178 | minor-mode-alist))) |
| 180 | 179 | ||
| 181 | |||
| 182 | (defun hide-ifdef-mode (arg) | 180 | (defun hide-ifdef-mode (arg) |
| 183 | "Toggle hide-ifdef-mode. Thus this is a minor mode, albeit a large one. | 181 | "Toggle Hide-Ifdef mode. This is a minor mode, albeit a large one. |
| 184 | With arg, turn hide-ifdef-mode on iff arg is positive. | 182 | With ARG, turn Hide-Ifdef mode on iff arg is positive. |
| 185 | In hide-ifdef-mode, code within #ifdef constructs that the C preprocessor | 183 | In Hide-Ifdef mode, code within #ifdef constructs that the C preprocessor |
| 186 | would eliminate may be hidden from view. Several variables affect | 184 | would eliminate may be hidden from view. Several variables affect |
| 187 | how the hiding is done: | 185 | how the hiding is done: |
| 188 | 186 | ||
| 189 | hide-ifdef-env | 187 | hide-ifdef-env |
| 190 | An association list of defined and undefined symbols for the | 188 | An association list of defined and undefined symbols for the |
| 191 | current buffer. Initially, the global value of hide-ifdef-env is used. | 189 | current buffer. Initially, the global value of `hide-ifdef-env' |
| 190 | is used. | ||
| 192 | 191 | ||
| 193 | hide-ifdef-define-alist | 192 | hide-ifdef-define-alist |
| 194 | An association list of defined symbol lists. | 193 | An association list of defined symbol lists. |
| 195 | Use hide-ifdef-set-define-alist to save the current hide-ifdef-env | 194 | Use `hide-ifdef-set-define-alist' to save the current `hide-ifdef-env' |
| 196 | and hide-ifdef-use-define-alist to set the current hide-ifdef-env | 195 | and `hide-ifdef-use-define-alist' to set the current `hide-ifdef-env' |
| 197 | from one of the lists in hide-ifdef-define-alist. | 196 | from one of the lists in `hide-ifdef-define-alist'. |
| 198 | 197 | ||
| 199 | hide-ifdef-lines | 198 | hide-ifdef-lines |
| 200 | Set to non-nil to not show #if, #ifdef, #ifndef, #else, and | 199 | Set to non-nil to not show #if, #ifdef, #ifndef, #else, and |
| 201 | #endif lines when hiding. | 200 | #endif lines when hiding. |
| 202 | 201 | ||
| 203 | hide-ifdef-initially | 202 | hide-ifdef-initially |
| 204 | Indicates whether hide-ifdefs should be called when hide-ifdef-mode | 203 | Indicates whether `hide-ifdefs' should be called when Hide-Ifdef mode |
| 205 | is activated. | 204 | is activated. |
| 206 | 205 | ||
| 207 | hide-ifdef-read-only | 206 | hide-ifdef-read-only |
| 208 | Set to non-nil if you want to make buffers read only while hiding. | 207 | Set to non-nil if you want to make buffers read only while hiding. |
| 209 | After show-ifdefs, read-only status is restored to previous value. | 208 | After `show-ifdefs', read-only status is restored to previous value. |
| 210 | 209 | ||
| 211 | \\{hide-ifdef-mode-map}" | 210 | \\{hide-ifdef-mode-map}" |
| 212 | 211 | ||
| @@ -411,15 +410,13 @@ that form should be displayed.") | |||
| 411 | (prog1 | 410 | (prog1 |
| 412 | (hif-expr) | 411 | (hif-expr) |
| 413 | (if token ; is there still a token? | 412 | (if token ; is there still a token? |
| 414 | (error "Error: unexpected token: %s" token))) | 413 | (error "Error: unexpected token: %s" token)))) |
| 415 | ) | ||
| 416 | 414 | ||
| 417 | (defun hif-nexttoken () | 415 | (defun hif-nexttoken () |
| 418 | "Pop the next token from token-list into the let variable \"token\"." | 416 | "Pop the next token from token-list into the let variable \"token\"." |
| 419 | (setq token (car token-list)) | 417 | (setq token (car token-list)) |
| 420 | (setq token-list (cdr token-list)) | 418 | (setq token-list (cdr token-list)) |
| 421 | token | 419 | token) |
| 422 | ) | ||
| 423 | 420 | ||
| 424 | (defun hif-expr () | 421 | (defun hif-expr () |
| 425 | "Parse and expression of the form | 422 | "Parse and expression of the form |
| @@ -428,8 +425,7 @@ that form should be displayed.") | |||
| 428 | (while (eq token 'or) | 425 | (while (eq token 'or) |
| 429 | (hif-nexttoken) | 426 | (hif-nexttoken) |
| 430 | (setq result (list 'or result (hif-term)))) | 427 | (setq result (list 'or result (hif-term)))) |
| 431 | result | 428 | result)) |
| 432 | )) | ||
| 433 | 429 | ||
| 434 | (defun hif-term () | 430 | (defun hif-term () |
| 435 | "Parse a term of the form | 431 | "Parse a term of the form |
| @@ -438,8 +434,7 @@ that form should be displayed.") | |||
| 438 | (while (eq token 'and) | 434 | (while (eq token 'and) |
| 439 | (hif-nexttoken) | 435 | (hif-nexttoken) |
| 440 | (setq result (list 'and result (hif-factor)))) | 436 | (setq result (list 'and result (hif-factor)))) |
| 441 | result | 437 | result)) |
| 442 | )) | ||
| 443 | 438 | ||
| 444 | (defun hif-factor () | 439 | (defun hif-factor () |
| 445 | "Parse a factor of the form | 440 | "Parse a factor of the form |
| @@ -479,7 +474,6 @@ that form should be displayed.") | |||
| 479 | (hif-nexttoken) | 474 | (hif-nexttoken) |
| 480 | (` (hif-lookup (quote (, ident)))) | 475 | (` (hif-lookup (quote (, ident)))) |
| 481 | )) | 476 | )) |
| 482 | |||
| 483 | )) | 477 | )) |
| 484 | 478 | ||
| 485 | ;;;----------- end of parser ----------------------- | 479 | ;;;----------- end of parser ----------------------- |
| @@ -517,8 +511,7 @@ NOT including one on this line." | |||
| 517 | (end-of-line) | 511 | (end-of-line) |
| 518 | ; avoid infinite recursion by only going to beginning of line if match found | 512 | ; avoid infinite recursion by only going to beginning of line if match found |
| 519 | (if (re-search-forward hif-ifx-else-endif-regexp (point-max) t) | 513 | (if (re-search-forward hif-ifx-else-endif-regexp (point-max) t) |
| 520 | (beginning-of-line)) | 514 | (beginning-of-line))) |
| 521 | ) | ||
| 522 | 515 | ||
| 523 | (defun hif-find-previous-relevant () | 516 | (defun hif-find-previous-relevant () |
| 524 | "Position at beginning of previous #ifdef, #ifndef, #else, #endif, | 517 | "Position at beginning of previous #ifdef, #ifndef, #else, #endif, |
| @@ -527,9 +520,7 @@ NOT including one on this line." | |||
| 527 | (beginning-of-line) | 520 | (beginning-of-line) |
| 528 | ; avoid infinite recursion by only going to beginning of line if match found | 521 | ; avoid infinite recursion by only going to beginning of line if match found |
| 529 | (if (re-search-backward hif-ifx-else-endif-regexp (point-min) t) | 522 | (if (re-search-backward hif-ifx-else-endif-regexp (point-min) t) |
| 530 | (beginning-of-line) | 523 | (beginning-of-line))) |
| 531 | ) | ||
| 532 | ) | ||
| 533 | 524 | ||
| 534 | 525 | ||
| 535 | (defun hif-looking-at-ifX () ;; Should eventually see #if | 526 | (defun hif-looking-at-ifX () ;; Should eventually see #if |
| @@ -553,8 +544,7 @@ NOT including one on this line." | |||
| 553 | ((hif-looking-at-endif) | 544 | ((hif-looking-at-endif) |
| 554 | 'done) | 545 | 'done) |
| 555 | (t | 546 | (t |
| 556 | (error "Missmatched #ifdef #endif pair")) | 547 | (error "Missmatched #ifdef #endif pair")))) |
| 557 | )) | ||
| 558 | 548 | ||
| 559 | 549 | ||
| 560 | (defun hif-endif-to-ifdef () | 550 | (defun hif-endif-to-ifdef () |
| @@ -571,13 +561,12 @@ NOT including one on this line." | |||
| 571 | (hif-endif-to-ifdef)) | 561 | (hif-endif-to-ifdef)) |
| 572 | ((hif-looking-at-ifX) | 562 | ((hif-looking-at-ifX) |
| 573 | 'done) | 563 | 'done) |
| 574 | (t ; never gets here | 564 | (t ; never gets here))) |
| 575 | ))) | ||
| 576 | 565 | ||
| 577 | 566 | ||
| 578 | (defun forward-ifdef (&optional arg) | 567 | (defun forward-ifdef (&optional arg) |
| 579 | "Move point to beginning of line of the next ifdef-endif. | 568 | "Move point to beginning of line of the next ifdef-endif. |
| 580 | With argument, do this that many times." | 569 | With argument, do this that many times." |
| 581 | (interactive "p") | 570 | (interactive "p") |
| 582 | (or arg (setq arg 1)) | 571 | (or arg (setq arg 1)) |
| 583 | (if (< arg 0) | 572 | (if (< arg 0) |
| @@ -596,7 +585,7 @@ NOT including one on this line." | |||
| 596 | 585 | ||
| 597 | (defun backward-ifdef (&optional arg) | 586 | (defun backward-ifdef (&optional arg) |
| 598 | "Move point to beginning of the previous ifdef-endif. | 587 | "Move point to beginning of the previous ifdef-endif. |
| 599 | With argument, do this that many times." | 588 | With argument, do this that many times." |
| 600 | (interactive "p") | 589 | (interactive "p") |
| 601 | (or arg (setq arg 1)) | 590 | (or arg (setq arg 1)) |
| 602 | (if (< arg 0) | 591 | (if (< arg 0) |
| @@ -610,9 +599,7 @@ NOT including one on this line." | |||
| 610 | (if (hif-looking-at-endif) | 599 | (if (hif-looking-at-endif) |
| 611 | (hif-endif-to-ifdef) | 600 | (hif-endif-to-ifdef) |
| 612 | (goto-char start) | 601 | (goto-char start) |
| 613 | (error "No previous #ifdef") | 602 | (error "No previous #ifdef"))))) |
| 614 | )))) | ||
| 615 | |||
| 616 | 603 | ||
| 617 | 604 | ||
| 618 | (defun down-ifdef () | 605 | (defun down-ifdef () |
| @@ -623,8 +610,7 @@ NOT including one on this line." | |||
| 623 | (if (or (hif-looking-at-ifX) (hif-looking-at-else)) | 610 | (if (or (hif-looking-at-ifX) (hif-looking-at-else)) |
| 624 | () | 611 | () |
| 625 | (goto-char start) | 612 | (goto-char start) |
| 626 | (error "No following #ifdef") | 613 | (error "No following #ifdef")))) |
| 627 | ))) | ||
| 628 | 614 | ||
| 629 | 615 | ||
| 630 | (defun up-ifdef () | 616 | (defun up-ifdef () |
| @@ -637,12 +623,11 @@ NOT including one on this line." | |||
| 637 | (if (hif-looking-at-endif) | 623 | (if (hif-looking-at-endif) |
| 638 | (hif-endif-to-ifdef)) | 624 | (hif-endif-to-ifdef)) |
| 639 | (if (= start (point)) | 625 | (if (= start (point)) |
| 640 | (error "No previous #ifdef") | 626 | (error "No previous #ifdef")))) |
| 641 | ))) | ||
| 642 | 627 | ||
| 643 | (defun next-ifdef (&optional arg) | 628 | (defun next-ifdef (&optional arg) |
| 644 | "Move to the beginning of the next #ifX, #else, or #endif. | 629 | "Move to the beginning of the next #ifX, #else, or #endif. |
| 645 | With argument, do this that many times." | 630 | With argument, do this that many times." |
| 646 | (interactive "p") | 631 | (interactive "p") |
| 647 | (or arg (setq arg 1)) | 632 | (or arg (setq arg 1)) |
| 648 | (if (< arg 0) | 633 | (if (< arg 0) |
| @@ -653,12 +638,11 @@ NOT including one on this line." | |||
| 653 | (if (eolp) | 638 | (if (eolp) |
| 654 | (progn | 639 | (progn |
| 655 | (beginning-of-line) | 640 | (beginning-of-line) |
| 656 | (error "No following #ifdefs, #elses, or #endifs") | 641 | (error "No following #ifdefs, #elses, or #endifs"))))) |
| 657 | )))) | ||
| 658 | 642 | ||
| 659 | (defun previous-ifdef (&optional arg) | 643 | (defun previous-ifdef (&optional arg) |
| 660 | "Move to the beginning of the previous #ifX, #else, or #endif. | 644 | "Move to the beginning of the previous #ifX, #else, or #endif. |
| 661 | With argument, do this that many times." | 645 | With argument, do this that many times." |
| 662 | (interactive "p") | 646 | (interactive "p") |
| 663 | (or arg (setq arg 1)) | 647 | (or arg (setq arg 1)) |
| 664 | (if (< arg 0) | 648 | (if (< arg 0) |
| @@ -743,8 +727,7 @@ Point is left unchanged." | |||
| 743 | ;;; one, we'd throw off all the counts. Feh. | 727 | ;;; one, we'd throw off all the counts. Feh. |
| 744 | 728 | ||
| 745 | (defun hif-hide-line (point) | 729 | (defun hif-hide-line (point) |
| 746 | "Hide the line containing point. Does nothing if | 730 | "Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil." |
| 747 | hide-ifdef-lines is nil." | ||
| 748 | (if hide-ifdef-lines | 731 | (if hide-ifdef-lines |
| 749 | (save-excursion | 732 | (save-excursion |
| 750 | (goto-char point) | 733 | (goto-char point) |
| @@ -783,8 +766,7 @@ hide-ifdef-lines is nil." | |||
| 783 | ;;; possibly-hidden range. | 766 | ;;; possibly-hidden range. |
| 784 | 767 | ||
| 785 | (defun hif-recurse-on (start end) | 768 | (defun hif-recurse-on (start end) |
| 786 | "Call hide-ifdef-guts after narrowing to end of START line and END | 769 | "Call `hide-ifdef-guts' after narrowing to end of START line and END line." |
| 787 | line." | ||
| 788 | (save-excursion | 770 | (save-excursion |
| 789 | (save-restriction | 771 | (save-restriction |
| 790 | (goto-char start) | 772 | (goto-char start) |
| @@ -794,7 +776,7 @@ line." | |||
| 794 | 776 | ||
| 795 | (defun hif-possibly-hide () | 777 | (defun hif-possibly-hide () |
| 796 | "Called at #ifX expression, this hides those parts that should be | 778 | "Called at #ifX expression, this hides those parts that should be |
| 797 | hidden, according to judgement of hide-ifdef-evaluator." | 779 | hidden, according to judgement of `hide-ifdef-evaluator'." |
| 798 | ; (message "hif-possibly-hide") (sit-for 1) | 780 | ; (message "hif-possibly-hide") (sit-for 1) |
| 799 | (let ((test (hif-canonicalize)) | 781 | (let ((test (hif-canonicalize)) |
| 800 | (range (hif-find-range))) | 782 | (range (hif-find-range))) |
| @@ -829,7 +811,7 @@ hidden, according to judgement of hide-ifdef-evaluator." | |||
| 829 | 811 | ||
| 830 | 812 | ||
| 831 | (defun hide-ifdef-guts () | 813 | (defun hide-ifdef-guts () |
| 832 | "Does the work of hide-ifdefs, except for the work that's pointless | 814 | "Does the work of `hide-ifdefs', except for the work that's pointless |
| 833 | to redo on a recursive entry." | 815 | to redo on a recursive entry." |
| 834 | ; (message "hide-ifdef-guts") | 816 | ; (message "hide-ifdef-guts") |
| 835 | (save-excursion | 817 | (save-excursion |
| @@ -843,8 +825,8 @@ to redo on a recursive entry." | |||
| 843 | ;===%%SF%% exports (Start) === | 825 | ;===%%SF%% exports (Start) === |
| 844 | 826 | ||
| 845 | (defvar hide-ifdef-initially nil | 827 | (defvar hide-ifdef-initially nil |
| 846 | "*Non-nil if hide-ifdefs should be called when hide-ifdef-mode | 828 | "*Non-nil if `hide-ifdefs' should be called when Hide-Ifdef mode |
| 847 | is first activated.") | 829 | is first activated.") |
| 848 | 830 | ||
| 849 | (defvar hide-ifdef-hiding nil | 831 | (defvar hide-ifdef-hiding nil |
| 850 | "Non-nil if text might be hidden.") | 832 | "Non-nil if text might be hidden.") |
| @@ -853,7 +835,7 @@ to redo on a recursive entry." | |||
| 853 | "*Set to non-nil if you want buffer to be read-only while hiding text.") | 835 | "*Set to non-nil if you want buffer to be read-only while hiding text.") |
| 854 | 836 | ||
| 855 | (defvar hif-outside-read-only nil | 837 | (defvar hif-outside-read-only nil |
| 856 | "Internal variable. Saves the value of buffer-read-only while hiding.") | 838 | "Internal variable. Saves the value of `buffer-read-only' while hiding.") |
| 857 | 839 | ||
| 858 | (defvar hide-ifdef-lines nil | 840 | (defvar hide-ifdef-lines nil |
| 859 | "*Set to t if you don't want to see the #ifX, #else, and #endif lines.") | 841 | "*Set to t if you don't want to see the #ifX, #else, and #endif lines.") |
| @@ -866,11 +848,10 @@ to redo on a recursive entry." | |||
| 866 | (if hide-ifdef-read-only "ON" "OFF")) | 848 | (if hide-ifdef-read-only "ON" "OFF")) |
| 867 | (if hide-ifdef-hiding | 849 | (if hide-ifdef-hiding |
| 868 | (setq buffer-read-only (or hide-ifdef-read-only hif-outside-read-only))) | 850 | (setq buffer-read-only (or hide-ifdef-read-only hif-outside-read-only))) |
| 869 | (hif-update-mode-line) | 851 | (hif-update-mode-line)) |
| 870 | ) | ||
| 871 | 852 | ||
| 872 | (defun hide-ifdef-toggle-outside-read-only () | 853 | (defun hide-ifdef-toggle-outside-read-only () |
| 873 | "Replacement for toggle-read-only within hide-ifdef-mode." | 854 | "Replacement for `toggle-read-only' within Hide-Ifdef mode." |
| 874 | (interactive) | 855 | (interactive) |
| 875 | (setq hif-outside-read-only (not hif-outside-read-only)) | 856 | (setq hif-outside-read-only (not hif-outside-read-only)) |
| 876 | (message "Read only %s" | 857 | (message "Read only %s" |
| @@ -879,8 +860,7 @@ to redo on a recursive entry." | |||
| 879 | (or (and hide-ifdef-hiding hide-ifdef-read-only) | 860 | (or (and hide-ifdef-hiding hide-ifdef-read-only) |
| 880 | hif-outside-read-only) | 861 | hif-outside-read-only) |
| 881 | ) | 862 | ) |
| 882 | (hif-update-mode-line) | 863 | (hif-update-mode-line)) |
| 883 | ) | ||
| 884 | 864 | ||
| 885 | 865 | ||
| 886 | (defun hide-ifdef-define (var) | 866 | (defun hide-ifdef-define (var) |
| @@ -898,7 +878,7 @@ to redo on a recursive entry." | |||
| 898 | 878 | ||
| 899 | (defun hide-ifdefs () | 879 | (defun hide-ifdefs () |
| 900 | "Hide the contents of some #ifdefs. Assume that defined symbols have | 880 | "Hide the contents of some #ifdefs. Assume that defined symbols have |
| 901 | been added to hide-ifdef-env. The text hidden is the text that would not | 881 | been added to `hide-ifdef-env'. The text hidden is the text that would not |
| 902 | be included by the C preprocessor if it were given the file with those | 882 | be included by the C preprocessor if it were given the file with those |
| 903 | symbols defined. | 883 | symbols defined. |
| 904 | 884 | ||
| @@ -915,10 +895,8 @@ Turn off hiding by calling show-ifdef." | |||
| 915 | (setq hide-ifdef-hiding t) | 895 | (setq hide-ifdef-hiding t) |
| 916 | (hide-ifdef-guts) | 896 | (hide-ifdef-guts) |
| 917 | (if (or hide-ifdef-read-only hif-outside-read-only) | 897 | (if (or hide-ifdef-read-only hif-outside-read-only) |
| 918 | (toggle-read-only) ; make it read only | 898 | (toggle-read-only)) ; make it read only |
| 919 | ) | 899 | (message "Hiding done")) |
| 920 | (message "Hiding done") | ||
| 921 | ) | ||
| 922 | 900 | ||
| 923 | 901 | ||
| 924 | (defun show-ifdefs () | 902 | (defun show-ifdefs () |
| @@ -929,8 +907,7 @@ Turn off hiding by calling show-ifdef." | |||
| 929 | (hif-show-all) | 907 | (hif-show-all) |
| 930 | (if hif-outside-read-only | 908 | (if hif-outside-read-only |
| 931 | (toggle-read-only)) ; make it read only | 909 | (toggle-read-only)) ; make it read only |
| 932 | (setq hide-ifdef-hiding nil) | 910 | (setq hide-ifdef-hiding nil)) |
| 933 | ) | ||
| 934 | 911 | ||
| 935 | 912 | ||
| 936 | (defun hif-find-ifdef-block () | 913 | (defun hif-find-ifdef-block () |
| @@ -942,18 +919,15 @@ Turn off hiding by calling show-ifdef." | |||
| 942 | (up-ifdef)) | 919 | (up-ifdef)) |
| 943 | (setq top (point)) | 920 | (setq top (point)) |
| 944 | (hif-ifdef-to-endif) | 921 | (hif-ifdef-to-endif) |
| 945 | (setq max-bottom (1- (point))) | 922 | (setq max-bottom (1- (point)))) |
| 946 | ) | ||
| 947 | (save-excursion | 923 | (save-excursion |
| 948 | (beginning-of-line) | 924 | (beginning-of-line) |
| 949 | (if (not (hif-looking-at-endif)) | 925 | (if (not (hif-looking-at-endif)) |
| 950 | (hif-find-next-relevant)) | 926 | (hif-find-next-relevant)) |
| 951 | (while (hif-looking-at-ifX) | 927 | (while (hif-looking-at-ifX) |
| 952 | (hif-ifdef-to-endif) | 928 | (hif-ifdef-to-endif) |
| 953 | (hif-find-next-relevant) | 929 | (hif-find-next-relevant)) |
| 954 | ) | 930 | (setq bottom (min max-bottom (1- (point)))))) |
| 955 | (setq bottom (min max-bottom (1- (point)))) | ||
| 956 | )) | ||
| 957 | ) | 931 | ) |
| 958 | 932 | ||
| 959 | 933 | ||
| @@ -971,11 +945,9 @@ Turn off hiding by calling show-ifdef." | |||
| 971 | (progn | 945 | (progn |
| 972 | (hif-hide-line top) | 946 | (hif-hide-line top) |
| 973 | (hif-hide-line (1+ bottom)))) | 947 | (hif-hide-line (1+ bottom)))) |
| 974 | (setq hide-ifdef-hiding t) | 948 | (setq hide-ifdef-hiding t)) |
| 975 | ) | ||
| 976 | (if (or hide-ifdef-read-only hif-outside-read-only) | 949 | (if (or hide-ifdef-read-only hif-outside-read-only) |
| 977 | (toggle-read-only)) | 950 | (toggle-read-only))) |
| 978 | ) | ||
| 979 | 951 | ||
| 980 | 952 | ||
| 981 | (defun show-ifdef-block () | 953 | (defun show-ifdef-block () |
| @@ -994,9 +966,7 @@ Turn off hiding by calling show-ifdef." | |||
| 994 | ) | 966 | ) |
| 995 | 967 | ||
| 996 | ; restore read only status since we dont know if all is shown. | 968 | ; restore read only status since we dont know if all is shown. |
| 997 | (if old-read-only (toggle-read-only)) | 969 | (if old-read-only (toggle-read-only)))) |
| 998 | )) | ||
| 999 | |||
| 1000 | 970 | ||
| 1001 | 971 | ||
| 1002 | ;;; defininition alist support | 972 | ;;; defininition alist support |
| @@ -1014,16 +984,14 @@ Turn off hiding by calling show-ifdef." | |||
| 1014 | (if (car defs) | 984 | (if (car defs) |
| 1015 | (setq new-defs (cons (car defs) new-defs))) | 985 | (setq new-defs (cons (car defs) new-defs))) |
| 1016 | (setq defs (cdr defs))) | 986 | (setq defs (cdr defs))) |
| 1017 | new-defs | 987 | new-defs)) |
| 1018 | )) | ||
| 1019 | 988 | ||
| 1020 | (defun hide-ifdef-set-define-alist (name) | 989 | (defun hide-ifdef-set-define-alist (name) |
| 1021 | "Set the association for NAME to hide-ifdef-env." | 990 | "Set the association for NAME to hide-ifdef-env." |
| 1022 | (interactive "SSet define list: ") | 991 | (interactive "SSet define list: ") |
| 1023 | (setq hide-ifdef-define-alist | 992 | (setq hide-ifdef-define-alist |
| 1024 | (cons (cons name (hif-compress-define-list hide-ifdef-env)) | 993 | (cons (cons name (hif-compress-define-list hide-ifdef-env)) |
| 1025 | hide-ifdef-define-alist)) | 994 | hide-ifdef-define-alist))) |
| 1026 | ) | ||
| 1027 | 995 | ||
| 1028 | (defun hide-ifdef-use-define-alist (name) | 996 | (defun hide-ifdef-use-define-alist (name) |
| 1029 | "Set hide-ifdef-env to the define list specified by NAME." | 997 | "Set hide-ifdef-env to the define list specified by NAME." |
| @@ -1034,8 +1002,6 @@ Turn off hiding by calling show-ifdef." | |||
| 1034 | (mapcar '(lambda (arg) (cons arg t)) | 1002 | (mapcar '(lambda (arg) (cons arg t)) |
| 1035 | (cdr define-list))) | 1003 | (cdr define-list))) |
| 1036 | (error "No define list for %s" name)) | 1004 | (error "No define list for %s" name)) |
| 1037 | (if hide-ifdef-hiding (hide-ifdefs)) | 1005 | (if hide-ifdef-hiding (hide-ifdefs)))) |
| 1038 | ) | ||
| 1039 | ) | ||
| 1040 | 1006 | ||
| 1041 | ;===%%SF%% exports (End) === | 1007 | ;===%%SF%% exports (End) === |
diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el index 2215f84d795..c381f812105 100644 --- a/lisp/progmodes/icon.el +++ b/lisp/progmodes/icon.el | |||
| @@ -107,15 +107,15 @@ Variables controlling indentation style: | |||
| 107 | then-clause of an if or body of a while. | 107 | then-clause of an if or body of a while. |
| 108 | icon-continued-brace-offset | 108 | icon-continued-brace-offset |
| 109 | Extra indentation given to a brace that starts a substatement. | 109 | Extra indentation given to a brace that starts a substatement. |
| 110 | This is in addition to icon-continued-statement-offset. | 110 | This is in addition to `icon-continued-statement-offset'. |
| 111 | icon-brace-offset | 111 | icon-brace-offset |
| 112 | Extra indentation for line if it starts with an open brace. | 112 | Extra indentation for line if it starts with an open brace. |
| 113 | icon-brace-imaginary-offset | 113 | icon-brace-imaginary-offset |
| 114 | An open brace following other text is treated as if it were | 114 | An open brace following other text is treated as if it were |
| 115 | this far to the right of the start of its line. | 115 | this far to the right of the start of its line. |
| 116 | 116 | ||
| 117 | Turning on Icon mode calls the value of the variable icon-mode-hook with no args, | 117 | Turning on Icon mode calls the value of the variable `icon-mode-hook' |
| 118 | if that value is non-nil." | 118 | with no args, if that value is non-nil." |
| 119 | (interactive) | 119 | (interactive) |
| 120 | (kill-all-local-variables) | 120 | (kill-all-local-variables) |
| 121 | (use-local-map icon-mode-map) | 121 | (use-local-map icon-mode-map) |
| @@ -143,9 +143,8 @@ if that value is non-nil." | |||
| 143 | (setq comment-indent-hook 'icon-comment-indent) | 143 | (setq comment-indent-hook 'icon-comment-indent) |
| 144 | (run-hooks 'icon-mode-hook)) | 144 | (run-hooks 'icon-mode-hook)) |
| 145 | 145 | ||
| 146 | ;; This is used by indent-for-comment | 146 | ;; This is used by indent-for-comment to decide how much to |
| 147 | ;; to decide how much to indent a comment in Icon code | 147 | ;; indent a comment in Icon code based on its context. |
| 148 | ;; based on its context. | ||
| 149 | (defun icon-comment-indent () | 148 | (defun icon-comment-indent () |
| 150 | (if (looking-at "^#") | 149 | (if (looking-at "^#") |
| 151 | 0 | 150 | 0 |
| @@ -187,14 +186,14 @@ if that value is non-nil." | |||
| 187 | (defun icon-indent-command (&optional whole-exp) | 186 | (defun icon-indent-command (&optional whole-exp) |
| 188 | (interactive "P") | 187 | (interactive "P") |
| 189 | "Indent current line as Icon code, or in some cases insert a tab character. | 188 | "Indent current line as Icon code, or in some cases insert a tab character. |
| 190 | If icon-tab-always-indent is non-nil (the default), always indent current line. | 189 | If `icon-tab-always-indent' is non-nil (the default), always indent current |
| 191 | Otherwise, indent the current line only if point is at the left margin | 190 | line. Otherwise, indent the current line only if point is at the left margin |
| 192 | or in the line's indentation; otherwise insert a tab. | 191 | or in the line's indentation; otherwise insert a tab. |
| 193 | 192 | ||
| 194 | A numeric argument, regardless of its value, | 193 | A numeric argument, regardless of its value, means indent rigidly all the |
| 195 | means indent rigidly all the lines of the expression starting after point | 194 | lines of the expression starting after point so that this line becomes |
| 196 | so that this line becomes properly indented. | 195 | properly indented. The relative indentation among the lines of the |
| 197 | The relative indentation among the lines of the expression are preserved." | 196 | expression are preserved." |
| 198 | (if whole-exp | 197 | (if whole-exp |
| 199 | ;; If arg, always indent this line as Icon | 198 | ;; If arg, always indent this line as Icon |
| 200 | ;; and shift remaining lines of expression the same amount. | 199 | ;; and shift remaining lines of expression the same amount. |
| @@ -402,7 +401,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 402 | (icon-is-continuation-line))) | 401 | (icon-is-continuation-line))) |
| 403 | 402 | ||
| 404 | (defun icon-backward-to-start-of-if (&optional limit) | 403 | (defun icon-backward-to-start-of-if (&optional limit) |
| 405 | "Move to the start of the last ``unbalanced'' if." | 404 | "Move to the start of the last \"unbalanced\" if." |
| 406 | (or limit (setq limit (save-excursion (beginning-of-icon-defun) (point)))) | 405 | (or limit (setq limit (save-excursion (beginning-of-icon-defun) (point)))) |
| 407 | (let ((if-level 1) | 406 | (let ((if-level 1) |
| 408 | (case-fold-search nil)) | 407 | (case-fold-search nil)) |