diff options
| author | Sam Steingold | 2001-11-27 17:00:12 +0000 |
|---|---|---|
| committer | Sam Steingold | 2001-11-27 17:00:12 +0000 |
| commit | 65d93dbcc7ce9e58a41813cdc14eaf3a8be7cda2 (patch) | |
| tree | 16b8e2f00d91e12cad98bba727155359efec8bf1 | |
| parent | 8a9463543d5b82409a24e23905d271cdebf70059 (diff) | |
| download | emacs-65d93dbcc7ce9e58a41813cdc14eaf3a8be7cda2.tar.gz emacs-65d93dbcc7ce9e58a41813cdc14eaf3a8be7cda2.zip | |
fixed {}() quoting
| -rw-r--r-- | lisp/obsolete/c-mode.el | 32 | ||||
| -rw-r--r-- | lisp/obsolete/cplus-md.el | 80 |
2 files changed, 56 insertions, 56 deletions
diff --git a/lisp/obsolete/c-mode.el b/lisp/obsolete/c-mode.el index a76d963283a..ae17183a2c2 100644 --- a/lisp/obsolete/c-mode.el +++ b/lisp/obsolete/c-mode.el | |||
| @@ -794,9 +794,9 @@ Return the amount the indentation changed by." | |||
| 794 | (setq indent (save-excursion | 794 | (setq indent (save-excursion |
| 795 | (c-backward-to-start-of-do) | 795 | (c-backward-to-start-of-do) |
| 796 | (current-indentation)))) | 796 | (current-indentation)))) |
| 797 | ((= (following-char) ?}) | 797 | ((= (following-char) ?\}) |
| 798 | (setq indent (- indent c-indent-level))) | 798 | (setq indent (- indent c-indent-level))) |
| 799 | ((= (following-char) ?{) | 799 | ((= (following-char) ?\{) |
| 800 | (setq indent (+ indent c-brace-offset)))))) | 800 | (setq indent (+ indent c-brace-offset)))))) |
| 801 | (skip-chars-forward " \t") | 801 | (skip-chars-forward " \t") |
| 802 | (setq shift-amt (- indent (current-column))) | 802 | (setq shift-amt (- indent (current-column))) |
| @@ -839,7 +839,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 839 | ;; in which case this line is the first argument decl. | 839 | ;; in which case this line is the first argument decl. |
| 840 | (goto-char indent-point) | 840 | (goto-char indent-point) |
| 841 | (skip-chars-forward " \t") | 841 | (skip-chars-forward " \t") |
| 842 | (if (= (following-char) ?{) | 842 | (if (= (following-char) ?\{) |
| 843 | 0 ; Unless it starts a function body | 843 | 0 ; Unless it starts a function body |
| 844 | (c-backward-to-noncomment (or parse-start (point-min))) | 844 | (c-backward-to-noncomment (or parse-start (point-min))) |
| 845 | ;; Look at previous line that's at column 0 | 845 | ;; Look at previous line that's at column 0 |
| @@ -907,7 +907,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 907 | ;; (= (current-indentation) 0)) | 907 | ;; (= (current-indentation) 0)) |
| 908 | ;; 0 c-continued-statement-offset)) | 908 | ;; 0 c-continued-statement-offset)) |
| 909 | 909 | ||
| 910 | ((/= (char-after containing-sexp) ?{) | 910 | ((/= (char-after containing-sexp) ?\{) |
| 911 | ;; line is expression, not statement: | 911 | ;; line is expression, not statement: |
| 912 | ;; indent to just after the surrounding open. | 912 | ;; indent to just after the surrounding open. |
| 913 | (goto-char (1+ containing-sexp)) | 913 | (goto-char (1+ containing-sexp)) |
| @@ -958,7 +958,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 958 | (save-excursion | 958 | (save-excursion |
| 959 | (goto-char indent-point) | 959 | (goto-char indent-point) |
| 960 | (skip-chars-forward " \t") | 960 | (skip-chars-forward " \t") |
| 961 | (not (= (following-char) ?})))) | 961 | (not (= (following-char) ?\})))) |
| 962 | ;; This line is continuation of preceding line's statement; | 962 | ;; This line is continuation of preceding line's statement; |
| 963 | ;; indent c-continued-statement-offset more than the | 963 | ;; indent c-continued-statement-offset more than the |
| 964 | ;; previous line of the statement. | 964 | ;; previous line of the statement. |
| @@ -967,7 +967,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 967 | (+ c-continued-statement-offset (current-column) | 967 | (+ c-continued-statement-offset (current-column) |
| 968 | (if (save-excursion (goto-char indent-point) | 968 | (if (save-excursion (goto-char indent-point) |
| 969 | (skip-chars-forward " \t") | 969 | (skip-chars-forward " \t") |
| 970 | (eq (following-char) ?{)) | 970 | (eq (following-char) ?\{)) |
| 971 | c-continued-brace-offset 0))) | 971 | c-continued-brace-offset 0))) |
| 972 | ;; This line starts a new statement. | 972 | ;; This line starts a new statement. |
| 973 | ;; Position following last unclosed open. | 973 | ;; Position following last unclosed open. |
| @@ -1124,10 +1124,10 @@ Otherwise return nil and don't move point." | |||
| 1124 | ;; is a close brace.) | 1124 | ;; is a close brace.) |
| 1125 | (if (save-excursion | 1125 | (if (save-excursion |
| 1126 | (forward-sexp 1) | 1126 | (forward-sexp 1) |
| 1127 | (or (and (not first) (= (preceding-char) ?})) | 1127 | (or (and (not first) (= (preceding-char) ?\})) |
| 1128 | (search-forward ";" next-start t | 1128 | (search-forward ";" next-start t |
| 1129 | (if (and first | 1129 | (if (and first |
| 1130 | (/= (preceding-char) ?})) | 1130 | (/= (preceding-char) ?\})) |
| 1131 | 2 1)))) | 1131 | 2 1)))) |
| 1132 | (setq done 'fail) | 1132 | (setq done 'fail) |
| 1133 | (setq first nil) | 1133 | (setq first nil) |
| @@ -1345,7 +1345,7 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1345 | ;; Yes. | 1345 | ;; Yes. |
| 1346 | ;; Compute the standard indent for this level. | 1346 | ;; Compute the standard indent for this level. |
| 1347 | (let (val) | 1347 | (let (val) |
| 1348 | (if (= (char-after (car contain-stack)) ?{) | 1348 | (if (= (char-after (car contain-stack)) ?\{) |
| 1349 | (save-excursion | 1349 | (save-excursion |
| 1350 | (goto-char (car contain-stack)) | 1350 | (goto-char (car contain-stack)) |
| 1351 | (setq val (calculate-c-indent-after-brace))) | 1351 | (setq val (calculate-c-indent-after-brace))) |
| @@ -1361,7 +1361,7 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1361 | ;; Adjust indent of this individual line | 1361 | ;; Adjust indent of this individual line |
| 1362 | ;; based on its predecessor. | 1362 | ;; based on its predecessor. |
| 1363 | ;; Handle continuation lines, if, else, while, and so on. | 1363 | ;; Handle continuation lines, if, else, while, and so on. |
| 1364 | (if (/= (char-after (car contain-stack)) ?{) | 1364 | (if (/= (char-after (car contain-stack)) ?\{) |
| 1365 | (setq this-indent (car indent-stack)) | 1365 | (setq this-indent (car indent-stack)) |
| 1366 | ;; Line is at statement level. | 1366 | ;; Line is at statement level. |
| 1367 | ;; Is it a new statement? Is it an else? | 1367 | ;; Is it a new statement? Is it an else? |
| @@ -1370,13 +1370,13 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1370 | (setq this-point (point)) | 1370 | (setq this-point (point)) |
| 1371 | (setq at-else (and (looking-at "else\\b") | 1371 | (setq at-else (and (looking-at "else\\b") |
| 1372 | (not (looking-at "else\\s_")))) | 1372 | (not (looking-at "else\\s_")))) |
| 1373 | (setq at-brace (= (following-char) ?{)) | 1373 | (setq at-brace (= (following-char) ?\{)) |
| 1374 | (setq at-while (and (looking-at "while\\b") | 1374 | (setq at-while (and (looking-at "while\\b") |
| 1375 | (not (looking-at "while\\s_")))) | 1375 | (not (looking-at "while\\s_")))) |
| 1376 | (if (= (following-char) ?}) | 1376 | (if (= (following-char) ?\}) |
| 1377 | (setq this-indent (car indent-stack)) | 1377 | (setq this-indent (car indent-stack)) |
| 1378 | (c-backward-to-noncomment opoint) | 1378 | (c-backward-to-noncomment opoint) |
| 1379 | (if (not (memq (preceding-char) '(0 ?\, ?\; ?} ?: ?{))) | 1379 | (if (not (memq (preceding-char) '(0 ?\, ?\; ?\} ?: ?\{))) |
| 1380 | ;; Preceding line did not end in comma or semi; | 1380 | ;; Preceding line did not end in comma or semi; |
| 1381 | ;; indent this line c-continued-statement-offset | 1381 | ;; indent this line c-continued-statement-offset |
| 1382 | ;; more than previous. | 1382 | ;; more than previous. |
| @@ -1403,9 +1403,9 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1403 | (forward-sexp 1) | 1403 | (forward-sexp 1) |
| 1404 | (looking-at ":")))) | 1404 | (looking-at ":")))) |
| 1405 | (setq this-indent (max 1 (+ this-indent c-label-offset)))) | 1405 | (setq this-indent (max 1 (+ this-indent c-label-offset)))) |
| 1406 | (if (= (following-char) ?}) | 1406 | (if (= (following-char) ?\}) |
| 1407 | (setq this-indent (- this-indent c-indent-level))) | 1407 | (setq this-indent (- this-indent c-indent-level))) |
| 1408 | (if (= (following-char) ?{) | 1408 | (if (= (following-char) ?\{) |
| 1409 | ;; Don't move an open-brace in column 0. | 1409 | ;; Don't move an open-brace in column 0. |
| 1410 | ;; This is good when constructs such as | 1410 | ;; This is good when constructs such as |
| 1411 | ;; `extern "C" {' surround a function definition | 1411 | ;; `extern "C" {' surround a function definition |
| @@ -1437,7 +1437,7 @@ If within a string or comment, move by sentences instead of statements." | |||
| 1437 | (parse-partial-sexp beg (point) | 1437 | (parse-partial-sexp beg (point) |
| 1438 | nil nil state))) | 1438 | nil nil state))) |
| 1439 | (and (not (nth 3 new-state)) (not (nth 5 new-state)))) | 1439 | (and (not (nth 3 new-state)) (not (nth 5 new-state)))) |
| 1440 | (indent-for-comment))))))))))))) | 1440 | (indent-for-comment))))))))))) |
| 1441 | 1441 | ||
| 1442 | ;; Look at all comment-start strings in the current line after point. | 1442 | ;; Look at all comment-start strings in the current line after point. |
| 1443 | ;; Return t if one of them starts a real comment. | 1443 | ;; Return t if one of them starts a real comment. |
diff --git a/lisp/obsolete/cplus-md.el b/lisp/obsolete/cplus-md.el index 8df342ba4d2..7b7e3c4d26b 100644 --- a/lisp/obsolete/cplus-md.el +++ b/lisp/obsolete/cplus-md.el | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; 1987 Dave Detlefs <dld@cs.cmu.edu> | 27 | ;; 1987 Dave Detlefs <dld@cs.cmu.edu> |
| 28 | ;; and Stewart Clamen <clamen@cs.cmu.edu>. | 28 | ;; and Stewart Clamen <clamen@cs.cmu.edu>. |
| 29 | ;; Done by fairly faithful modification of: | 29 | ;; Done by fairly faithful modification of: |
| 30 | 30 | ||
| @@ -33,18 +33,18 @@ | |||
| 33 | ;; Feb, 1990 (Dave Detlefs, dld@cs.cmu.edu) | 33 | ;; Feb, 1990 (Dave Detlefs, dld@cs.cmu.edu) |
| 34 | ;; Fixed electric-c++-terminator to handle double colons, at the | 34 | ;; Fixed electric-c++-terminator to handle double colons, at the |
| 35 | ;; request of John Hagerman. | 35 | ;; request of John Hagerman. |
| 36 | ;; | 36 | ;; |
| 37 | ;; Jan, 1990 (Doug Lea, dl@oswego.edu) | 37 | ;; Jan, 1990 (Doug Lea, dl@oswego.edu) |
| 38 | ;; Replaced c++-comment-region and c++-uncomment-region with | 38 | ;; Replaced c++-comment-region and c++-uncomment-region with |
| 39 | ;; versions from Igor Metz that avoid potential infinite loops. | 39 | ;; versions from Igor Metz that avoid potential infinite loops. |
| 40 | ;; | 40 | ;; |
| 41 | ;; Oct, 1989 (Dave Detlefs, dld@cs.cmu.edu) | 41 | ;; Oct, 1989 (Dave Detlefs, dld@cs.cmu.edu) |
| 42 | ;; Added contribution from Igor Metz <metz@iam.unibe.ch>: | 42 | ;; Added contribution from Igor Metz <metz@iam.unibe.ch>: |
| 43 | ;; functions c++-comment-region and c++-uncomment-region and | 43 | ;; functions c++-comment-region and c++-uncomment-region and |
| 44 | ;; corresponding key-binding. | 44 | ;; corresponding key-binding. |
| 45 | ;; Also fixed bug in indentation of second line after an empty | 45 | ;; Also fixed bug in indentation of second line after an empty |
| 46 | ;; arglist with empty-arglist non-null. | 46 | ;; arglist with empty-arglist non-null. |
| 47 | ;; | 47 | ;; |
| 48 | ;; Sept, 1989 (Glen Ditchfield, gjditchfield@violet.uwaterloo.ca): | 48 | ;; Sept, 1989 (Glen Ditchfield, gjditchfield@violet.uwaterloo.ca): |
| 49 | ;; Textual changes to more closely imitate Emacs 18.55's c-mode. | 49 | ;; Textual changes to more closely imitate Emacs 18.55's c-mode. |
| 50 | ;; Fixed handling of "default:", where ":" was the last character in the | 50 | ;; Fixed handling of "default:", where ":" was the last character in the |
| @@ -180,14 +180,14 @@ list. Nil indicates to just after the paren." | |||
| 180 | "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" | 180 | "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" |
| 181 | "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no | 181 | "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no |
| 182 | "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right? | 182 | "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right? |
| 183 | 183 | ||
| 184 | "\\(" ; last type spec including */& | 184 | "\\(" ; last type spec including */& |
| 185 | "[a-zA-Z0-9_:]+" | 185 | "[a-zA-Z0-9_:]+" |
| 186 | "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace | 186 | "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace |
| 187 | "\\)?" ; if there is a last type spec | 187 | "\\)?" ; if there is a last type spec |
| 188 | "\\(" ; name; take that into the imenu entry | 188 | "\\(" ; name; take that into the imenu entry |
| 189 | "[a-zA-Z0-9_:~]+" ; member function, ctor or dtor... | 189 | "[a-zA-Z0-9_:~]+" ; member function, ctor or dtor... |
| 190 | ; (may not contain * because then | 190 | ; (may not contain * because then |
| 191 | ; "a::operator char*" would become "char*"!) | 191 | ; "a::operator char*" would become "char*"!) |
| 192 | "\\|" | 192 | "\\|" |
| 193 | "\\([a-zA-Z0-9_:~]*::\\)?operator" | 193 | "\\([a-zA-Z0-9_:~]*::\\)?operator" |
| @@ -198,10 +198,10 @@ list. Nil indicates to just after the paren." | |||
| 198 | ; catch cases with () inside the parentheses | 198 | ; catch cases with () inside the parentheses |
| 199 | ; surrounding the parameters | 199 | ; surrounding the parameters |
| 200 | ; (like "int foo(int a=bar()) {...}" | 200 | ; (like "int foo(int a=bar()) {...}" |
| 201 | 201 | ||
| 202 | ) 6) | 202 | ) 6) |
| 203 | ("Class" | 203 | ("Class" |
| 204 | ,(concat | 204 | ,(concat |
| 205 | "^" ; beginning of line is required | 205 | "^" ; beginning of line is required |
| 206 | "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" | 206 | "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" |
| 207 | "class[ \t]+" | 207 | "class[ \t]+" |
| @@ -212,20 +212,20 @@ list. Nil indicates to just after the paren." | |||
| 212 | ;; Uncomment if you want to find these too. It will be a bit slower gathering | 212 | ;; Uncomment if you want to find these too. It will be a bit slower gathering |
| 213 | ;; the indexes. | 213 | ;; the indexes. |
| 214 | ; ("Prototypes" | 214 | ; ("Prototypes" |
| 215 | ; (, | 215 | ; (, |
| 216 | ; (concat | 216 | ; (concat |
| 217 | ; "^" ; beginning of line is required | 217 | ; "^" ; beginning of line is required |
| 218 | ; "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" | 218 | ; "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>" |
| 219 | ; "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no | 219 | ; "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no |
| 220 | ; "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right? | 220 | ; "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right? |
| 221 | 221 | ||
| 222 | ; "\\(" ; last type spec including */& | 222 | ; "\\(" ; last type spec including */& |
| 223 | ; "[a-zA-Z0-9_:]+" | 223 | ; "[a-zA-Z0-9_:]+" |
| 224 | ; "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace | 224 | ; "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either pointer/ref sign or whitespace |
| 225 | ; "\\)?" ; if there is a last type spec | 225 | ; "\\)?" ; if there is a last type spec |
| 226 | ; "\\(" ; name; take that into the imenu entry | 226 | ; "\\(" ; name; take that into the imenu entry |
| 227 | ; "[a-zA-Z0-9_:~]+" ; member function, ctor or dtor... | 227 | ; "[a-zA-Z0-9_:~]+" ; member function, ctor or dtor... |
| 228 | ; ; (may not contain * because then | 228 | ; ; (may not contain * because then |
| 229 | ; ; "a::operator char*" would become "char*"!) | 229 | ; ; "a::operator char*" would become "char*"!) |
| 230 | ; "\\|" | 230 | ; "\\|" |
| 231 | ; "\\([a-zA-Z0-9_:~]*::\\)?operator" | 231 | ; "\\([a-zA-Z0-9_:~]*::\\)?operator" |
| @@ -235,8 +235,8 @@ list. Nil indicates to just after the paren." | |||
| 235 | ; ; the (...) Can't | 235 | ; ; the (...) Can't |
| 236 | ; ; catch cases with () inside the parentheses | 236 | ; ; catch cases with () inside the parentheses |
| 237 | ; ; surrounding the parameters | 237 | ; ; surrounding the parameters |
| 238 | ; ; (like "int foo(int a=bar());" | 238 | ; ; (like "int foo(int a=bar());" |
| 239 | ; )) 6) | 239 | ; )) 6) |
| 240 | ; ("Struct" | 240 | ; ("Struct" |
| 241 | ; (, (concat | 241 | ; (, (concat |
| 242 | ; "^" ; beginning of line is required | 242 | ; "^" ; beginning of line is required |
| @@ -530,9 +530,9 @@ Return the amount the indentation changed by." | |||
| 530 | (current-indentation)))) | 530 | (current-indentation)))) |
| 531 | ((looking-at "friend\[ \t]") | 531 | ((looking-at "friend\[ \t]") |
| 532 | (setq indent (+ indent c++-friend-offset))) | 532 | (setq indent (+ indent c++-friend-offset))) |
| 533 | ((= (following-char) ?}) | 533 | ((= (following-char) ?\}) |
| 534 | (setq indent (- indent c-indent-level))) | 534 | (setq indent (- indent c-indent-level))) |
| 535 | ((= (following-char) ?{) | 535 | ((= (following-char) ?\{) |
| 536 | (setq indent (+ indent c-brace-offset)))))) | 536 | (setq indent (+ indent c-brace-offset)))))) |
| 537 | (skip-chars-forward " \t") | 537 | (skip-chars-forward " \t") |
| 538 | (setq shift-amt (- indent (current-column))) | 538 | (setq shift-amt (- indent (current-column))) |
| @@ -579,7 +579,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 579 | ;; It is assumed that arg decls and member inits are not mixed. | 579 | ;; It is assumed that arg decls and member inits are not mixed. |
| 580 | (goto-char indent-point) | 580 | (goto-char indent-point) |
| 581 | (skip-chars-forward " \t") | 581 | (skip-chars-forward " \t") |
| 582 | (if (= (following-char) ?{) | 582 | (if (= (following-char) ?\{) |
| 583 | 0 ; Unless it starts a function body | 583 | 0 ; Unless it starts a function body |
| 584 | (c++-backward-to-noncomment (or parse-start (point-min))) | 584 | (c++-backward-to-noncomment (or parse-start (point-min))) |
| 585 | (if (= (preceding-char) ?\)) | 585 | (if (= (preceding-char) ?\)) |
| @@ -591,7 +591,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 591 | c-argdecl-indent)) | 591 | c-argdecl-indent)) |
| 592 | (if (= (preceding-char) ?\;) | 592 | (if (= (preceding-char) ?\;) |
| 593 | (backward-char 1)) | 593 | (backward-char 1)) |
| 594 | (if (= (preceding-char) ?}) | 594 | (if (= (preceding-char) ?\}) |
| 595 | 0 | 595 | 0 |
| 596 | (if (= (preceding-char) ?\)) | 596 | (if (= (preceding-char) ?\)) |
| 597 | (forward-list -1)) | 597 | (forward-list -1)) |
| @@ -607,7 +607,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 607 | (current-column))) | 607 | (current-column))) |
| 608 | (current-indentation))) | 608 | (current-indentation))) |
| 609 | ))) | 609 | ))) |
| 610 | ((/= (char-after containing-sexp) ?{) | 610 | ((/= (char-after containing-sexp) ?\{) |
| 611 | ;; line is expression, not statement: | 611 | ;; line is expression, not statement: |
| 612 | ;; indent to just after the surrounding open -- unless | 612 | ;; indent to just after the surrounding open -- unless |
| 613 | ;; empty arg list, in which case we do what | 613 | ;; empty arg list, in which case we do what |
| @@ -647,7 +647,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 647 | (save-excursion | 647 | (save-excursion |
| 648 | (goto-char indent-point) | 648 | (goto-char indent-point) |
| 649 | (skip-chars-forward " \t") | 649 | (skip-chars-forward " \t") |
| 650 | (not (= (following-char) ?})))) | 650 | (not (= (following-char) ?\})))) |
| 651 | ;; This line is continuation of preceding line's statement; | 651 | ;; This line is continuation of preceding line's statement; |
| 652 | ;; indent c-continued-statement-offset more than the | 652 | ;; indent c-continued-statement-offset more than the |
| 653 | ;; previous line of the statement. | 653 | ;; previous line of the statement. |
| @@ -656,7 +656,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 656 | (+ c-continued-statement-offset (current-column) | 656 | (+ c-continued-statement-offset (current-column) |
| 657 | (if (save-excursion (goto-char indent-point) | 657 | (if (save-excursion (goto-char indent-point) |
| 658 | (skip-chars-forward " \t") | 658 | (skip-chars-forward " \t") |
| 659 | (eq (following-char) ?{)) | 659 | (eq (following-char) ?\{)) |
| 660 | c-continued-brace-offset 0))) | 660 | c-continued-brace-offset 0))) |
| 661 | ;; This line starts a new statement. | 661 | ;; This line starts a new statement. |
| 662 | ;; Position following last unclosed open. | 662 | ;; Position following last unclosed open. |
| @@ -688,7 +688,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 688 | ;; The first following code counts | 688 | ;; The first following code counts |
| 689 | ;; if it is before the line we want to indent. | 689 | ;; if it is before the line we want to indent. |
| 690 | (and (< (point) indent-point) | 690 | (and (< (point) indent-point) |
| 691 | (- | 691 | (- |
| 692 | (if (> colon-line-end (point)) | 692 | (if (> colon-line-end (point)) |
| 693 | (- (current-indentation) c-label-offset) | 693 | (- (current-indentation) c-label-offset) |
| 694 | (current-column)) | 694 | (current-column)) |
| @@ -719,7 +719,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 719 | (if (eq (preceding-char) ?\)) | 719 | (if (eq (preceding-char) ?\)) |
| 720 | (forward-sexp -1)) | 720 | (forward-sexp -1)) |
| 721 | ;; Get initial indentation of the line we are on. | 721 | ;; Get initial indentation of the line we are on. |
| 722 | (current-indentation))))))))))) | 722 | (current-indentation)))))))))) |
| 723 | 723 | ||
| 724 | (defun c++-backward-to-noncomment (lim) | 724 | (defun c++-backward-to-noncomment (lim) |
| 725 | (let (opoint stop) | 725 | (let (opoint stop) |
| @@ -815,7 +815,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 815 | ;; Just started a new nesting level. | 815 | ;; Just started a new nesting level. |
| 816 | ;; Compute the standard indent for this level. | 816 | ;; Compute the standard indent for this level. |
| 817 | (let (val) | 817 | (let (val) |
| 818 | (if (= (char-after (car contain-stack)) ?{) | 818 | (if (= (char-after (car contain-stack)) ?\{) |
| 819 | (save-excursion | 819 | (save-excursion |
| 820 | (goto-char (car contain-stack)) | 820 | (goto-char (car contain-stack)) |
| 821 | (setq val (calculate-c-indent-after-brace))) | 821 | (setq val (calculate-c-indent-after-brace))) |
| @@ -878,7 +878,7 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 878 | (point)) t) | 878 | (point)) t) |
| 879 | (progn | 879 | (progn |
| 880 | (indent-for-comment) | 880 | (indent-for-comment) |
| 881 | (beginning-of-line))))))))))) | 881 | (beginning-of-line)))))))))) |
| 882 | 882 | ||
| 883 | (defun fill-c++-comment () | 883 | (defun fill-c++-comment () |
| 884 | "Fill a comment contained in consecutive lines containing point. | 884 | "Fill a comment contained in consecutive lines containing point. |
| @@ -941,10 +941,10 @@ The fill lines remain a comment." | |||
| 941 | ;; (defvar c++-match-header-strongly nil | 941 | ;; (defvar c++-match-header-strongly nil |
| 942 | ;; "*If nil, use `c++-defun-header-weak' to identify beginning of definitions. | 942 | ;; "*If nil, use `c++-defun-header-weak' to identify beginning of definitions. |
| 943 | ;; If non-nil, use `c++-defun-header-strong'.") | 943 | ;; If non-nil, use `c++-defun-header-strong'.") |
| 944 | ;; | 944 | ;; |
| 945 | ;; (defvar c++-defun-header-strong-struct-equivs "\\(class\\|struct\\|enum\\)" | 945 | ;; (defvar c++-defun-header-strong-struct-equivs "\\(class\\|struct\\|enum\\)" |
| 946 | ;; "Regexp to match names of structure declaration blocks in C++.") | 946 | ;; "Regexp to match names of structure declaration blocks in C++.") |
| 947 | ;; | 947 | ;; |
| 948 | ;; (defconst c++-defun-header-strong | 948 | ;; (defconst c++-defun-header-strong |
| 949 | ;; (let* | 949 | ;; (let* |
| 950 | ;; (; valid identifiers | 950 | ;; (; valid identifiers |
| @@ -953,12 +953,12 @@ The fill lines remain a comment." | |||
| 953 | ;; ;; to be | 953 | ;; ;; to be |
| 954 | ;; ;; (id "\\(_\\|\\w\\)+") | 954 | ;; ;; (id "\\(_\\|\\w\\)+") |
| 955 | ;; ;; things no longer work right. Try it and see! | 955 | ;; ;; things no longer work right. Try it and see! |
| 956 | ;; | 956 | ;; |
| 957 | ;; ; overloadable operators | 957 | ;; ; overloadable operators |
| 958 | ;; (op-sym1 | 958 | ;; (op-sym1 |
| 959 | ;; "[-+*/%^&|~!=<>]\\|[-+*/%^&|<>=!]=\\|<<=?\\|>>=?") | 959 | ;; "[-+*/%^&|~!=<>]\\|[-+*/%^&|<>=!]=\\|<<=?\\|>>=?") |
| 960 | ;; (op-sym2 | 960 | ;; (op-sym2 |
| 961 | ;; "&&\\|||\\|\\+\\+\\|--\\|()\\|\\[\\]") | 961 | ;; "&&\\|||\\|\\+\\+\\|--\\|()\\|\\[\\]") |
| 962 | ;; (op-sym (concat "\\(" op-sym1 "\\|" op-sym2 "\\)")) | 962 | ;; (op-sym (concat "\\(" op-sym1 "\\|" op-sym2 "\\)")) |
| 963 | ;; ; whitespace | 963 | ;; ; whitespace |
| 964 | ;; (middle "[^\\*]*\\(\\*+[^/\\*][^\\*]*\\)*") | 964 | ;; (middle "[^\\*]*\\(\\*+[^/\\*][^\\*]*\\)*") |
| @@ -993,20 +993,20 @@ The fill lines remain a comment." | |||
| 993 | ;; wh-nec id wh-opt inherit "?" wh-opt "{"))) | 993 | ;; wh-nec id wh-opt inherit "?" wh-opt "{"))) |
| 994 | ;; (concat "^\\(" func-header "\\|" cs-header "\\)")) | 994 | ;; (concat "^\\(" func-header "\\|" cs-header "\\)")) |
| 995 | ;; "Strongly-defined regexp to match beginning of structure or function def.") | 995 | ;; "Strongly-defined regexp to match beginning of structure or function def.") |
| 996 | ;; | 996 | ;; |
| 997 | ;; | 997 | ;; |
| 998 | ;; ;; This part has to do with recognizing defuns. | 998 | ;; ;; This part has to do with recognizing defuns. |
| 999 | ;; | 999 | ;; |
| 1000 | ;; ;; The weak convention we will use is that a defun begins any time | 1000 | ;; ;; The weak convention we will use is that a defun begins any time |
| 1001 | ;; ;; there is a left curly brace, or some identifier on the left margin, | 1001 | ;; ;; there is a left curly brace, or some identifier on the left margin, |
| 1002 | ;; ;; followed by a left curly somewhere on the line. (This will also | 1002 | ;; ;; followed by a left curly somewhere on the line. (This will also |
| 1003 | ;; ;; incorrectly match some continued strings, but this is after all | 1003 | ;; ;; incorrectly match some continued strings, but this is after all |
| 1004 | ;; ;; just a weak heuristic.) Suggestions for improvement (short of the | 1004 | ;; ;; just a weak heuristic.) Suggestions for improvement (short of the |
| 1005 | ;; ;; strong scheme shown above) are welcomed. | 1005 | ;; ;; strong scheme shown above) are welcomed. |
| 1006 | ;; | 1006 | ;; |
| 1007 | ;; (defconst c++-defun-header-weak "^{\\|^[_a-zA-Z].*{" | 1007 | ;; (defconst c++-defun-header-weak "^{\\|^[_a-zA-Z].*{" |
| 1008 | ;; "Weakly-defined regexp to match beginning of structure or function def.") | 1008 | ;; "Weakly-defined regexp to match beginning of structure or function def.") |
| 1009 | ;; | 1009 | ;; |
| 1010 | ;; (defun c++-beginning-of-defun (arg) | 1010 | ;; (defun c++-beginning-of-defun (arg) |
| 1011 | ;; (interactive "p") | 1011 | ;; (interactive "p") |
| 1012 | ;; (let ((c++-defun-header (if c++-match-header-strongly | 1012 | ;; (let ((c++-defun-header (if c++-match-header-strongly |
| @@ -1033,8 +1033,8 @@ The fill lines remain a comment." | |||
| 1033 | ;; (forward-char (if (< arg 0) 1 -1))) | 1033 | ;; (forward-char (if (< arg 0) 1 -1))) |
| 1034 | ;; (and (re-search-backward c++-defun-header nil 'move (or arg 1)) | 1034 | ;; (and (re-search-backward c++-defun-header nil 'move (or arg 1)) |
| 1035 | ;; (goto-char (match-beginning 0))))))) | 1035 | ;; (goto-char (match-beginning 0))))))) |
| 1036 | ;; | 1036 | ;; |
| 1037 | ;; | 1037 | ;; |
| 1038 | ;; (defun c++-end-of-defun (arg) | 1038 | ;; (defun c++-end-of-defun (arg) |
| 1039 | ;; (interactive "p") | 1039 | ;; (interactive "p") |
| 1040 | ;; (let ((c++-defun-header (if c++-match-header-strongly | 1040 | ;; (let ((c++-defun-header (if c++-match-header-strongly |
| @@ -1044,7 +1044,7 @@ The fill lines remain a comment." | |||
| 1044 | ;; nil | 1044 | ;; nil |
| 1045 | ;; (if (and (> arg 0) (looking-at c++-defun-header)) (forward-char 1)) | 1045 | ;; (if (and (> arg 0) (looking-at c++-defun-header)) (forward-char 1)) |
| 1046 | ;; (let ((pos (point))) | 1046 | ;; (let ((pos (point))) |
| 1047 | ;; (c++-beginning-of-defun | 1047 | ;; (c++-beginning-of-defun |
| 1048 | ;; (if (< arg 0) | 1048 | ;; (if (< arg 0) |
| 1049 | ;; (- (- arg (if (eobp) 0 1))) | 1049 | ;; (- (- arg (if (eobp) 0 1))) |
| 1050 | ;; arg)) | 1050 | ;; arg)) |
| @@ -1054,11 +1054,11 @@ The fill lines remain a comment." | |||
| 1054 | ;; (progn (forward-char -1) | 1054 | ;; (progn (forward-char -1) |
| 1055 | ;; (forward-sexp) | 1055 | ;; (forward-sexp) |
| 1056 | ;; (beginning-of-line 2))) | 1056 | ;; (beginning-of-line 2))) |
| 1057 | ;; (if (and (= pos (point)) | 1057 | ;; (if (and (= pos (point)) |
| 1058 | ;; (re-search-forward c++-defun-header nil 'move)) | 1058 | ;; (re-search-forward c++-defun-header nil 'move)) |
| 1059 | ;; (c++-end-of-defun 1)))) | 1059 | ;; (c++-end-of-defun 1)))) |
| 1060 | ;; t))) | 1060 | ;; t))) |
| 1061 | ;; | 1061 | ;; |
| 1062 | ;; (defun c++-indent-defun () | 1062 | ;; (defun c++-indent-defun () |
| 1063 | ;; "Indents the current function definition, struct or class declaration." | 1063 | ;; "Indents the current function definition, struct or class declaration." |
| 1064 | ;; (interactive) | 1064 | ;; (interactive) |