diff options
| author | Alan Mackenzie | 2007-01-01 22:11:28 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2007-01-01 22:11:28 +0000 |
| commit | 51c9af45fee2a756cacbbcdb0628db558ca342e5 (patch) | |
| tree | 5fefce5428785a69a53b15dd8f904cb7af2c473c | |
| parent | d8a4fc444aae4582e22a2bd674d58c230a516b10 (diff) | |
| download | emacs-51c9af45fee2a756cacbbcdb0628db558ca342e5.tar.gz emacs-51c9af45fee2a756cacbbcdb0628db558ca342e5.zip | |
Update CC Mode to version 5.31.4. The detailed changes are those
recorded in the ChangeLog for 2007-01-01.
| -rw-r--r-- | lisp/progmodes/cc-align.el | 23 | ||||
| -rw-r--r-- | lisp/progmodes/cc-awk.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 613 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 319 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 25 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 9 | ||||
| -rw-r--r-- | lisp/progmodes/cc-styles.el | 5 | ||||
| -rw-r--r-- | lisp/progmodes/cc-vars.el | 11 |
9 files changed, 670 insertions, 345 deletions
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 9c2427a71af..847e43a46b7 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -90,6 +90,29 @@ Works with: topmost-intro-cont." | |||
| 90 | (c-after-special-operator-id)))) | 90 | (c-after-special-operator-id)))) |
| 91 | c-basic-offset))) | 91 | c-basic-offset))) |
| 92 | 92 | ||
| 93 | (defun c-lineup-gnu-DEFUN-intro-cont (langelem) | ||
| 94 | "Line up the continuation lines of a DEFUN macro in the Emacs C source. | ||
| 95 | These lines are indented as though they were `knr-argdecl-intro' lines. | ||
| 96 | Return nil when we're not in such a construct. | ||
| 97 | |||
| 98 | This function is for historical compatibility with how previous CC Modes (5.28 | ||
| 99 | and earlier) indented such lines. | ||
| 100 | |||
| 101 | Here is an example: | ||
| 102 | |||
| 103 | DEFUN (\"forward-char\", Fforward_char, Sforward_char, 0, 1, \"p\", | ||
| 104 | doc: /* Move point right N characters (left if N is negative). | ||
| 105 | On reaching end of buffer, stop and signal error. */) | ||
| 106 | (n) <- c-lineup-gnu-DEFUN-into-cont | ||
| 107 | Lisp_Object n; <- c-lineup-gnu-DEFUN-into-cont | ||
| 108 | |||
| 109 | Works with: topmost-intro-cont." | ||
| 110 | (save-excursion | ||
| 111 | (let (case-fold-search) | ||
| 112 | (goto-char (c-langelem-pos langelem)) | ||
| 113 | (if (looking-at "\\<DEFUN\\>") | ||
| 114 | (c-calc-offset '(knr-argdecl-intro)))))) | ||
| 115 | |||
| 93 | (defun c-block-in-arglist-dwim (arglist-start) | 116 | (defun c-block-in-arglist-dwim (arglist-start) |
| 94 | ;; This function implements the DWIM to avoid far indentation of | 117 | ;; This function implements the DWIM to avoid far indentation of |
| 95 | ;; brace block constructs in arguments in `c-lineup-arglist' etc. | 118 | ;; brace block constructs in arguments in `c-lineup-arglist' etc. |
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index e2fcbd8d06b..bc745873638 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el | |||
| @@ -720,7 +720,7 @@ | |||
| 720 | (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t)) | 720 | (not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t)) |
| 721 | (search-forward-regexp c-awk-div-sign-re (1+ /point) t)) | 721 | (search-forward-regexp c-awk-div-sign-re (1+ /point) t)) |
| 722 | ;; A division sign. | 722 | ;; A division sign. |
| 723 | (progn (goto-char (1+ /point)) nil) | 723 | (progn (goto-char (1+ /point)) nil) |
| 724 | ;; A regexp opener | 724 | ;; A regexp opener |
| 725 | ;; Jump over the regexp innards, setting the match data. | 725 | ;; Jump over the regexp innards, setting the match data. |
| 726 | (goto-char /point) | 726 | (goto-char /point) |
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 1c266e8a5de..063cfe89777 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | (cc-bytecomp-defun c-forward-subword) | 53 | (cc-bytecomp-defun c-forward-subword) |
| 54 | (cc-bytecomp-defun c-backward-subword) | 54 | (cc-bytecomp-defun c-backward-subword) |
| 55 | 55 | ||
| 56 | ;; Indentation / Display syntax functions | ||
| 56 | (defvar c-fix-backslashes t) | 57 | (defvar c-fix-backslashes t) |
| 57 | 58 | ||
| 58 | (defun c-indent-line (&optional syntax quiet ignore-point-pos) | 59 | (defun c-indent-line (&optional syntax quiet ignore-point-pos) |
| @@ -252,6 +253,7 @@ With universal argument, inserts the analysis as a comment on that line." | |||
| 252 | (forward-line))))) | 253 | (forward-line))))) |
| 253 | 254 | ||
| 254 | 255 | ||
| 256 | ;; Minor mode functions. | ||
| 255 | (defun c-update-modeline () | 257 | (defun c-update-modeline () |
| 256 | (let ((fmt (format "/%s%s%s%s" | 258 | (let ((fmt (format "/%s%s%s%s" |
| 257 | (if c-electric-flag "l" "") | 259 | (if c-electric-flag "l" "") |
| @@ -843,13 +845,17 @@ is inhibited." | |||
| 843 | (eq literal 'c) | 845 | (eq literal 'c) |
| 844 | (memq 'comment-close-slash c-cleanup-list) | 846 | (memq 'comment-close-slash c-cleanup-list) |
| 845 | (eq last-command-char ?/) | 847 | (eq last-command-char ?/) |
| 848 | (looking-at (concat "[ \t]*\\(" | ||
| 849 | (regexp-quote comment-end) "\\)?$")) | ||
| 846 | ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */ | 850 | ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */ |
| 847 | (save-excursion | 851 | (save-excursion |
| 848 | (back-to-indentation) | 852 | (save-restriction |
| 849 | (looking-at (concat c-current-comment-prefix "[ \t]*$")))) | 853 | (narrow-to-region (point-min) (point)) |
| 850 | (end-of-line) | 854 | (back-to-indentation) |
| 851 | (delete-horizontal-space) | 855 | (looking-at (concat c-current-comment-prefix "[ \t]*$"))))) |
| 852 | (or (eq (char-before) ?*) (insert-char ?* 1))) ; Do I need a t (retain sticky properties) here? | 856 | (kill-region (progn (forward-line 0) (point)) |
| 857 | (progn (end-of-line) (point))) | ||
| 858 | (insert-char ?* 1)) ; the / comes later. ; Do I need a t (retain sticky properties) here? | ||
| 853 | 859 | ||
| 854 | (setq indentp (and (not arg) | 860 | (setq indentp (and (not arg) |
| 855 | c-syntactic-indentation | 861 | c-syntactic-indentation |
| @@ -1253,7 +1259,11 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'." | |||
| 1253 | (backward-char) | 1259 | (backward-char) |
| 1254 | (skip-chars-backward " \t") | 1260 | (skip-chars-backward " \t") |
| 1255 | (setq beg (point)) | 1261 | (setq beg (point)) |
| 1256 | (c-save-buffer-state () (c-on-identifier)))) | 1262 | (c-save-buffer-state () (c-on-identifier)) |
| 1263 | ;; Don't add a space into #define FOO().... | ||
| 1264 | (not (and (c-beginning-of-macro) | ||
| 1265 | (c-forward-over-cpp-define-id) | ||
| 1266 | (eq (point) beg))))) | ||
| 1257 | (save-excursion | 1267 | (save-excursion |
| 1258 | (delete-region beg end) | 1268 | (delete-region beg end) |
| 1259 | (goto-char beg) | 1269 | (goto-char beg) |
| @@ -1308,6 +1318,7 @@ keyword on the line, the keyword is not inserted inside a literal, and | |||
| 1308 | (delete-char -2))))) | 1318 | (delete-char -2))))) |
| 1309 | 1319 | ||
| 1310 | 1320 | ||
| 1321 | ;; "nomenclature" functions + c-scope-operator. | ||
| 1311 | (defun c-forward-into-nomenclature (&optional arg) | 1322 | (defun c-forward-into-nomenclature (&optional arg) |
| 1312 | "Compatibility alias for `c-forward-subword'." | 1323 | "Compatibility alias for `c-forward-subword'." |
| 1313 | (interactive "p") | 1324 | (interactive "p") |
| @@ -1328,6 +1339,160 @@ No indentation or other \"electric\" behavior is performed." | |||
| 1328 | (interactive "*") | 1339 | (interactive "*") |
| 1329 | (insert-and-inherit "::")) | 1340 | (insert-and-inherit "::")) |
| 1330 | 1341 | ||
| 1342 | |||
| 1343 | ;; Movement (etc.) by defuns. | ||
| 1344 | (defun c-in-function-trailer-p (&optional lim) | ||
| 1345 | ;; Return non-nil if point is between the closing brace and the semicolon of | ||
| 1346 | ;; a brace construct which needs a semicolon, e.g. within the "variables" | ||
| 1347 | ;; portion of a declaration like "struct foo {...} bar ;". | ||
| 1348 | ;; | ||
| 1349 | ;; Return the position of the main declaration. Otherwise, return nil. | ||
| 1350 | ;; Point is assumed to be at the top level and outside of any macro or | ||
| 1351 | ;; literal. | ||
| 1352 | ;; | ||
| 1353 | ;; If LIM is non-nil, it is the bound on a the backward search for the | ||
| 1354 | ;; beginning of the declaration. | ||
| 1355 | ;; | ||
| 1356 | ;; This function might do hidden buffer changes. | ||
| 1357 | (and c-opt-block-decls-with-vars-key | ||
| 1358 | (save-excursion | ||
| 1359 | (c-syntactic-skip-backward "^;}" lim) | ||
| 1360 | (and (eq (char-before) ?\}) | ||
| 1361 | (eq (car (c-beginning-of-decl-1 lim)) 'previous) | ||
| 1362 | (looking-at c-opt-block-decls-with-vars-key) | ||
| 1363 | (point))))) | ||
| 1364 | |||
| 1365 | (defun c-where-wrt-brace-construct () | ||
| 1366 | ;; Determine where we are with respect to functions (or other brace | ||
| 1367 | ;; constructs, included in the term "function" in the rest of this comment). | ||
| 1368 | ;; Point is assumed to be outside any macro or literal. | ||
| 1369 | ;; This is used by c-\(begining\|end\)-of-defun. | ||
| 1370 | ;; | ||
| 1371 | ;; Return one of these symbols: | ||
| 1372 | ;; at-header : we're at the start of a function's header. | ||
| 1373 | ;; in-header : we're inside a function's header, this extending right | ||
| 1374 | ;; up to the brace. This bit includes any k&r declarations. | ||
| 1375 | ;; in-block : we're inside a function's brace block. | ||
| 1376 | ;; in-trailer : we're in the area between the "}" and ";" of something | ||
| 1377 | ;; like "struct foo {...} bar, baz;". | ||
| 1378 | ;; at-function-end : we're just after the closing brace (or semicolon) that | ||
| 1379 | ;; terminates the function. | ||
| 1380 | ;; outwith-function: we're not at or in any function. Being inside a | ||
| 1381 | ;; non-brace construct also counts as 'outwith-function'. | ||
| 1382 | ;; | ||
| 1383 | ;; This function might do hidden buffer changes. | ||
| 1384 | (save-excursion | ||
| 1385 | (let* (pos | ||
| 1386 | kluge-start | ||
| 1387 | decl-result brace-decl-p | ||
| 1388 | (start (point)) | ||
| 1389 | (paren-state (c-parse-state)) | ||
| 1390 | (least-enclosing (c-least-enclosing-brace paren-state))) | ||
| 1391 | |||
| 1392 | (cond | ||
| 1393 | ((and least-enclosing | ||
| 1394 | (eq (char-after least-enclosing) ?\{)) | ||
| 1395 | 'in-block) | ||
| 1396 | ((c-in-function-trailer-p) | ||
| 1397 | 'in-trailer) | ||
| 1398 | ((and (not least-enclosing) | ||
| 1399 | (consp paren-state) | ||
| 1400 | (consp (car paren-state)) | ||
| 1401 | (eq start (cdar paren-state))) | ||
| 1402 | 'at-function-end) | ||
| 1403 | (t | ||
| 1404 | ;; Find the start of the current declaration. NOTE: If we're in the | ||
| 1405 | ;; variables after a "struct/eval" type block, we don't get to the | ||
| 1406 | ;; real declaration here - we detect and correct for this later. | ||
| 1407 | |||
| 1408 | ;;If we're in the parameters' parens, move back out of them. | ||
| 1409 | (if least-enclosing (goto-char least-enclosing)) | ||
| 1410 | ;; Kluge so that c-beginning-of-decl-1 won't go back if we're already | ||
| 1411 | ;; at a declaration. | ||
| 1412 | (if (or (and (eolp) (not (eobp))) ; EOL is matched by "\\s>" | ||
| 1413 | (not (looking-at | ||
| 1414 | "\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)"))) | ||
| 1415 | (forward-char)) | ||
| 1416 | (setq kluge-start (point)) | ||
| 1417 | (setq decl-result | ||
| 1418 | (car (c-beginning-of-decl-1 | ||
| 1419 | (and least-enclosing ; LIMIT for c-b-of-decl-1 | ||
| 1420 | (c-safe-position least-enclosing paren-state))))) | ||
| 1421 | |||
| 1422 | ;; Has the declaration we've gone back to got braces? | ||
| 1423 | (setq pos (point)) ; the search limit for c-recognize-knr-p | ||
| 1424 | (setq brace-decl-p | ||
| 1425 | (save-excursion | ||
| 1426 | (and (c-syntactic-re-search-forward "[;{]" nil t t) | ||
| 1427 | (or (eq (char-before) ?\{) | ||
| 1428 | (and c-recognize-knr-p | ||
| 1429 | ;; Might have stopped on the | ||
| 1430 | ;; ';' in a K&R argdecl. In | ||
| 1431 | ;; that case the declaration | ||
| 1432 | ;; should contain a block. | ||
| 1433 | (c-in-knr-argdecl pos)))))) | ||
| 1434 | |||
| 1435 | (cond | ||
| 1436 | ((= (point) kluge-start) ; might be BOB or unbalanced parens. | ||
| 1437 | 'outwith-function) | ||
| 1438 | ((eq decl-result 'same) | ||
| 1439 | (if brace-decl-p | ||
| 1440 | (if (eq (point) start) | ||
| 1441 | 'at-header | ||
| 1442 | 'in-header) | ||
| 1443 | 'outwith-function)) | ||
| 1444 | ((eq decl-result 'previous) | ||
| 1445 | (if (and (not brace-decl-p) | ||
| 1446 | (c-in-function-trailer-p)) | ||
| 1447 | 'at-function-end | ||
| 1448 | 'outwith-function)) | ||
| 1449 | (t (error | ||
| 1450 | "c-where-wrt-brace-construct: c-beginning-of-decl-1 returned %s" | ||
| 1451 | decl-result)))))))) | ||
| 1452 | |||
| 1453 | (defun c-backward-to-nth-BOF-{ (n where) | ||
| 1454 | ;; Skip to the opening brace of the Nth function before point. If | ||
| 1455 | ;; point is inside a function, this counts as the first. Point must be | ||
| 1456 | ;; outside any comment/string or macro. | ||
| 1457 | ;; | ||
| 1458 | ;; N must be strictly positive. | ||
| 1459 | ;; WHERE describes the position of point, one of the symbols `at-header', | ||
| 1460 | ;; `in-header', `in-block', `in-trailer', `at-function-end', | ||
| 1461 | ;; `outwith-function' as returned by c-where-wrt-brace-construct. | ||
| 1462 | ;; | ||
| 1463 | ;; If we run out of functions, leave point at BOB. Return zero on success, | ||
| 1464 | ;; otherwise the number of {s still to go. | ||
| 1465 | ;; | ||
| 1466 | ;; This function may do hidden buffer changes | ||
| 1467 | (cond | ||
| 1468 | ;; What we do to go back the first defun depends on where we start. | ||
| 1469 | ((bobp)) | ||
| 1470 | ((eq where 'in-block) | ||
| 1471 | (goto-char (c-least-enclosing-brace (c-parse-state))) | ||
| 1472 | (setq n (1- n))) | ||
| 1473 | ((eq where 'in-header) | ||
| 1474 | (c-syntactic-re-search-forward "{") | ||
| 1475 | (backward-char) | ||
| 1476 | (setq n (1- n))) | ||
| 1477 | (;; (or (eq where 'at-header) (eq where 'outwith-function) | ||
| 1478 | ;; (eq where 'at-function-end) (eq where 'in-trailer)) | ||
| 1479 | (memq where '(at-header outwith-function at-function-end in-trailer)) | ||
| 1480 | (c-syntactic-skip-backward "^}") | ||
| 1481 | (when (eq (char-before) ?\}) | ||
| 1482 | (backward-sexp) | ||
| 1483 | (setq n (1- n)))) | ||
| 1484 | (t (error "Unknown `where' %s in c-backward-to-nth-EOF-{" where))) | ||
| 1485 | |||
| 1486 | ;; Each time round the loop, go back to a "{" at the outermost level. | ||
| 1487 | (while (and (> n 0) (not (bobp))) | ||
| 1488 | (c-parse-state) ; This call speeds up the following one | ||
| 1489 | ; by a factor of ~6. Hmmm. 2006/4/5. | ||
| 1490 | (c-syntactic-skip-backward "^}") | ||
| 1491 | (when (eq (char-before) ?\}) | ||
| 1492 | (backward-sexp) | ||
| 1493 | (setq n (1- n)))) | ||
| 1494 | n) | ||
| 1495 | |||
| 1331 | (defun c-beginning-of-defun (&optional arg) | 1496 | (defun c-beginning-of-defun (&optional arg) |
| 1332 | "Move backward to the beginning of a defun. | 1497 | "Move backward to the beginning of a defun. |
| 1333 | Every top level declaration that contains a brace paren block is | 1498 | Every top level declaration that contains a brace paren block is |
| @@ -1344,88 +1509,99 @@ defun." | |||
| 1344 | (interactive "p") | 1509 | (interactive "p") |
| 1345 | (or arg (setq arg 1)) | 1510 | (or arg (setq arg 1)) |
| 1346 | 1511 | ||
| 1347 | (if (< arg 0) | 1512 | (c-save-buffer-state |
| 1348 | (when (c-end-of-defun (- arg)) | 1513 | ((start (point)) |
| 1349 | (c-save-buffer-state nil (c-forward-syntactic-ws)) | 1514 | where paren-state pos) |
| 1350 | t) | ||
| 1351 | |||
| 1352 | (c-save-buffer-state (paren-state lim pos) | ||
| 1353 | (catch 'exit | ||
| 1354 | (while (> arg 0) | ||
| 1355 | ;; Note: Partial code duplication in `c-end-of-defun' and | ||
| 1356 | ;; `c-declaration-limits'. | ||
| 1357 | |||
| 1358 | (setq paren-state (c-parse-state)) | ||
| 1359 | (unless (c-safe | ||
| 1360 | (goto-char (c-least-enclosing-brace paren-state)) | ||
| 1361 | ;; If we moved to the outermost enclosing paren | ||
| 1362 | ;; then we can use c-safe-position to set the | ||
| 1363 | ;; limit. Can't do that otherwise since the | ||
| 1364 | ;; earlier paren pair on paren-state might very | ||
| 1365 | ;; well be part of the declaration we should go | ||
| 1366 | ;; to. | ||
| 1367 | (setq lim (c-safe-position (point) paren-state)) | ||
| 1368 | t) | ||
| 1369 | ;; At top level. Make sure we aren't inside a literal. | ||
| 1370 | (setq pos (c-literal-limits | ||
| 1371 | (c-safe-position (point) paren-state))) | ||
| 1372 | (if pos (goto-char (car pos)))) | ||
| 1373 | |||
| 1374 | (while (let ((start (point))) | ||
| 1375 | (c-beginning-of-decl-1 lim) | ||
| 1376 | (if (= (point) start) | ||
| 1377 | ;; Didn't move. Might be due to bob or unbalanced | ||
| 1378 | ;; parens. Try to continue if it's the latter. | ||
| 1379 | (unless (c-safe (goto-char | ||
| 1380 | (c-down-list-backward (point)))) | ||
| 1381 | ;; Didn't work, so it's bob then. | ||
| 1382 | (goto-char (point-min)) | ||
| 1383 | (throw 'exit nil))) | ||
| 1384 | 1515 | ||
| 1385 | (save-excursion | 1516 | ;; Move back out of any macro/comment/string we happen to be in. |
| 1386 | ;; Check if the declaration contains a brace | 1517 | (c-beginning-of-macro) |
| 1387 | ;; block. If not, we try another one. | 1518 | (setq pos (c-literal-limits)) |
| 1388 | (setq pos (point)) | 1519 | (if pos (goto-char (car pos))) |
| 1389 | (not (and (c-syntactic-re-search-forward "[;{]" nil t t) | 1520 | |
| 1390 | (or (eq (char-before) ?{) | 1521 | (setq where (c-where-wrt-brace-construct)) |
| 1391 | (and c-recognize-knr-p | 1522 | |
| 1392 | ;; Might have stopped on the | 1523 | (if (< arg 0) |
| 1393 | ;; ';' in a K&R argdecl. In | 1524 | ;; Move forward to the closing brace of a function. |
| 1394 | ;; that case the declaration | 1525 | (progn |
| 1395 | ;; should contain a block. | 1526 | (if ;; (or (eq where 'at-function-end) (eq where 'outwith-function)) |
| 1396 | (c-in-knr-argdecl pos))))))) | 1527 | (memq where '(at-function-end outwith-function)) |
| 1397 | (setq lim nil)) | 1528 | (setq arg (1+ arg))) |
| 1398 | 1529 | (if (< arg 0) | |
| 1399 | ;; Check if `c-beginning-of-decl-1' put us after the block | 1530 | (setq arg (c-forward-to-nth-EOF-} (- arg) where))) |
| 1400 | ;; in a declaration that doesn't end there. We're searching | 1531 | ;; Move forward to the next opening brace.... |
| 1401 | ;; back and forth over the block here, which can be | 1532 | (when (and (= arg 0) |
| 1402 | ;; expensive. | 1533 | (c-syntactic-re-search-forward "{" nil t)) |
| 1403 | (setq pos (point)) | 1534 | (backward-char) |
| 1404 | (if (and c-opt-block-decls-with-vars-key | 1535 | ;; ... and backward to the function header. |
| 1405 | (progn | 1536 | (c-beginning-of-decl-1) |
| 1406 | (c-backward-syntactic-ws) | 1537 | t)) |
| 1407 | (eq (char-before) ?})) | 1538 | |
| 1408 | (eq (car (c-beginning-of-decl-1)) | 1539 | ;; Move backward to the opening brace of a function. |
| 1409 | 'previous) | 1540 | (when (and (> arg 0) |
| 1410 | (save-excursion | 1541 | (eq (setq arg (c-backward-to-nth-BOF-{ arg where)) 0)) |
| 1411 | (c-end-of-decl-1) | 1542 | |
| 1412 | (> (point) pos))) | 1543 | ;; Go backward to this function's header. |
| 1413 | nil | 1544 | (c-beginning-of-decl-1) |
| 1414 | (goto-char pos)) | 1545 | |
| 1415 | 1546 | (setq pos (point)) | |
| 1416 | (setq pos (point)) | 1547 | ;; We're now there, modulo comments and whitespace. |
| 1417 | ;; Try to be line oriented; position point at the closest | 1548 | ;; Try to be line oriented; position point at the closest |
| 1418 | ;; preceding boi that isn't inside a comment, but if we hit | 1549 | ;; preceding boi that isn't inside a comment, but if we hit |
| 1419 | ;; the previous declaration then we use the current point | 1550 | ;; the previous declaration then we use the current point |
| 1420 | ;; instead. | 1551 | ;; instead. |
| 1421 | (while (and (/= (point) (c-point 'boi)) | 1552 | (while (and (/= (point) (c-point 'boi)) |
| 1422 | (c-backward-single-comment))) | 1553 | (c-backward-single-comment))) |
| 1423 | (if (/= (point) (c-point 'boi)) | 1554 | (if (/= (point) (c-point 'boi)) |
| 1424 | (goto-char pos)) | 1555 | (goto-char pos))) |
| 1425 | 1556 | ||
| 1426 | (setq arg (1- arg))))) | 1557 | (c-keep-region-active) |
| 1427 | (c-keep-region-active) | 1558 | (= arg 0)))) |
| 1428 | (= arg 0))) | 1559 | |
| 1560 | (defun c-forward-to-nth-EOF-} (n where) | ||
| 1561 | ;; Skip to the closing brace of the Nth function after point. If | ||
| 1562 | ;; point is inside a function, this counts as the first. Point must be | ||
| 1563 | ;; outside any comment/string or macro. | ||
| 1564 | ;; | ||
| 1565 | ;; N must be strictly positive. | ||
| 1566 | ;; WHERE describes the position of point, one of the symbols `at-header', | ||
| 1567 | ;; `in-header', `in-block', `in-trailer', `at-function-end', | ||
| 1568 | ;; `outwith-function' as returned by c-where-wrt-brace-construct. | ||
| 1569 | ;; | ||
| 1570 | ;; If we run out of functions, leave point at EOB. Return zero on success, | ||
| 1571 | ;; otherwise the number of }s still to go. | ||
| 1572 | ;; | ||
| 1573 | ;; This function may do hidden buffer changes. | ||
| 1574 | |||
| 1575 | (cond | ||
| 1576 | ;; What we do to go forward over the first defun depends on where we | ||
| 1577 | ;; start. We go to the closing brace of that defun, even when we go | ||
| 1578 | ;; backwards to it (in a "struct foo {...} bar ;"). | ||
| 1579 | ((eobp)) | ||
| 1580 | ((eq where 'in-block) | ||
| 1581 | (goto-char (c-least-enclosing-brace (c-parse-state))) | ||
| 1582 | (forward-sexp) | ||
| 1583 | (setq n (1- n))) | ||
| 1584 | ((eq where 'in-trailer) | ||
| 1585 | (c-syntactic-skip-backward "^}") | ||
| 1586 | (setq n (1- n))) | ||
| 1587 | (;; (or (eq where 'at-function-end) (eq where 'outwith-function) | ||
| 1588 | ;; (eq where 'at-header) (eq where 'in-header)) | ||
| 1589 | (memq where '(at-function-end outwith-function at-header in-header)) | ||
| 1590 | (c-syntactic-re-search-forward "{") | ||
| 1591 | (backward-char) | ||
| 1592 | (forward-sexp) | ||
| 1593 | (setq n (1- n))) | ||
| 1594 | (t (error "c-forward-to-nth-EOF-}: `where' is %s" where))) | ||
| 1595 | |||
| 1596 | ;; Each time round the loop, go forward to a "}" at the outermost level. | ||
| 1597 | (while (and (> n 0) (not (eobp))) | ||
| 1598 | ;(c-parse-state) ; This call speeds up the following one by a factor | ||
| 1599 | ; of ~6. Hmmm. 2006/4/5. | ||
| 1600 | (when (c-syntactic-re-search-forward "{" nil 'eob) | ||
| 1601 | (backward-char) | ||
| 1602 | (forward-sexp)) | ||
| 1603 | (setq n (1- n))) | ||
| 1604 | n) | ||
| 1429 | 1605 | ||
| 1430 | (defun c-end-of-defun (&optional arg) | 1606 | (defun c-end-of-defun (&optional arg) |
| 1431 | "Move forward to the end of a top level declaration. | 1607 | "Move forward to the end of a top level declaration. |
| @@ -1435,82 +1611,56 @@ beginning or end of buffer. | |||
| 1435 | 1611 | ||
| 1436 | An end of a defun occurs right after the close-parenthesis that matches | 1612 | An end of a defun occurs right after the close-parenthesis that matches |
| 1437 | the open-parenthesis that starts a defun; see `beginning-of-defun'." | 1613 | the open-parenthesis that starts a defun; see `beginning-of-defun'." |
| 1438 | |||
| 1439 | (interactive "p") | 1614 | (interactive "p") |
| 1440 | (or arg (setq arg 1)) | 1615 | (or arg (setq arg 1)) |
| 1441 | 1616 | ||
| 1442 | (if (< arg 0) | 1617 | (c-save-buffer-state |
| 1443 | (when (c-beginning-of-defun (- arg)) | 1618 | ((start (point)) |
| 1444 | (c-save-buffer-state nil (c-backward-syntactic-ws)) | 1619 | where paren-state pos) |
| 1445 | t) | 1620 | |
| 1446 | 1621 | ;; Move back out of any macro/comment/string we happen to be in. | |
| 1447 | (c-save-buffer-state (paren-state lim pos) | 1622 | (c-beginning-of-macro) |
| 1448 | (catch 'exit | 1623 | (setq pos (c-literal-limits)) |
| 1449 | (while (> arg 0) | 1624 | (if pos (goto-char (car pos))) |
| 1450 | ;; Note: Partial code duplication in `c-beginning-of-defun' | 1625 | |
| 1451 | ;; and `c-declaration-limits'. | 1626 | (setq where (c-where-wrt-brace-construct)) |
| 1452 | 1627 | ||
| 1453 | (setq paren-state (c-parse-state)) | 1628 | (if (< arg 0) |
| 1454 | (unless (c-safe | 1629 | ;; Move backwards to the } of a function |
| 1455 | (goto-char (c-least-enclosing-brace paren-state)) | 1630 | (progn |
| 1456 | ;; If we moved to the outermost enclosing paren | 1631 | (if ;; (or (eq where 'at-header) (eq where 'outwith-function)) |
| 1457 | ;; then we can use c-safe-position to set the | 1632 | (memq where '(at-header outwith-function)) |
| 1458 | ;; limit. Can't do that otherwise since the | 1633 | (setq arg (1+ arg))) |
| 1459 | ;; earlier paren pair on paren-state might very | 1634 | (if (< arg 0) |
| 1460 | ;; well be part of the declaration we should go | 1635 | (setq arg (c-backward-to-nth-BOF-{ (- arg) where))) |
| 1461 | ;; to. | 1636 | (when (and (= arg 0) |
| 1462 | (setq lim (c-safe-position (point) paren-state)) | 1637 | (c-syntactic-skip-backward "^}") |
| 1463 | t) | 1638 | (eq (char-before) ?\})) |
| 1464 | ;; At top level. Make sure we aren't inside a literal. | 1639 | t)) |
| 1465 | (setq pos (car-safe (c-literal-limits | 1640 | |
| 1466 | (c-safe-position (point) paren-state)))) | 1641 | ;; Move forward to the } of a function |
| 1467 | (if pos (goto-char pos))) | 1642 | (if (> arg 0) |
| 1468 | 1643 | (setq arg (c-forward-to-nth-EOF-} arg where)))) | |
| 1469 | ;; Have to move to the start first so that `c-end-of-decl-1' | 1644 | |
| 1470 | ;; has the correct start position. | 1645 | ;; Do we need to move forward from the brace to the semicolon? |
| 1471 | (setq pos (point)) | 1646 | (when (eq arg 0) |
| 1472 | (when (memq (car (c-beginning-of-decl-1 lim)) | 1647 | (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. |
| 1473 | '(previous macro)) | 1648 | (c-syntactic-re-search-forward ";")) |
| 1474 | ;; We moved back over the previous defun or a macro. Move | 1649 | |
| 1475 | ;; to the next token; it's the start of the next | 1650 | (setq pos (point)) |
| 1476 | ;; declaration. We can also be directly after the block | 1651 | ;; We're there now, modulo comments and whitespace. |
| 1477 | ;; in a `c-opt-block-decls-with-vars-key' declaration, but | 1652 | ;; Try to be line oriented; position point after the next |
| 1478 | ;; then we won't move significantly far here. | 1653 | ;; newline that isn't inside a comment, but if we hit the |
| 1479 | (goto-char pos) | 1654 | ;; next declaration then we use the current point instead. |
| 1480 | (c-forward-token-2 0)) | 1655 | (while (and (not (bolp)) |
| 1481 | 1656 | (not (looking-at "\\s *$")) | |
| 1482 | (while (let ((start (point))) | 1657 | (c-forward-single-comment))) |
| 1483 | (c-end-of-decl-1) | 1658 | (cond ((bolp)) |
| 1484 | (if (= (point) start) | 1659 | ((looking-at "\\s *$") |
| 1485 | ;; Didn't move. Might be due to eob or unbalanced | 1660 | (forward-line 1)) |
| 1486 | ;; parens. Try to continue if it's the latter. | 1661 | (t |
| 1487 | (if (c-safe (goto-char (c-up-list-forward (point)))) | 1662 | (goto-char pos)))) |
| 1488 | t | ||
| 1489 | ;; Didn't work, so it's eob then. | ||
| 1490 | (goto-char (point-max)) | ||
| 1491 | (throw 'exit nil)) | ||
| 1492 | |||
| 1493 | (save-excursion | ||
| 1494 | ;; Check if the declaration contains a brace | ||
| 1495 | ;; block. If not, we try another one. | ||
| 1496 | (setq pos (point)) | ||
| 1497 | (goto-char start) | ||
| 1498 | (not (c-syntactic-re-search-forward "{" pos t t)))))) | ||
| 1499 | |||
| 1500 | (setq pos (point)) | ||
| 1501 | ;; Try to be line oriented; position point after the next | ||
| 1502 | ;; newline that isn't inside a comment, but if we hit the | ||
| 1503 | ;; next declaration then we use the current point instead. | ||
| 1504 | (while (and (not (bolp)) | ||
| 1505 | (not (looking-at "\\s *$")) | ||
| 1506 | (c-forward-single-comment))) | ||
| 1507 | (cond ((bolp)) | ||
| 1508 | ((looking-at "\\s *$") | ||
| 1509 | (forward-line 1)) | ||
| 1510 | (t | ||
| 1511 | (goto-char pos))) | ||
| 1512 | 1663 | ||
| 1513 | (setq arg (1- arg))))) | ||
| 1514 | (c-keep-region-active) | 1664 | (c-keep-region-active) |
| 1515 | (= arg 0))) | 1665 | (= arg 0))) |
| 1516 | 1666 | ||
| @@ -1646,6 +1796,7 @@ function does not require the declaration to contain a brace block." | |||
| 1646 | (push-mark (cdr decl-limits) nil t)))) | 1796 | (push-mark (cdr decl-limits) nil t)))) |
| 1647 | 1797 | ||
| 1648 | 1798 | ||
| 1799 | ;; Movement by statements. | ||
| 1649 | (defun c-in-comment-line-prefix-p () | 1800 | (defun c-in-comment-line-prefix-p () |
| 1650 | ;; Point is within a comment. Is it also within a comment-prefix? | 1801 | ;; Point is within a comment. Is it also within a comment-prefix? |
| 1651 | ;; Space at BOL which precedes a comment-prefix counts as part of it. | 1802 | ;; Space at BOL which precedes a comment-prefix counts as part of it. |
| @@ -2429,7 +2580,6 @@ sentence motion in or near comments and multiline strings." | |||
| 2429 | (if (/= count 0) (setq count (1- count)))) | 2580 | (if (/= count 0) (setq count (1- count)))) |
| 2430 | (c-keep-region-active)))) | 2581 | (c-keep-region-active)))) |
| 2431 | 2582 | ||
| 2432 | |||
| 2433 | 2583 | ||
| 2434 | ;; set up electric character functions to work with pending-del, | 2584 | ;; set up electric character functions to work with pending-del, |
| 2435 | ;; (a.k.a. delsel) mode. All symbols get the t value except | 2585 | ;; (a.k.a. delsel) mode. All symbols get the t value except |
| @@ -2455,6 +2605,7 @@ sentence motion in or near comments and multiline strings." | |||
| 2455 | (put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del | 2605 | (put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del |
| 2456 | 2606 | ||
| 2457 | 2607 | ||
| 2608 | ;; Inserting/indenting comments | ||
| 2458 | (defun c-calc-comment-indent (entry) | 2609 | (defun c-calc-comment-indent (entry) |
| 2459 | ;; This function might do hidden buffer changes. | 2610 | ;; This function might do hidden buffer changes. |
| 2460 | (if (symbolp entry) | 2611 | (if (symbolp entry) |
| @@ -2550,6 +2701,7 @@ See `c-indent-comment-alist' for a description." | |||
| 2550 | (current-column)))) | 2701 | (current-column)))) |
| 2551 | 2702 | ||
| 2552 | 2703 | ||
| 2704 | ;; Movement by CPP conditionals. | ||
| 2553 | (defun c-up-conditional (count) | 2705 | (defun c-up-conditional (count) |
| 2554 | "Move back to the containing preprocessor conditional, leaving mark behind. | 2706 | "Move back to the containing preprocessor conditional, leaving mark behind. |
| 2555 | A prefix argument acts as a repeat count. With a negative argument, | 2707 | A prefix argument acts as a repeat count. With a negative argument, |
| @@ -3621,9 +3773,12 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3621 | ;; Restore point on undo. It's necessary since we do a lot of | 3773 | ;; Restore point on undo. It's necessary since we do a lot of |
| 3622 | ;; hidden inserts and deletes below that should be as transparent | 3774 | ;; hidden inserts and deletes below that should be as transparent |
| 3623 | ;; as possible. | 3775 | ;; as possible. |
| 3624 | (if (and buffer-undo-list (not (eq buffer-undo-list t))) | 3776 | (if (and buffer-undo-list (not (eq buffer-undo-list t))) |
| 3625 | (setq buffer-undo-list (cons (point) buffer-undo-list))) | 3777 | (setq buffer-undo-list (cons (point) buffer-undo-list))) |
| 3626 | 3778 | ||
| 3779 | ;; Determine the limits and type of the containing literal (if any): | ||
| 3780 | ;; C-LIT-LIMITS, C-LIT-TYPE; and the limits of the current paragraph: | ||
| 3781 | ;; BEG and END. | ||
| 3627 | (c-save-buffer-state () | 3782 | (c-save-buffer-state () |
| 3628 | (save-restriction | 3783 | (save-restriction |
| 3629 | ;; Widen to catch comment limits correctly. | 3784 | ;; Widen to catch comment limits correctly. |
| @@ -3651,6 +3806,13 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3651 | 3806 | ||
| 3652 | (unwind-protect | 3807 | (unwind-protect |
| 3653 | (progn | 3808 | (progn |
| 3809 | ;; For each of the possible types of text (string, C comment ...) | ||
| 3810 | ;; determine BEG and END, the region we will narrow to. If we're in | ||
| 3811 | ;; a literal, constrain BEG and END to the limits of this literal. | ||
| 3812 | ;; | ||
| 3813 | ;; For some of these text types, particularly a block comment, we | ||
| 3814 | ;; may need to massage whitespace near literal delimiters, so that | ||
| 3815 | ;; these don't get filled inappropriately. | ||
| 3654 | (cond | 3816 | (cond |
| 3655 | 3817 | ||
| 3656 | ((eq c-lit-type 'c++) ; Line comment. | 3818 | ((eq c-lit-type 'c++) ; Line comment. |
| @@ -3675,21 +3837,27 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3675 | 3837 | ||
| 3676 | ((eq c-lit-type 'c) ; Block comment. | 3838 | ((eq c-lit-type 'c) ; Block comment. |
| 3677 | (when (>= end (cdr c-lit-limits)) | 3839 | (when (>= end (cdr c-lit-limits)) |
| 3678 | ;; The region includes the comment ender which we might | 3840 | ;; The region includes the comment ender. If it's on its own |
| 3679 | ;; want to keep together with the last word. | 3841 | ;; line, it stays on its own line. If it's got company on the |
| 3680 | (unless (save-excursion | 3842 | ;; line, it keeps (at least one word of) it. "=====*/" counts |
| 3681 | (goto-char (cdr c-lit-limits)) | 3843 | ;; as a comment ender here, but "===== */" doesn't and "foo*/" |
| 3682 | (beginning-of-line) | 3844 | ;; doesn't. |
| 3683 | (and (looking-at (concat "[ \t]*\\(" | 3845 | (unless |
| 3684 | c-current-comment-prefix | 3846 | (save-excursion |
| 3685 | "\\)\\*/")) | 3847 | (goto-char (cdr c-lit-limits)) |
| 3686 | (eq (cdr c-lit-limits) (match-end 0)) | 3848 | (beginning-of-line) |
| 3687 | ;; The comment ender is on a line of its | 3849 | (and (search-forward-regexp |
| 3688 | ;; own. Keep it that way. | 3850 | (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)") |
| 3689 | (set-marker end (point)))) | 3851 | (- (cdr c-lit-limits) 2) t) |
| 3690 | 3852 | (not (search-forward-regexp | |
| 3691 | ;; The comment ender should hang. Replace all space between | 3853 | "\\(\\s \\|\\sw\\)" |
| 3692 | ;; it and the last word either by one or two 'x's (when | 3854 | (- (cdr c-lit-limits) 2) 'limit)) |
| 3855 | ;; The comment ender IS on its own line. Exclude | ||
| 3856 | ;; this line from the filling. | ||
| 3857 | (set-marker end (c-point 'bol)))) | ||
| 3858 | |||
| 3859 | ;; The comment ender is hanging. Replace all space between it | ||
| 3860 | ;; and the last word either by one or two 'x's (when | ||
| 3693 | ;; FILL-PARAGRAPH is non-nil), or a row of x's the same width | 3861 | ;; FILL-PARAGRAPH is non-nil), or a row of x's the same width |
| 3694 | ;; as the whitespace (when auto filling), and include it in | 3862 | ;; as the whitespace (when auto filling), and include it in |
| 3695 | ;; the region. We'll change them back to whitespace | 3863 | ;; the region. We'll change them back to whitespace |
| @@ -3706,23 +3874,26 @@ command to conveniently insert and align the necessary backslashes." | |||
| 3706 | spaces) | 3874 | spaces) |
| 3707 | 3875 | ||
| 3708 | (save-excursion | 3876 | (save-excursion |
| 3877 | ;; Insert a CR after the "*/", adjust END | ||
| 3709 | (goto-char (cdr c-lit-limits)) | 3878 | (goto-char (cdr c-lit-limits)) |
| 3710 | (setq tmp-post (point-marker)) | 3879 | (setq tmp-post (point-marker)) |
| 3711 | (insert ?\n) | 3880 | (insert ?\n) |
| 3712 | (set-marker end (point)) | 3881 | (set-marker end (point)) |
| 3882 | |||
| 3713 | (forward-line -1) ; last line of the comment | 3883 | (forward-line -1) ; last line of the comment |
| 3714 | (if (and (looking-at (concat "[ \t]*\\(\\(" | 3884 | (if (and (looking-at (concat "[ \t]*\\(\\(" |
| 3715 | c-current-comment-prefix | 3885 | c-current-comment-prefix |
| 3716 | "\\)[ \t]*\\)")) | 3886 | "\\)[ \t]*\\)")) |
| 3717 | (eq ender-start (match-end 0))) | 3887 | (eq ender-start (match-end 0))) |
| 3718 | ;; The comment ender is prefixed by nothing | 3888 | ;; The comment ender is prefixed by nothing but a |
| 3719 | ;; but a comment line prefix. Remove it | 3889 | ;; comment line prefix. IS THIS POSSIBLE? (ACM, |
| 3720 | ;; along with surrounding ws. | 3890 | ;; 2006/4/28). Remove it along with surrounding ws. |
| 3721 | (setq spaces (- (match-end 1) (match-end 2))) | 3891 | (setq spaces (- (match-end 1) (match-end 2))) |
| 3722 | (goto-char ender-start)) | 3892 | (goto-char ender-start)) |
| 3723 | (skip-chars-backward " \t\r\n") ; Surely this can be | 3893 | (skip-chars-backward " \t\r\n") ; Surely this can be |
| 3724 | ; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18) | 3894 | ; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18) |
| 3725 | 3895 | ||
| 3896 | ;; What's being tested here? 2006/4/20. FIXME!!! | ||
| 3726 | (if (/= (point) ender-start) | 3897 | (if (/= (point) ender-start) |
| 3727 | (progn | 3898 | (progn |
| 3728 | (if (<= here (point)) | 3899 | (if (<= here (point)) |
| @@ -4172,49 +4343,63 @@ it. | |||
| 4172 | When point is inside a comment, continue it with the appropriate | 4343 | When point is inside a comment, continue it with the appropriate |
| 4173 | comment prefix (see the `c-comment-prefix-regexp' and | 4344 | comment prefix (see the `c-comment-prefix-regexp' and |
| 4174 | `c-block-comment-prefix' variables for details). The end of a | 4345 | `c-block-comment-prefix' variables for details). The end of a |
| 4175 | C++-style line comment doesn't count as inside it." | 4346 | C++-style line comment doesn't count as inside it. |
| 4347 | |||
| 4348 | When point is inside a string, only insert a backslash when it is also | ||
| 4349 | inside a preprocessor directive." | ||
| 4176 | 4350 | ||
| 4177 | (interactive "*") | 4351 | (interactive "*") |
| 4178 | (let* (c-lit-limits c-lit-type | 4352 | (let* (c-lit-limits c-lit-type |
| 4179 | (c-macro-start c-macro-start)) | 4353 | (c-macro-start c-macro-start)) |
| 4180 | 4354 | ||
| 4181 | (if (c-save-buffer-state () | 4355 | (c-save-buffer-state () |
| 4182 | (setq c-lit-limits (c-literal-limits nil nil t) | 4356 | (setq c-lit-limits (c-literal-limits nil nil t) |
| 4183 | c-lit-type (c-literal-type c-lit-limits)) | 4357 | c-lit-type (c-literal-type c-lit-limits)) |
| 4184 | (or (eq c-lit-type 'c) | 4358 | (when (eq c-lit-type 'c++) |
| 4185 | (and (eq c-lit-type 'c++) | 4359 | (setq c-lit-limits (c-collect-line-comments c-lit-limits))) |
| 4186 | (< (save-excursion | 4360 | (c-query-and-set-macro-start)) |
| 4187 | (skip-chars-forward " \t") | ||
| 4188 | (point)) | ||
| 4189 | (1- (cdr (setq c-lit-limits (c-collect-line-comments | ||
| 4190 | c-lit-limits)))))) | ||
| 4191 | (and (or (not (looking-at "\\s *$")) | ||
| 4192 | (eq (char-before) ?\\)) | ||
| 4193 | (c-query-and-set-macro-start) | ||
| 4194 | (<= (save-excursion | ||
| 4195 | (goto-char c-macro-start) | ||
| 4196 | (if (looking-at c-opt-cpp-start) | ||
| 4197 | (goto-char (match-end 0))) | ||
| 4198 | (point)) | ||
| 4199 | (point))))) | ||
| 4200 | |||
| 4201 | (let ((comment-multi-line t) | ||
| 4202 | (fill-prefix nil)) | ||
| 4203 | (c-indent-new-comment-line nil t)) | ||
| 4204 | |||
| 4205 | (delete-horizontal-space) | ||
| 4206 | (newline) | ||
| 4207 | 4361 | ||
| 4362 | (cond | ||
| 4363 | ((or (eq c-lit-type 'c) | ||
| 4364 | (and (eq c-lit-type 'c++) ; C++ comment, but not at the very end of it. | ||
| 4365 | (< (save-excursion | ||
| 4366 | (skip-chars-forward " \t") | ||
| 4367 | (point)) | ||
| 4368 | (1- (cdr c-lit-limits)))) | ||
| 4369 | (and (numberp c-macro-start) ; Macro, but not at the very end of | ||
| 4370 | ; it, not in a string, and not in the | ||
| 4371 | ; cpp keyword. | ||
| 4372 | (not (eq c-lit-type 'string)) | ||
| 4373 | (or (not (looking-at "\\s *$")) | ||
| 4374 | (eq (char-before) ?\\)) | ||
| 4375 | (<= (save-excursion | ||
| 4376 | (goto-char c-macro-start) | ||
| 4377 | (if (looking-at c-opt-cpp-start) | ||
| 4378 | (goto-char (match-end 0))) | ||
| 4379 | (point)) | ||
| 4380 | (point)))) | ||
| 4381 | (let ((comment-multi-line t) | ||
| 4382 | (fill-prefix nil)) | ||
| 4383 | (c-indent-new-comment-line nil t))) | ||
| 4384 | |||
| 4385 | ((eq c-lit-type 'string) | ||
| 4386 | (if (and (numberp c-macro-start) | ||
| 4387 | (not (eq (char-before) ?\\))) | ||
| 4388 | (insert ?\\)) | ||
| 4389 | (newline)) | ||
| 4390 | |||
| 4391 | (t (delete-horizontal-space) | ||
| 4392 | (newline) | ||
| 4208 | ;; c-indent-line may look at the current indentation, so let's | 4393 | ;; c-indent-line may look at the current indentation, so let's |
| 4209 | ;; start out with the same indentation as the previous line. | 4394 | ;; start out with the same indentation as the previous line. |
| 4210 | (let ((col (save-excursion | 4395 | (let ((col (save-excursion |
| 4211 | (forward-line -1) | 4396 | (backward-char) |
| 4212 | (while (and (looking-at "[ \t]*\\\\?$") | 4397 | (forward-line 0) |
| 4213 | (= (forward-line -1) 0))) | 4398 | (while (and (looking-at "[ \t]*\\\\?$") |
| 4214 | (current-indentation)))) | 4399 | (= (forward-line -1) 0))) |
| 4215 | (indent-to col)) | 4400 | (current-indentation)))) |
| 4216 | 4401 | (indent-to col)) | |
| 4217 | (indent-according-to-mode)))) | 4402 | (indent-according-to-mode))))) |
| 4218 | 4403 | ||
| 4219 | (defun c-context-open-line () | 4404 | (defun c-context-open-line () |
| 4220 | "Insert a line break suitable to the context and leave point before it. | 4405 | "Insert a line break suitable to the context and leave point before it. |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index df2f247f048..b4063554384 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -95,7 +95,7 @@ | |||
| 95 | 95 | ||
| 96 | ;;; Variables also used at compile time. | 96 | ;;; Variables also used at compile time. |
| 97 | 97 | ||
| 98 | (defconst c-version "5.31.3" | 98 | (defconst c-version "5.31.4" |
| 99 | "CC Mode version number.") | 99 | "CC Mode version number.") |
| 100 | 100 | ||
| 101 | (defconst c-version-sym (intern c-version)) | 101 | (defconst c-version-sym (intern c-version)) |
| @@ -764,7 +764,7 @@ be after it." | |||
| 764 | ;; call `c-beginning-of-statement-1'. | 764 | ;; call `c-beginning-of-statement-1'. |
| 765 | ;; | 765 | ;; |
| 766 | ;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing | 766 | ;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing |
| 767 | ;; scheme used by the `c-at-vsemp-p-fn', hence the name - the status is | 767 | ;; scheme used by the `c-at-vsemi-p-fn', hence the name - the status is |
| 768 | ;; "unknown" if there is no cache entry current for the line. | 768 | ;; "unknown" if there is no cache entry current for the line. |
| 769 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 769 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 770 | 770 | ||
| @@ -1620,7 +1620,7 @@ itself is evaluated." | |||
| 1620 | 1620 | ||
| 1621 | (defmacro c-lang-defconst (name &rest args) | 1621 | (defmacro c-lang-defconst (name &rest args) |
| 1622 | "Set the language specific values of the language constant NAME. | 1622 | "Set the language specific values of the language constant NAME. |
| 1623 | The second argument can be an optional docstring. The rest of the | 1623 | The second argument can optionally be a docstring. The rest of the |
| 1624 | arguments are one or more repetitions of LANG VAL where LANG specifies | 1624 | arguments are one or more repetitions of LANG VAL where LANG specifies |
| 1625 | the language(s) that VAL applies to. LANG is the name of the | 1625 | the language(s) that VAL applies to. LANG is the name of the |
| 1626 | language, i.e. the mode name without the \"-mode\" suffix, or a list | 1626 | language, i.e. the mode name without the \"-mode\" suffix, or a list |
| @@ -1717,7 +1717,7 @@ constant. A file is identified by its base name." | |||
| 1717 | ;; Emacs has a weird bug where it seems to fail to read | 1717 | ;; Emacs has a weird bug where it seems to fail to read |
| 1718 | ;; backquote lists from byte compiled files correctly (,@ | 1718 | ;; backquote lists from byte compiled files correctly (,@ |
| 1719 | ;; forms, to be specific), so make sure the bindings in the | 1719 | ;; forms, to be specific), so make sure the bindings in the |
| 1720 | ;; expansion below doesn't contain any backquote stuff. | 1720 | ;; expansion below don't contain any backquote stuff. |
| 1721 | ;; (XEmacs handles it correctly and doesn't need this for that | 1721 | ;; (XEmacs handles it correctly and doesn't need this for that |
| 1722 | ;; reason, but we also use this expansion handle | 1722 | ;; reason, but we also use this expansion handle |
| 1723 | ;; `c-lang-defconst-eval-immediately' and to register | 1723 | ;; `c-lang-defconst-eval-immediately' and to register |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 5cb00929007..bacb4670ea0 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -255,6 +255,18 @@ comment at the start of cc-engine.el for more info." | |||
| 255 | (forward-char) | 255 | (forward-char) |
| 256 | t)))) | 256 | t)))) |
| 257 | 257 | ||
| 258 | (defun c-forward-over-cpp-define-id () | ||
| 259 | ;; Assuming point is at the "#" that introduces a preprocessor | ||
| 260 | ;; directive, it's moved forward to the end of the identifier which is | ||
| 261 | ;; "#define"d (or whatever c-opt-cpp-macro-define specifies). Non-nil | ||
| 262 | ;; is returned in this case, in all other cases nil is returned and | ||
| 263 | ;; point isn't moved. | ||
| 264 | ;; | ||
| 265 | ;; This function might do hidden buffer changes. | ||
| 266 | (when (and c-opt-cpp-macro-define-id | ||
| 267 | (looking-at c-opt-cpp-macro-define-id)) | ||
| 268 | (goto-char (match-end 0)))) | ||
| 269 | |||
| 258 | (defun c-forward-to-cpp-define-body () | 270 | (defun c-forward-to-cpp-define-body () |
| 259 | ;; Assuming point is at the "#" that introduces a preprocessor | 271 | ;; Assuming point is at the "#" that introduces a preprocessor |
| 260 | ;; directive, it's moved forward to the start of the definition body | 272 | ;; directive, it's moved forward to the start of the definition body |
| @@ -2442,14 +2454,14 @@ comment at the start of cc-engine.el for more info." | |||
| 2442 | (= (c-backward-token-2 0) 0)) | 2454 | (= (c-backward-token-2 0) 0)) |
| 2443 | 2455 | ||
| 2444 | (cond ((and (looking-at c-overloadable-operators-regexp) | 2456 | (cond ((and (looking-at c-overloadable-operators-regexp) |
| 2445 | (or (not c-opt-op-identitier-prefix) | 2457 | (or (not c-opt-op-identifier-prefix) |
| 2446 | (and (= (c-backward-token-2 1) 0) | 2458 | (and (= (c-backward-token-2 1) 0) |
| 2447 | (looking-at c-opt-op-identitier-prefix)))) | 2459 | (looking-at c-opt-op-identifier-prefix)))) |
| 2448 | (point)) | 2460 | (point)) |
| 2449 | 2461 | ||
| 2450 | ((save-excursion | 2462 | ((save-excursion |
| 2451 | (and c-opt-op-identitier-prefix | 2463 | (and c-opt-op-identifier-prefix |
| 2452 | (looking-at c-opt-op-identitier-prefix) | 2464 | (looking-at c-opt-op-identifier-prefix) |
| 2453 | (= (c-forward-token-2 1) 0) | 2465 | (= (c-forward-token-2 1) 0) |
| 2454 | (looking-at c-overloadable-operators-regexp))) | 2466 | (looking-at c-overloadable-operators-regexp))) |
| 2455 | (point)))) | 2467 | (point)))) |
| @@ -3843,7 +3855,7 @@ comment at the start of cc-engine.el for more info." | |||
| 3843 | ;; good start position for the search, so do it. | 3855 | ;; good start position for the search, so do it. |
| 3844 | (c-find-decl-prefix-search))) | 3856 | (c-find-decl-prefix-search))) |
| 3845 | 3857 | ||
| 3846 | ;; Now loop. We already got the first match. | 3858 | ;; Now loop. Round what? (ACM, 2006/7/5). We already got the first match. |
| 3847 | 3859 | ||
| 3848 | (while (progn | 3860 | (while (progn |
| 3849 | (while (and | 3861 | (while (and |
| @@ -4534,41 +4546,42 @@ comment at the start of cc-engine.el for more info." | |||
| 4534 | (goto-char start) | 4546 | (goto-char start) |
| 4535 | nil) | 4547 | nil) |
| 4536 | 4548 | ||
| 4537 | (while (and | 4549 | (while (progn |
| 4538 | (c-syntactic-skip-backward "^<;{}" limit t) | 4550 | (c-syntactic-skip-backward "^<;{}" limit t) |
| 4539 | 4551 | ||
| 4540 | (if (eq (char-before) ?<) | 4552 | (and |
| 4541 | t | 4553 | (if (eq (char-before) ?<) |
| 4542 | ;; Stopped at bob or a char that isn't allowed in an | 4554 | t |
| 4543 | ;; arglist, so we've failed. | 4555 | ;; Stopped at bob or a char that isn't allowed in an |
| 4544 | (goto-char start) | 4556 | ;; arglist, so we've failed. |
| 4545 | nil) | 4557 | (goto-char start) |
| 4558 | nil) | ||
| 4546 | 4559 | ||
| 4547 | (if (> (point) | 4560 | (if (> (point) |
| 4548 | (progn (c-beginning-of-current-token) | 4561 | (progn (c-beginning-of-current-token) |
| 4549 | (point))) | 4562 | (point))) |
| 4550 | ;; If we moved then the "<" was part of some | 4563 | ;; If we moved then the "<" was part of some |
| 4551 | ;; multicharacter token. | 4564 | ;; multicharacter token. |
| 4552 | t | 4565 | t |
| 4553 | 4566 | ||
| 4554 | (backward-char) | 4567 | (backward-char) |
| 4555 | (let ((beg-pos (point))) | 4568 | (let ((beg-pos (point))) |
| 4556 | (if (c-forward-<>-arglist all-types) | 4569 | (if (c-forward-<>-arglist all-types) |
| 4557 | (cond ((= (point) start) | 4570 | (cond ((= (point) start) |
| 4558 | ;; Matched the arglist. Break the while. | 4571 | ;; Matched the arglist. Break the while. |
| 4559 | (goto-char beg-pos) | 4572 | (goto-char beg-pos) |
| 4560 | nil) | 4573 | nil) |
| 4561 | ((> (point) start) | 4574 | ((> (point) start) |
| 4562 | ;; We started from a non-paren ">" inside an | 4575 | ;; We started from a non-paren ">" inside an |
| 4563 | ;; arglist. | 4576 | ;; arglist. |
| 4564 | (goto-char start) | 4577 | (goto-char start) |
| 4565 | nil) | 4578 | nil) |
| 4566 | (t | 4579 | (t |
| 4567 | ;; Matched a shorter arglist. Can be a nested | 4580 | ;; Matched a shorter arglist. Can be a nested |
| 4568 | ;; one so continue looking. | 4581 | ;; one so continue looking. |
| 4569 | (goto-char beg-pos) | 4582 | (goto-char beg-pos) |
| 4570 | t)) | 4583 | t)) |
| 4571 | t))))) | 4584 | t)))))) |
| 4572 | 4585 | ||
| 4573 | (/= (point) start)))) | 4586 | (/= (point) start)))) |
| 4574 | 4587 | ||
| @@ -5793,17 +5806,32 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5793 | nil)))) | 5806 | nil)))) |
| 5794 | 5807 | ||
| 5795 | (defun c-forward-label (&optional assume-markup preceding-token-end limit) | 5808 | (defun c-forward-label (&optional assume-markup preceding-token-end limit) |
| 5796 | ;; Assuming the point is at the beginning of a token, check if it | 5809 | ;; Assuming that point is at the beginning of a token, check if it starts a |
| 5797 | ;; starts a label and if so move over it and return t, otherwise | 5810 | ;; label and if so move over it and return t, otherwise don't move and |
| 5798 | ;; don't move and return nil. The end of the label is taken to be | 5811 | ;; return nil. "Label" here means "most things with a colon". |
| 5799 | ;; the end of the first submatch in `c-opt-extra-label-key' if it | 5812 | ;; |
| 5800 | ;; matched, otherwise it's the colon. The point is directly after | 5813 | ;; More precisely, a "label" is regarded as one of: |
| 5801 | ;; the end on return. The terminating char is marked with | 5814 | ;; (i) a goto target like "foo:"; |
| 5802 | ;; `c-decl-end' to improve recognition of the following declaration | 5815 | ;; (ii) A case label - either the entire construct "case FOO:" or just the |
| 5803 | ;; or statement. | 5816 | ;; bare "case", should the colon be missing; |
| 5817 | ;; (iii) a keyword which needs a colon, like "default:" or "private:"; | ||
| 5818 | ;; (iv) One of QT's "extended" C++ variants of | ||
| 5819 | ;; "private:"/"protected:"/"public:"/"more:" looking like "public slots:". | ||
| 5820 | ;; (v) One of the keywords matched by `c-opt-extra-label-key' (without any | ||
| 5821 | ;; colon). Currently (2006-03), this applies only to Objective C's | ||
| 5822 | ;; keywords "@private", "@protected", and "@public". | ||
| 5823 | ;; | ||
| 5824 | ;; One of the things which will NOT be recognised as a label is a bit-field | ||
| 5825 | ;; element of a struct, something like "int foo:5". | ||
| 5826 | ;; | ||
| 5827 | ;; The end of the label is taken to be just after the colon, or the end of | ||
| 5828 | ;; the first submatch in `c-opt-extra-label-key'. The point is directly | ||
| 5829 | ;; after the end on return. The terminating char gets marked with | ||
| 5830 | ;; `c-decl-end' to improve recognition of the following declaration or | ||
| 5831 | ;; statement. | ||
| 5804 | ;; | 5832 | ;; |
| 5805 | ;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding | 5833 | ;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding |
| 5806 | ;; label, if any, has been marked up like that. | 5834 | ;; label, if any, has already been marked up like that. |
| 5807 | ;; | 5835 | ;; |
| 5808 | ;; If PRECEDING-TOKEN-END is given, it should be the first position | 5836 | ;; If PRECEDING-TOKEN-END is given, it should be the first position |
| 5809 | ;; after the preceding token, i.e. on the other side of the | 5837 | ;; after the preceding token, i.e. on the other side of the |
| @@ -5819,8 +5847,11 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5819 | ;; | 5847 | ;; |
| 5820 | ;; This function might do hidden buffer changes. | 5848 | ;; This function might do hidden buffer changes. |
| 5821 | 5849 | ||
| 5822 | (let ((start (point))) | 5850 | (let ((start (point)) |
| 5851 | qt-symbol-idx | ||
| 5852 | macro-start) ; if we're in one. | ||
| 5823 | (cond | 5853 | (cond |
| 5854 | ;; "case" or "default" (Doesn't apply to AWK). | ||
| 5824 | ((looking-at c-label-kwds-regexp) | 5855 | ((looking-at c-label-kwds-regexp) |
| 5825 | (let ((kwd-end (match-end 1))) | 5856 | (let ((kwd-end (match-end 1))) |
| 5826 | ;; Record only the keyword itself for fontification, since in | 5857 | ;; Record only the keyword itself for fontification, since in |
| @@ -5840,7 +5871,7 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5840 | (match-beginning 2)) | 5871 | (match-beginning 2)) |
| 5841 | 5872 | ||
| 5842 | (progn | 5873 | (progn |
| 5843 | (goto-char (match-beginning 2)) | 5874 | (goto-char (match-beginning 2)) ; just after the : |
| 5844 | (c-put-c-type-property (1- (point)) 'c-decl-end) | 5875 | (c-put-c-type-property (1- (point)) 'c-decl-end) |
| 5845 | t) | 5876 | t) |
| 5846 | 5877 | ||
| @@ -5851,6 +5882,7 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5851 | (goto-char kwd-end) | 5882 | (goto-char kwd-end) |
| 5852 | t))) | 5883 | t))) |
| 5853 | 5884 | ||
| 5885 | ;; @private, @protected, @public, in Objective C, or similar. | ||
| 5854 | ((and c-opt-extra-label-key | 5886 | ((and c-opt-extra-label-key |
| 5855 | (looking-at c-opt-extra-label-key)) | 5887 | (looking-at c-opt-extra-label-key)) |
| 5856 | ;; For a `c-opt-extra-label-key' match, we record the whole | 5888 | ;; For a `c-opt-extra-label-key' match, we record the whole |
| @@ -5862,7 +5894,8 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5862 | (c-put-c-type-property (1- (point)) 'c-decl-end) | 5894 | (c-put-c-type-property (1- (point)) 'c-decl-end) |
| 5863 | t) | 5895 | t) |
| 5864 | 5896 | ||
| 5865 | ((and c-recognize-colon-labels | 5897 | ;; All other cases of labels. |
| 5898 | ((and c-recognize-colon-labels ; nil for AWK and IDL, otherwise t. | ||
| 5866 | 5899 | ||
| 5867 | ;; A colon label must have something before the colon. | 5900 | ;; A colon label must have something before the colon. |
| 5868 | (not (eq (char-after) ?:)) | 5901 | (not (eq (char-after) ?:)) |
| @@ -5890,7 +5923,8 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5890 | (save-excursion | 5923 | (save-excursion |
| 5891 | (goto-char (1- preceding-token-end)) | 5924 | (goto-char (1- preceding-token-end)) |
| 5892 | (c-beginning-of-current-token) | 5925 | (c-beginning-of-current-token) |
| 5893 | (looking-at c-label-prefix-re)) | 5926 | (or (looking-at c-label-prefix-re) |
| 5927 | (looking-at c-block-stmt-1-key))) | ||
| 5894 | 5928 | ||
| 5895 | (and (eq (char-before preceding-token-end) ?\)) | 5929 | (and (eq (char-before preceding-token-end) ?\)) |
| 5896 | (c-after-conditional))) | 5930 | (c-after-conditional))) |
| @@ -5899,7 +5933,8 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5899 | (save-excursion | 5933 | (save-excursion |
| 5900 | (goto-char (1- preceding-token-end)) | 5934 | (goto-char (1- preceding-token-end)) |
| 5901 | (c-beginning-of-current-token) | 5935 | (c-beginning-of-current-token) |
| 5902 | (looking-at c-label-prefix-re)) | 5936 | (or (looking-at c-label-prefix-re) |
| 5937 | (looking-at c-block-stmt-1-key))) | ||
| 5903 | 5938 | ||
| 5904 | (cond | 5939 | (cond |
| 5905 | ((eq (char-before preceding-token-end) ?\)) | 5940 | ((eq (char-before preceding-token-end) ?\)) |
| @@ -5907,26 +5942,52 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5907 | 5942 | ||
| 5908 | ((eq (char-before preceding-token-end) ?:) | 5943 | ((eq (char-before preceding-token-end) ?:) |
| 5909 | ;; Might be after another label, so check it recursively. | 5944 | ;; Might be after another label, so check it recursively. |
| 5910 | (save-excursion | 5945 | (save-restriction |
| 5911 | (goto-char (1- preceding-token-end)) | 5946 | (save-excursion |
| 5912 | ;; Essentially the same as the | 5947 | (goto-char (1- preceding-token-end)) |
| 5913 | ;; `c-syntactic-re-search-forward' regexp below. | 5948 | ;; Essentially the same as the |
| 5914 | (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t) | 5949 | ;; `c-syntactic-re-search-forward' regexp below. |
| 5915 | (let ((pte (point)) | 5950 | (setq macro-start |
| 5916 | ;; If the caller turned on recording for us, | 5951 | (save-excursion (and (c-beginning-of-macro) |
| 5917 | ;; it shouldn't apply when we check the | 5952 | (point)))) |
| 5918 | ;; preceding label. | 5953 | (if macro-start (narrow-to-region macro-start (point-max))) |
| 5919 | c-record-type-identifiers) | 5954 | (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t) |
| 5920 | (c-forward-syntactic-ws) | 5955 | ;; Note: the following should work instead of the |
| 5921 | (c-forward-label nil pte start)))))))) | 5956 | ;; narrow-to-region above. Investigate why not, |
| 5922 | 5957 | ;; sometime. ACM, 2006-03-31. | |
| 5923 | ;; Check that the next nonsymbol token is ":". Allow '(' | 5958 | ;; (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" |
| 5924 | ;; for the sake of macro arguments. FIXME: Should build | 5959 | ;; macro-start t) |
| 5925 | ;; this regexp from the language constants. | 5960 | (let ((pte (point)) |
| 5926 | (c-syntactic-re-search-forward | 5961 | ;; If the caller turned on recording for us, |
| 5927 | "[[:?;{=*/%&|,<>!@+-]" limit t t) | 5962 | ;; it shouldn't apply when we check the |
| 5928 | (eq (char-before) ?:) | 5963 | ;; preceding label. |
| 5929 | (not (eq (char-after) ?:))) | 5964 | c-record-type-identifiers) |
| 5965 | ;; A label can't start at a cpp directive. Check for | ||
| 5966 | ;; this, since c-forward-syntactic-ws would foul up on it. | ||
| 5967 | (unless (and c-opt-cpp-prefix (looking-at c-opt-cpp-prefix)) | ||
| 5968 | (c-forward-syntactic-ws) | ||
| 5969 | (c-forward-label nil pte start)))))))))) | ||
| 5970 | |||
| 5971 | ;; Check that the next nonsymbol token is ":", or that we're in one | ||
| 5972 | ;; of QT's "slots" declarations. Allow '(' for the sake of macro | ||
| 5973 | ;; arguments. FIXME: Should build this regexp from the language | ||
| 5974 | ;; constants. | ||
| 5975 | (when (c-syntactic-re-search-forward | ||
| 5976 | "[ \t[:?;{=*/%&|,<>!@+-]" limit t t) ; not at EOB | ||
| 5977 | (backward-char) | ||
| 5978 | (setq qt-symbol-idx | ||
| 5979 | (and (c-major-mode-is 'c++-mode) | ||
| 5980 | (string-match | ||
| 5981 | "\\(p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|more\\)\\>" | ||
| 5982 | (buffer-substring start (point))))) | ||
| 5983 | (c-forward-syntactic-ws limit) | ||
| 5984 | (when (or (looking-at ":\\([^:]\\|\\'\\)") ; A single colon. | ||
| 5985 | (and qt-symbol-idx | ||
| 5986 | (search-forward-regexp "\\=slots\\>" limit t) | ||
| 5987 | (progn (c-forward-syntactic-ws limit) | ||
| 5988 | (looking-at ":\\([^:]\\|\\'\\)")))) ; A single colon | ||
| 5989 | (forward-char) ; to after the colon. | ||
| 5990 | t))) | ||
| 5930 | 5991 | ||
| 5931 | (save-restriction | 5992 | (save-restriction |
| 5932 | (narrow-to-region start (point)) | 5993 | (narrow-to-region start (point)) |
| @@ -6145,8 +6206,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6145 | ;; so that we don't get stuck on that instead of the | 6206 | ;; so that we don't get stuck on that instead of the |
| 6146 | ;; function arglist. | 6207 | ;; function arglist. |
| 6147 | (c-forward-sexp)) | 6208 | (c-forward-sexp)) |
| 6148 | ((and c-opt-op-identitier-prefix | 6209 | ((and c-opt-op-identifier-prefix |
| 6149 | (looking-at c-opt-op-identitier-prefix)) | 6210 | (looking-at c-opt-op-identifier-prefix)) |
| 6150 | ;; Don't trip up on "operator ()". | 6211 | ;; Don't trip up on "operator ()". |
| 6151 | (c-forward-token-2 2 t))) | 6212 | (c-forward-token-2 2 t))) |
| 6152 | (and (< (point) beg) | 6213 | (and (< (point) beg) |
| @@ -6263,10 +6324,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6263 | (and c-overloadable-operators-regexp | 6324 | (and c-overloadable-operators-regexp |
| 6264 | (zerop (c-backward-token-2 1 nil lim)) | 6325 | (zerop (c-backward-token-2 1 nil lim)) |
| 6265 | (looking-at c-overloadable-operators-regexp) | 6326 | (looking-at c-overloadable-operators-regexp) |
| 6266 | (or (not c-opt-op-identitier-prefix) | 6327 | (or (not c-opt-op-identifier-prefix) |
| 6267 | (and | 6328 | (and |
| 6268 | (zerop (c-backward-token-2 1 nil lim)) | 6329 | (zerop (c-backward-token-2 1 nil lim)) |
| 6269 | (looking-at c-opt-op-identitier-prefix))) | 6330 | (looking-at c-opt-op-identifier-prefix))) |
| 6270 | (point)))) | 6331 | (point)))) |
| 6271 | 6332 | ||
| 6272 | (defsubst c-backward-to-block-anchor (&optional lim) | 6333 | (defsubst c-backward-to-block-anchor (&optional lim) |
| @@ -6314,7 +6375,7 @@ comment at the start of cc-engine.el for more info." | |||
| 6314 | ;; operator token preceded by "operator". | 6375 | ;; operator token preceded by "operator". |
| 6315 | (save-excursion | 6376 | (save-excursion |
| 6316 | (and (c-safe (c-backward-sexp) t) | 6377 | (and (c-safe (c-backward-sexp) t) |
| 6317 | (looking-at c-opt-op-identitier-prefix))) | 6378 | (looking-at c-opt-op-identifier-prefix))) |
| 6318 | (and (eq (char-before) ?<) | 6379 | (and (eq (char-before) ?<) |
| 6319 | (c-with-syntax-table c++-template-syntax-table | 6380 | (c-with-syntax-table c++-template-syntax-table |
| 6320 | (if (c-safe (goto-char (c-up-list-forward (point)))) | 6381 | (if (c-safe (goto-char (c-up-list-forward (point)))) |
| @@ -6354,6 +6415,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6354 | ;; construct, i.e. if it isn't preceded by ';', '}', ':', bob, | 6415 | ;; construct, i.e. if it isn't preceded by ';', '}', ':', bob, |
| 6355 | ;; or an open paren. | 6416 | ;; or an open paren. |
| 6356 | (let ((beg (point)) tentative-move) | 6417 | (let ((beg (point)) tentative-move) |
| 6418 | ;; Go back one "statement" each time round the loop until we're just | ||
| 6419 | ;; after a ;, }, or :, or at BOB or the start of a macro or start of | ||
| 6420 | ;; an ObjC method. This will move over a multiple declaration whose | ||
| 6421 | ;; components are comma separated. | ||
| 6357 | (while (and | 6422 | (while (and |
| 6358 | ;; Must check with c-opt-method-key in ObjC mode. | 6423 | ;; Must check with c-opt-method-key in ObjC mode. |
| 6359 | (not (and c-opt-method-key | 6424 | (not (and c-opt-method-key |
| @@ -6397,25 +6462,39 @@ comment at the start of cc-engine.el for more info." | |||
| 6397 | knr-argdecl-start)) | 6462 | knr-argdecl-start)) |
| 6398 | (goto-char fallback-pos)))) | 6463 | (goto-char fallback-pos)))) |
| 6399 | 6464 | ||
| 6400 | ;; `c-beginning-of-statement-1' counts each brace block as a | 6465 | ;; `c-beginning-of-statement-1' counts each brace block as a separate |
| 6401 | ;; separate statement, so the result will be 'previous if we've | 6466 | ;; statement, so the result will be 'previous if we've moved over any. |
| 6402 | ;; moved over any. If they were brace list initializers we might | 6467 | ;; So change our result back to 'same if necessary. |
| 6403 | ;; not have moved over a declaration boundary though, so change it | 6468 | ;; |
| 6404 | ;; to 'same if we've moved past a '=' before '{', but not ';'. | 6469 | ;; If they were brace list initializers we might not have moved over a |
| 6405 | ;; (This ought to be integrated into `c-beginning-of-statement-1', | 6470 | ;; declaration boundary though, so change it to 'same if we've moved |
| 6406 | ;; so we avoid this extra pass which potentially can search over a | 6471 | ;; past a '=' before '{', but not ';'. (This ought to be integrated |
| 6407 | ;; large amount of text.) | 6472 | ;; into `c-beginning-of-statement-1', so we avoid this extra pass which |
| 6473 | ;; potentially can search over a large amount of text.). Take special | ||
| 6474 | ;; pains not to get mislead by C++'s "operator=", and the like. | ||
| 6408 | (if (and (eq move 'previous) | 6475 | (if (and (eq move 'previous) |
| 6409 | (c-with-syntax-table (if (c-major-mode-is 'c++-mode) | 6476 | (c-with-syntax-table (if (c-major-mode-is 'c++-mode) |
| 6410 | c++-template-syntax-table | 6477 | c++-template-syntax-table |
| 6411 | (syntax-table)) | 6478 | (syntax-table)) |
| 6412 | (save-excursion | 6479 | (save-excursion |
| 6413 | (and (c-syntactic-re-search-forward "[;={]" start t t t) | 6480 | (and |
| 6414 | (eq (char-before) ?=) | 6481 | (progn |
| 6415 | (c-syntactic-re-search-forward "[;{]" start t t) | 6482 | (while ; keep going back to "[;={"s until we either find |
| 6416 | (eq (char-before) ?{) | 6483 | ; no more, or get to one which isn't an "operator =" |
| 6417 | (c-safe (goto-char (c-up-list-forward (point))) t) | 6484 | (and (c-syntactic-re-search-forward "[;={]" start t t t) |
| 6418 | (not (c-syntactic-re-search-forward ";" start t t)))))) | 6485 | (eq (char-before) ?=) |
| 6486 | c-overloadable-operators-regexp | ||
| 6487 | c-opt-op-identifier-prefix | ||
| 6488 | (save-excursion | ||
| 6489 | (eq (c-backward-token-2) 0) | ||
| 6490 | (looking-at c-overloadable-operators-regexp) | ||
| 6491 | (eq (c-backward-token-2) 0) | ||
| 6492 | (looking-at c-opt-op-identifier-prefix)))) | ||
| 6493 | (eq (char-before) ?=)) | ||
| 6494 | (c-syntactic-re-search-forward "[;{]" start t t) | ||
| 6495 | (eq (char-before) ?{) | ||
| 6496 | (c-safe (goto-char (c-up-list-forward (point))) t) | ||
| 6497 | (not (c-syntactic-re-search-forward ";" start t t)))))) | ||
| 6419 | (cons 'same nil) | 6498 | (cons 'same nil) |
| 6420 | (cons move nil))))) | 6499 | (cons move nil))))) |
| 6421 | 6500 | ||
| @@ -6725,8 +6804,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6725 | (setq braceassignp | 6804 | (setq braceassignp |
| 6726 | (cond | 6805 | (cond |
| 6727 | ;; Check for operator = | 6806 | ;; Check for operator = |
| 6728 | ((and c-opt-op-identitier-prefix | 6807 | ((and c-opt-op-identifier-prefix |
| 6729 | (looking-at c-opt-op-identitier-prefix)) | 6808 | (looking-at c-opt-op-identifier-prefix)) |
| 6730 | nil) | 6809 | nil) |
| 6731 | ;; Check for `<opchar>= in Pike. | 6810 | ;; Check for `<opchar>= in Pike. |
| 6732 | ((and (c-major-mode-is 'pike-mode) | 6811 | ((and (c-major-mode-is 'pike-mode) |
| @@ -7000,6 +7079,11 @@ comment at the start of cc-engine.el for more info." | |||
| 7000 | stop-at-boi-only | 7079 | stop-at-boi-only |
| 7001 | containing-sexp | 7080 | containing-sexp |
| 7002 | paren-state) | 7081 | paren-state) |
| 7082 | ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as | ||
| 7083 | ;; needed with further syntax elements of the types `substatement', | ||
| 7084 | ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and | ||
| 7085 | ;; `defun-block-intro'. | ||
| 7086 | ;; | ||
| 7003 | ;; Do the generic processing to anchor the given syntax symbol on | 7087 | ;; Do the generic processing to anchor the given syntax symbol on |
| 7004 | ;; the preceding statement: Skip over any labels and containing | 7088 | ;; the preceding statement: Skip over any labels and containing |
| 7005 | ;; statements on the same line, and then search backward until we | 7089 | ;; statements on the same line, and then search backward until we |
| @@ -8085,7 +8169,9 @@ comment at the start of cc-engine.el for more info." | |||
| 8085 | (and (eq (char-before) ?}) | 8169 | (and (eq (char-before) ?}) |
| 8086 | (save-excursion | 8170 | (save-excursion |
| 8087 | (let ((start (point))) | 8171 | (let ((start (point))) |
| 8088 | (if c-state-cache | 8172 | (if (and c-state-cache |
| 8173 | (consp (car c-state-cache)) | ||
| 8174 | (eq (cdar c-state-cache) (point))) | ||
| 8089 | ;; Speed up the backward search a bit. | 8175 | ;; Speed up the backward search a bit. |
| 8090 | (goto-char (caar c-state-cache))) | 8176 | (goto-char (caar c-state-cache))) |
| 8091 | (c-beginning-of-decl-1 containing-sexp) | 8177 | (c-beginning-of-decl-1 containing-sexp) |
| @@ -8103,26 +8189,30 @@ comment at the start of cc-engine.el for more info." | |||
| 8103 | 8189 | ||
| 8104 | ;; CASE 5J: we are at the topmost level, make | 8190 | ;; CASE 5J: we are at the topmost level, make |
| 8105 | ;; sure we skip back past any access specifiers | 8191 | ;; sure we skip back past any access specifiers |
| 8106 | ((save-excursion | 8192 | ((and |
| 8107 | (setq placeholder (point)) | 8193 | ;; A macro continuation line is never at top level. |
| 8108 | (or (memq char-before-ip '(?\; ?{ ?} nil)) | 8194 | (not (and macro-start |
| 8109 | (c-at-vsemi-p before-ws-ip) | 8195 | (> indent-point macro-start))) |
| 8110 | (when (and (eq char-before-ip ?:) | 8196 | (save-excursion |
| 8111 | (eq (c-beginning-of-statement-1 lim) | 8197 | (setq placeholder (point)) |
| 8112 | 'label)) | 8198 | (or (memq char-before-ip '(?\; ?{ ?} nil)) |
| 8113 | (c-backward-syntactic-ws lim) | 8199 | (c-at-vsemi-p before-ws-ip) |
| 8114 | (setq placeholder (point))) | 8200 | (when (and (eq char-before-ip ?:) |
| 8115 | (and (c-major-mode-is 'objc-mode) | 8201 | (eq (c-beginning-of-statement-1 lim) |
| 8116 | (catch 'not-in-directive | 8202 | 'label)) |
| 8117 | (c-beginning-of-statement-1 lim) | 8203 | (c-backward-syntactic-ws lim) |
| 8118 | (setq placeholder (point)) | 8204 | (setq placeholder (point))) |
| 8119 | (while (and (c-forward-objc-directive) | 8205 | (and (c-major-mode-is 'objc-mode) |
| 8120 | (< (point) indent-point)) | 8206 | (catch 'not-in-directive |
| 8121 | (c-forward-syntactic-ws) | 8207 | (c-beginning-of-statement-1 lim) |
| 8122 | (if (>= (point) indent-point) | 8208 | (setq placeholder (point)) |
| 8123 | (throw 'not-in-directive t)) | 8209 | (while (and (c-forward-objc-directive) |
| 8124 | (setq placeholder (point))) | 8210 | (< (point) indent-point)) |
| 8125 | nil)))) | 8211 | (c-forward-syntactic-ws) |
| 8212 | (if (>= (point) indent-point) | ||
| 8213 | (throw 'not-in-directive t)) | ||
| 8214 | (setq placeholder (point))) | ||
| 8215 | nil))))) | ||
| 8126 | ;; For historic reasons we anchor at bol of the last | 8216 | ;; For historic reasons we anchor at bol of the last |
| 8127 | ;; line of the previous declaration. That's clearly | 8217 | ;; line of the previous declaration. That's clearly |
| 8128 | ;; highly bogus and useless, and it makes our lives hard | 8218 | ;; highly bogus and useless, and it makes our lives hard |
| @@ -8177,6 +8267,11 @@ comment at the start of cc-engine.el for more info." | |||
| 8177 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) | 8267 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) |
| 8178 | (c-add-syntax 'template-args-cont (c-point 'boi))) | 8268 | (c-add-syntax 'template-args-cont (c-point 'boi))) |
| 8179 | 8269 | ||
| 8270 | ;; CASE 5Q: we are at a statement within a macro. | ||
| 8271 | (macro-start | ||
| 8272 | (c-beginning-of-statement-1 containing-sexp) | ||
| 8273 | (c-add-stmt-syntax 'statement nil t containing-sexp paren-state)) | ||
| 8274 | |||
| 8180 | ;; CASE 5M: we are at a topmost continuation line | 8275 | ;; CASE 5M: we are at a topmost continuation line |
| 8181 | (t | 8276 | (t |
| 8182 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) | 8277 | (c-beginning-of-statement-1 (c-safe-position (point) paren-state)) |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index bd9af00d9c6..b3c0a578649 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -685,6 +685,16 @@ definition, or nil if the language doesn't have any." | |||
| 685 | (c-lang-defvar c-opt-cpp-macro-define-start | 685 | (c-lang-defvar c-opt-cpp-macro-define-start |
| 686 | (c-lang-const c-opt-cpp-macro-define-start)) | 686 | (c-lang-const c-opt-cpp-macro-define-start)) |
| 687 | 687 | ||
| 688 | (c-lang-defconst c-opt-cpp-macro-define-id | ||
| 689 | ;; Regexp matching everything up to the end of the identifier defined | ||
| 690 | ;; by a cpp define. | ||
| 691 | t (if (c-lang-const c-opt-cpp-macro-define) | ||
| 692 | (concat (c-lang-const c-opt-cpp-prefix) ; # | ||
| 693 | (c-lang-const c-opt-cpp-macro-define) ; define | ||
| 694 | "[ \t]+\\(\\sw\\|_\\)+"))) | ||
| 695 | (c-lang-defvar c-opt-cpp-macro-define-id | ||
| 696 | (c-lang-const c-opt-cpp-macro-define-id)) | ||
| 697 | |||
| 688 | (c-lang-defconst c-cpp-expr-directives | 698 | (c-lang-defconst c-cpp-expr-directives |
| 689 | "List if cpp directives (without the prefix) that are followed by an | 699 | "List if cpp directives (without the prefix) that are followed by an |
| 690 | expression." | 700 | expression." |
| @@ -882,7 +892,7 @@ since CC Mode treats every identifier as an expression." | |||
| 882 | 892 | ||
| 883 | (c-lang-defconst c-overloadable-operators | 893 | (c-lang-defconst c-overloadable-operators |
| 884 | "List of the operators that are overloadable, in their \"identifier | 894 | "List of the operators that are overloadable, in their \"identifier |
| 885 | form\". See also `c-op-identitier-prefix'." | 895 | form\". See also `c-op-identifier-prefix'." |
| 886 | t nil | 896 | t nil |
| 887 | c++ '("new" "delete" ;; Can be followed by "[]" but we ignore that. | 897 | c++ '("new" "delete" ;; Can be followed by "[]" but we ignore that. |
| 888 | "+" "-" "*" "/" "%" | 898 | "+" "-" "*" "/" "%" |
| @@ -905,7 +915,7 @@ form\". See also `c-op-identitier-prefix'." | |||
| 905 | (c-lang-defvar c-overloadable-operators-regexp | 915 | (c-lang-defvar c-overloadable-operators-regexp |
| 906 | (c-lang-const c-overloadable-operators-regexp)) | 916 | (c-lang-const c-overloadable-operators-regexp)) |
| 907 | 917 | ||
| 908 | (c-lang-defconst c-opt-op-identitier-prefix | 918 | (c-lang-defconst c-opt-op-identifier-prefix |
| 909 | "Regexp matching the token before the ones in | 919 | "Regexp matching the token before the ones in |
| 910 | `c-overloadable-operators' when operators are specified in their | 920 | `c-overloadable-operators' when operators are specified in their |
| 911 | \"identifier form\". This typically matches \"operator\" in C++ where | 921 | \"identifier form\". This typically matches \"operator\" in C++ where |
| @@ -916,8 +926,15 @@ identifier is listed in `c-overloadable-operators'. | |||
| 916 | This regexp is assumed to not match any non-operator identifier." | 926 | This regexp is assumed to not match any non-operator identifier." |
| 917 | t nil | 927 | t nil |
| 918 | c++ (c-make-keywords-re t '("operator"))) | 928 | c++ (c-make-keywords-re t '("operator"))) |
| 919 | (c-lang-defvar c-opt-op-identitier-prefix | 929 | (c-lang-defvar c-opt-op-identifier-prefix |
| 920 | (c-lang-const c-opt-op-identitier-prefix)) | 930 | (c-lang-const c-opt-op-identifier-prefix)) |
| 931 | |||
| 932 | ;; Note: the following alias is an old name which was a mis-spelling. It has | ||
| 933 | ;; been corrected above and throughout cc-engine.el. It will be removed at | ||
| 934 | ;; some release very shortly in the future. ACM, 2006-04-14. | ||
| 935 | (defalias 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix) | ||
| 936 | (make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix | ||
| 937 | "CC Mode 5.31.4, 2006-04-14") | ||
| 921 | 938 | ||
| 922 | (c-lang-defconst c-other-op-syntax-tokens | 939 | (c-lang-defconst c-other-op-syntax-tokens |
| 923 | "List of the tokens made up of characters in the punctuation or | 940 | "List of the tokens made up of characters in the punctuation or |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 40407f3819a..993fd102951 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -288,8 +288,9 @@ control). See \"cc-mode.el\" for more info." | |||
| 288 | c-mode-base-map global-map)) | 288 | c-mode-base-map global-map)) |
| 289 | 289 | ||
| 290 | ;; RMS says don't make these the default. | 290 | ;; RMS says don't make these the default. |
| 291 | ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) | 291 | ;; (April 2006): RMS has now approved these commands as defaults. |
| 292 | ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | 292 | (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) |
| 293 | (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | ||
| 293 | 294 | ||
| 294 | (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) | 295 | (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) |
| 295 | (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) | 296 | (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) |
| @@ -728,8 +729,8 @@ Note that the style variables are always made local to the buffer." | |||
| 728 | ;; We prevent this by temporarily removing `mode' from the Local Variables | 729 | ;; We prevent this by temporarily removing `mode' from the Local Variables |
| 729 | ;; section. | 730 | ;; section. |
| 730 | (if (or c-file-style c-file-offsets) | 731 | (if (or c-file-style c-file-offsets) |
| 731 | (c-tentative-buffer-changes | 732 | (let ((hack-local-variables-hook nil) (inhibit-read-only t)) |
| 732 | (let ((hack-local-variables-hook nil)) | 733 | (c-tentative-buffer-changes |
| 733 | (c-remove-any-local-eval-or-mode-variables) | 734 | (c-remove-any-local-eval-or-mode-variables) |
| 734 | (hack-local-variables)) | 735 | (hack-local-variables)) |
| 735 | nil)))) | 736 | nil)))) |
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index 81048d52072..98bc4e1f801 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -68,7 +68,10 @@ | |||
| 68 | (arglist-intro . c-lineup-arglist-intro-after-paren) | 68 | (arglist-intro . c-lineup-arglist-intro-after-paren) |
| 69 | (arglist-close . c-lineup-arglist) | 69 | (arglist-close . c-lineup-arglist) |
| 70 | (inline-open . 0) | 70 | (inline-open . 0) |
| 71 | (brace-list-open . +))) | 71 | (brace-list-open . +) |
| 72 | (topmost-intro-cont | ||
| 73 | . (first c-lineup-topmost-intro-cont | ||
| 74 | c-lineup-gnu-DEFUN-intro-cont)))) | ||
| 72 | (c-special-indent-hook . c-gnu-impose-minimum) | 75 | (c-special-indent-hook . c-gnu-impose-minimum) |
| 73 | (c-block-comment-prefix . "")) | 76 | (c-block-comment-prefix . "")) |
| 74 | 77 | ||
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 0f0da939230..2f3e83886d2 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -622,10 +622,10 @@ name: | |||
| 622 | empty-defun-braces -- Clean up empty defun braces by placing the | 622 | empty-defun-braces -- Clean up empty defun braces by placing the |
| 623 | braces on the same line. Clean up occurs when | 623 | braces on the same line. Clean up occurs when |
| 624 | the defun closing brace is typed. | 624 | the defun closing brace is typed. |
| 625 | one-liner-defun -- If the code inside a function body is a single | 625 | one-liner-defun -- If the code inside a function body can fit in |
| 626 | line then remove any newlines between that | 626 | a single line, then remove any newlines |
| 627 | line and the defun braces so that the whole | 627 | between that line and the defun braces so that |
| 628 | body becomes a single line. | 628 | the whole body becomes a single line. |
| 629 | `c-max-one-liner-length' gives the maximum | 629 | `c-max-one-liner-length' gives the maximum |
| 630 | length allowed for the resulting line. Clean | 630 | length allowed for the resulting line. Clean |
| 631 | up occurs when the closing brace is typed. | 631 | up occurs when the closing brace is typed. |
| @@ -1604,7 +1604,8 @@ statically (e.g. with `setq').") | |||
| 1604 | 1604 | ||
| 1605 | (defvar c-indentation-style nil | 1605 | (defvar c-indentation-style nil |
| 1606 | "Name of the currently installed style. | 1606 | "Name of the currently installed style. |
| 1607 | Don't change this directly; call `c-set-style' instead.") | 1607 | Don't change this directly; call `c-set-style' instead, or set the variable |
| 1608 | `c-file-style' in the file's Local Variable list.") | ||
| 1608 | 1609 | ||
| 1609 | (defvar c-current-comment-prefix nil | 1610 | (defvar c-current-comment-prefix nil |
| 1610 | "The current comment prefix regexp. | 1611 | "The current comment prefix regexp. |