summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
Commit message (Collapse)AuthorAgeFilesLines
* Fix edebug-spec on c-lang-defvar.Alan Mackenzie2017-02-181-5/+3
| | | | | | | | | | This allows c-lang-defvars with the symbol 'dont-doc in the place of the optional documentation to be instrumented for edebug. lisp/progmodes/cc-langs.el (top-level): Amend the edebug-spec for c-lang-defvar. (c-opt-identifier-concat-key, c-decl-prefix-or-start-re): remove redundant 'dont-doc.
* Handle syntactic WS cache properties more accurately at buffer changes.Alan Mackenzie2017-01-111-0/+9
| | | | | | | | | | | | | | | | | | | | | This fixes bug #25362. * lisp/progmodes/cc-engine.el (c-sws-lit-type, c-sws-lit-limits) (c-invalidate-sws-region-before, c-invalidate-sws-region-after-del) (c-invalidate-sws-region-after-ins): New variables and functions. (c-invalidate-sws-region-after): Change from a defsubst to a defun. Also pass it the standard OLD-LEN argument. Call both c-invalidate-sws-region-after-{ins,del} to check for "dangerous" WS cache properties. * lisp/progmodes/cc-langs.el (c-block-comment-ender-regexp): New language variable. * lisp/progmodes/cc-mode.el (c-before-change): Call c-invalidate-sws-region-before. (c-after-change): Pass old-len to c-invalidate-sws-region-after.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | CC Mode: Fix the fontification of a spuriously recognised enum member.Alan Mackenzie2016-12-301-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | The "enum" was in an argument list, but triggered the fontification of a following identifier in the function block as though it were in an enum declaration. * lisp/progmodes/cc-fonts.el (c-font-lock-enum-body): New function. (c-basic-matchers-after): Replace the inline stanza for enum elements with a call to c-font-lock-enum-body. * lisp/progmodes/cc-langs.el (c-enum-clause-introduction-re): New language variable.
* | Partially correct fontification of "(b*3)", and the like, in C++ ModeAlan Mackenzie2016-12-291-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | This problem is caused by the fundamental ambiguity in C++ between argument declarations and initialisation clauses. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): If we have an open paren preceded by an arithmetic operator, we give this the context nil, not 'arglist. * lisp/progmodes/cc-langs.el (c-arithmetic-operators, c-arithmetic-op-regexp): New lang consts and vars.
* | Correctly fontify C++ direct initializations with parens inside functionsAlan Mackenzie2016-09-111-2/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Or, more clearly, when something looks like a function declaration and it's inside a function, fontify it as a direct initialization. For this purpose, introduce a "brace stack" for each buffer, where an entry on the brace stack states how deeply nested a particular position is inside braces inside a "top level", which includes classes and namespaces. Also introduce a new "context", "top", with which c-font-lock-declarations signals to c-forward-decl-or-cast-1 that point is at the top level. * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): add c-truncate-bs-cache. (c-flat-decl-block-kwds, c-brace-stack-thing-key, c-brace-stack-no-semi-key) (c-type-decl-operator-prefix-key): new language constants/variables. * lisp/progmodes/cc-engine.el (c-bs-interval, c-bs-cache, c-bs-cache-limit) (c-bs-prev-pos, c-bs-prev-stack): New mostly local variables for the brace stack cache. (c-init-bs-cache, c-truncate-bs-cache, c-truncate-bs-cache, c-brace-stack-at) (c-bs-at-toplevel-p): New functions which manipulate the brace stack (cache). (c-find-decl-prefix-search): Keep track of whether we're at top level. (c-find-decl-spots): New local variable cfd-top-level which records what it says. On calling cfd-fun, pass cfd-top-level as an additional argument. (c-forward-declarator): Add new element DECORATED to the result list. Set it to non-nil when a match for c-type-decl-operator-prefix-key is found. (c-forward-decl-or-cast-1): Handle the newly introduced context "top". Introduce "CASE 9.5", which recognizes direct initializations. * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare) (c-font-lock-enum-tail, c-font-lock-cut-off-declarators) (c-font-lock-enclosing-decls, c-simple-decl-matchers, c-basic-matchers-after): Add appropriate `not-top' argument to calls to c-font-lock-declarators. (c-font-lock-declarators): Additional parameter `not-top'. Use not-top to participate in the decision whether to fontify an identifier as a function or a variable. (c-font-lock-declarations): The internal lambda function takes an additional argument `toplev' from c-find-decl-spots, which it uses in determining the "context" of a declaration. Add appropriate `not-top' argument to calls to c-font-lock-declarators. (c-font-lock-objc-methods): Add extra parameter to internal lambda function, like for c-font-lock-declarators. * lisp/progmodes/cc-mode.el (c-basic-common-init): Initialize the brace stack cache.
* | Handle the C++ "identifiers" "final" and "override" correctly.Alan Mackenzie2016-08-271-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #24319, allowing destructors affixed with these identifiers to be correctly fontified. * lisp/progmodes/cc-engine.el (c-forward-type, c-forward-decl-or-cast-1): After reaching the "end" of a type expression, skip over any occurrences of c-type-decl-suffix-ws-ids-key. * lisp/progmodes/cc-langs.el (c-type-modifier-kwds): Remove "override" and "final" from the C++ value. (c-type-decl-suffix-ws-ids-kwds, c-type-decl-suffix-ws-ids-key): New lang constants/variables for "final" and "override".
* | Adapt CC Mode for C++11 uniform initialization.Alan Mackenzie2016-08-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For fontification, introduce a new "context", 'non-decl, to be used for brace lists; also a new value for the property 'c-type, called 'c-not-decl. * lisp/progmodes/cc-engine.el (c-back-over-compound-identifier): Check that an ostensible symbol we're going to move over isn't a keyword. (c-forward-decl-or-cast-1): CASE 1: Where we have two consecutive identifiers (hence a declaration), and an unmatched open paren, perform c-fdoc-shift-type-backwards to recognize the partial construct correctly. Whilst checking a type decl expression, check for and handle C++11's "copy initialization", where we have <type>(<constant>). Recognize <id><id>(... (where the paren is unclosed) as a declaration. (c-looking-at-or-maybe-in-bracelist): New function, extracted from c-inside-bracelist-p. Recognize as bracelists "{"s which are preceded by valid tokens other than "=". Recognize a bracelist when preceded by a template declaration. (c-inside-bracelist-p): Call c-looking-at-or-maybe-in-bracelist in place of much inline code. (c-looking-at-inexpr-block): Amend so that it won't wrongly recognise an initialization starting "({" as an in-expression block, by checking for semicolons, as opposed to commas, separating elements inside it. (c-guess-continued-construct): (CASE B-2): Recognize a brace-list-open by calling c-looking-at-or-maybe-in-bracelist rather than checking for a preceding "=". (CASE B-5): New code to recognize new construct "return { ...}". (c-guess-basic-syntax): (CASE 5A.3): Additionally recognize a "{" preceded by "return", or "{" preceded by <type><identifier> as a bracelist. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize brace lists, giving them `context' 'non-decl. Pass over elements of one by regexp search for "," rather than calling c-forward-decl-or-cast-1. * lisp/progmodes/cc-langs.el (c-return-kwds, c-return-key): New lang constants/variables to recognize "return". (c-pre-id-bracelist-key): New lang constant/variable to recognize tokens which, when preceding an identifier followed by a brace, signify the brace as a bracelist. * lisp/progmodes/cc-mode.el (c-fl-decl-start): When searching outwards for the start of a "local" declaration, move out from an enclosing brace when that is the start of a brace list.
* | ; Spelling fixesPaul Eggert2016-08-211-1/+1
| |
* | Handle C++11 lambda functions.Alan Mackenzie2016-08-151-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-looking-at-inexpr-block): Enhance also to handle C++ lambda functions. (c-looking-at-c++-lambda-capture-list): New function. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Recognize the parameter list of a lambda function and set `context' and `c-restricted-<>-arglists' suitably for it. (c-font-lock-c++-lambda-captures): New function. (c-complex-decl-matchers): Insert c-font-lock-c++-lambda-captures into it. * lisp/progmodes/cc-langs.el (c-pre-lambda-tokens, c-pre-lambda-tokens-re): New language constants/variables. (c-paren-nontype-kwds): Include "noexcept" in the C++ value. * lisp/progmodes/cc-mode.el (c-fl-decl-start): Handle being in a C++ lambda function capture list.
* | Fontify C++ parameter packs.Alan Mackenzie2016-07-231-0/+12
| | | | | | | | | | | | | | | | | | | | This fixes debbugs #23610. * lisp/progmodes/cc-langs.el (c-pack-ops, c-pack-key): New c-lang-defconsts/defvars. (c-type-decl-prefix-key): Add "..." and "&&" into the C++ version. * lisp/progmodes/cc-engine.el (c-forward-type): Handle matches of c-pack-key.
* | Java Mode: Handle strings as case labels correctly.Alan Mackenzie2016-07-231-2/+2
| | | | | | | | | | | | | | This fixes debbugs #23901. * lisp/progmodes/cc-langs.el (c-nonlabel-token-key): Remove "\"" from the Java value.
* | Implement ' separators in C++ integer literals.Alan Mackenzie2016-06-241-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): insert c-before-after-change-digit-quote into the C++ value. (c-before-font-lock-functions): Insert c-depropertize-new-text into the values for all languages. Insert c-before-after-change-digit-quote into the C++ value. * lisp/progmodes/cc-mode.el (c-depropertize-CPP): Wrap the function in c-save-buffer-state. (c-depropertize-new-text, c-before-after-change-digit-quote): New functions.
* | Handle C++ raw strings.Alan Mackenzie2016-06-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-raw-string-pos, c-depropertize-raw-string) (c-depropertize-raw-strings-in-region, c-before-change-check-raw-strings) (c-propertize-raw-string-opener, c-after-change-re-mark-raw-strings): New functions. * lisp/progmodes/cc-fonts.el (c-basic-matchers-before): Insert a clause for c-font-lock-raw-strings. (c-font-lock-raw-strings): New function. * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Insert c-before-change-check-raw-strings into the C++ value, and c-depropertize-CPP into the values for C, C++, and Objective C. (c-before-font-lock-functions): Insert c-after-change-re-mark-raw-strings into the C++ value. * lisp/progmodes/cc-mode.el (c-old-BEG, c-old-END): New variables. (c-depropertize-CPP): New function, extracted from c-neutralize-syntax-in-and-mark-CPP. (c-neutralize-syntax-in-and-mark-CPP): Remove the call to c-clear-char-property-with-value for 'syntax-table value '(1) at the beginning of the function. (c-after-change): Set c-old-BEG and c-old-END to the current values of c-new-BEG and c-new-END.
* | Correct fontification and indentation of C++'s "constexpr" expressionsAlan Mackenzie2016-06-011-3/+3
| | | | | | | | | | * lisp/progmodes/cc-langs.el (c-type-modifier-kwds): Remove "constexpr". (c-modifier-kwds): Add "constexpr".
* | Rationalize the use of c-new-BEG and c-new-END in CC Mode.Alan Mackenzie2016-05-291-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the now redundant c-old-BOM and c-old-EOM. * lisp/progmodes/cc-engine.el (c-macro-cache-syntactic): Change and simplify meaning. (c-macro-cache-no-comment): New variable. (c-invalidate-macro-cache, c-beginning-of-macro, c-end-of-macro): incorporate the new c-macro-cache-no-comment. (c-syntactic-end-of-macro): Make better use of c-macro-cache-syntactic. (c-no-comment-end-of-macro): New function. * lisp/progmodes/cc-langs.el (c-before-font-lock-functions): Add c-extend-font-lock-region-for-macros to C/C++/ObjC value. * lisp/progmodes/cc-mode.el (c-old-BOM, c-old-EOM): Remove. (c-extend-region-for-CPP): Put results in c-new-BEG/END rather than c-old-BOM/EOM. (c-extend-font-lock-region-for-macros): Simplify meaning, no longer returning a cons for the new region, since the function is now called as an after-change function. No longer adjust c-new-END for the length of inserted/deleted text. Move the size restrictions on macros to here from c-neutralize-syntax-in-and-mark-CPP. (c-neutralize-syntax-in-and-mark-CPP): No longer adjust c-new-BEG/END here. Use c-no-comment-end-of-macro rather than c-syntactic-end-of-macro to find the upper boundary to "neutralize" syntactically obtrusive characters. (c-change-expand-fl-region): Don't set c-new-END to next BOL when already at one.
* | C++ Mode: attribute in class declaration fouls up indentation. Fix!Alan Mackenzie2016-05-281-0/+4
| | | | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Add code to skip back over noise clauses and attribute clauses. * lisp/progmodes/cc-langs.el (c-paren-nontype-key): New language variable.
* | c-forward-<>-arglist no longer directly applies face properties in Java Mode.Alan Mackenzie2016-04-251-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the calling of c-restore-<>-properties from c-common-init without the test suite giving spurious errors. * lisp/progmodes/cc-engine.el (c-forward-<>-arglist): Remove the form that sets face properties. (c-forward-<>-arglist-recur): Reformulate the bit that handles types inside template brackets using c-inside-<>-type-key. Don't bind c-record-type-identifiers or c-record-found-types around the recursive call, allowing positions of found types to flow back to the caller. * lisp/progmodes/cc-langs.el (c-inside-<>-type-kwds, c-inside-<>-type-key): new lang consts/var. * lisp/progmodes/cc-mode.el (c-common-init): Don't remove c-restore-<>-properties from the list of functions called at mode initialization.
* | Add fontification for a C declaration which looks like a function call.Alan Mackenzie2016-04-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | For example, "t1 *fn (t2 *b);". * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add new variable at-decl-start, setting it to whether the putative decl starts immediately after ; or { or }. Accept such a construct as a decl when at-decl-start is non-nil. * lisp/progmodes/cc-langs.el (c-pre-start-tokens): New language variable.
* | ; Spelling fixesPaul Eggert2016-04-211-1/+1
| |
* | Don't confuse "::" with ":" when trying to parse member initializers.Alan Mackenzie2016-03-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-back-over-member-initializers): Check more robustly for ":" token when searching backwards for it. * lisp/progmodes/cc-langs (c-:$-multichar-token-regexp): New language variable. [This reapplies commit 9e5452f7166e3634f2d8e943815ed722e1672714, which was inadvertently lost by merge commit 7823745acbe9b87eea2db4ef434e379fc903ec35.]
* | Handle "noise" macros and compiler directives.Alan Mackenzie2016-02-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-langs.el (c-symbol-char-key): New language variable. * lisp/progmodes/cc-vars.el (c-noise-macro-names) (c-noise-macro-with-parens-names): New customizable variables. (c-noise-macro-name-re, c-noise-macro-with-parens-name-re): New variables. (c-make-noise-macro-regexps): New function. * lisp/progmodes/cc-engine.el (c-forward-sws, c-backward-sws): Adapt to treat members of c-noise-macro-names as whitespace. (c-forward-noise-clause): New function. (c-forward-keyword-prefixed-id, c-forward-type, c-forward-declarator) (c-forward-decl-or-cast-1, c-backward-over-enum-header) (c-guess-basic-syntax CASE 5A.3, CASE 5A.5, CASE 9A): Handle "noise clauses" in parallel with, e.g., "hangon key clauses". * lisp/progmodes/cc-fonts.el (c-complex-decl-matchers): Handle "noise clauses" in parallel with "prefix-spec keywords". * lisp/progmodes/cc-mode.el (c-mode, c++-mode, objc-mode): call c-make-noise-macro-regexps to initialize the internal variables. * doc/misc/cc-mode.texi ("Noise Macros"): New section documenting the new facilities.
* | Merge from origin/emacs-25John Wiegley2016-02-151-3/+30
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | d4b93e1 Minor fixes in global-auto-composition-mode 02b037b Allow arithmetic operators inside C++ template constructs. 44b16f6 Avoid crashes in semi-malformed 'condition-case' 652e5b4 Allow arithmetic operators inside C++ template constructs. d9ea795 Fix regression with 'recent-keys' and keyboard macros 903603f Fix wording in a doc-view.el comment cf79616 ; Spelling fixes f8bf1b3 CONTRIBUTE cleanups and updates f3aaca3 Port USE_STACK_LISP_OBJECTS fix to Clang 1834ac7 Port to x86 GCC 4.3.1 and earlier 8482949 Fix point movement under 'scroll-conservatively' c1313b5 Replace colon in file name (not legal on Windows) f7af26c Fix a typo in edt.texi 8badf95 Make 'mmap_realloc' on MS-Windows more reliable 856cd94 Grep alias `all' shall not match parent directory
| * Allow arithmetic operators inside C++ template constructs.Alan Mackenzie2016-02-151-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes debbugs #22486. This corrects the previous patch with this message which was empty. * lisp/progmodes/cc-langs.el (c-multichar->-op-not->>-regexp): New language variable. (c-<>-notable-chars-re): New language variable. * lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur): User c-<>-notable-chars-re in place of the former fixed string in searching for places to stop and examine. Use c-multichar->-op-not->>-regexp to check that a found ">" is not part of a multichar operator in place of the former c->-op-without->-cont-regexp. Add code to skip forwards over a balanced parenthesized expression.
* | Merge from origin/emacs-25Paul Eggert2016-01-301-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | 3f481ad Rename xref-query-replace to xref-query-replace-in-results 62f4ed4 Update cl-defgeneric and cl-defmethod docstrings 2111e0e Comment out next-error-function integration in xref 4e11ad3 Correct a use of "which" in intro.texi a1865bc Distinguish the two meanings of Java's keyword "default". Fixes bug #22358. 76045f7 Don't operate on menu bar of nonexistent frame c32f3bc Unbreak the GNUstep build.
| * Distinguish the two meanings of Java's keyword "default". Fixes bug #22358.Alan Mackenzie2016-01-231-2/+2
| | | | | | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-guess-basic-syntax CASE 14): Check the context of case labels (including "default") more rigorously. (c-guess-basic-syntax CASE 15): Consequential amendment. * lisp/progmodes/cc-langs.el (c-modifier-kwds): Add "default" to Java's value.
| * Don't confuse "::" with ":" when trying to parse member initializers.Alan Mackenzie2016-01-151-0/+8
|/ | | | | | | | * lisp/progmodes/cc-engine.el (c-back-over-member-initializers): Check more robustly for ":" token when searching backwards for it. * lisp/progmodes/cc-langs (c-:$-multichar-token-regexp): New language variable.
* Java Mode: Fontify identifiers in the presence of annotations.Alan Mackenzie2016-01-111-0/+13
| | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-forward-annotation): Tidy up the coding: Don't move point when the defun fails. (c-forward-decl-or-cast-1): Correct a usage of match data. * lisp/progmodes/cc-fonts.el (c-font-lock-maybe-decl-faces): Remove. (c-font-lock-declarations): Use the new c-maybe-decl-faces in place of the removed variable. * lisp/progmodes/cc-langs.el (c-maybe-decl-faces): New language variable.
* Remove function wrongly on AWK Mode value of context fontification hook.Alan Mackenzie2016-01-051-2/+2
| | | | | | | | * lisp/progmodes/cc-langs.el (c-before-context-fontification-functions): swap order of entries so that awk's entry isn't superseded by the default. * lisp/progmodes/cc-mode.el (c-before-context-fl-expand-region): Correct to handle nil value of c-before-context-fontification-functions.
* Apply text properties for <, > in new after-change function (C++ Java Modes).Alan Mackenzie2016-01-041-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are category/syntax-table properties to give < and > paren syntax. Also apply certain `c-type' text properties to the insides of <..> constructs to ensure that identifiers contained by them get fontified. This patch fixes bug #681. * lisp/progmodes/cc-cmds.el (c-electric-lt-gt): Reformulate due to new after-change action. * lisp/progmodes/cc-engine.el (c-before-change-check-<>-operators): Expand change region to include <s and >s which might not be already marked as parens, rather than just when paren text properties are removed. (c-restore-<>-properties): New after-change function, which applies text properties marking < and > with paren syntax. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Ensure `c-type' properties are applied to the interiors of <...> constructs, to ensure fontification of identifiers there. * lisp/progmodes/cc-langs.el (c-before-font-lock-functions): Add c-restore-<>-properties to this list for C++ and Java. * lisp/progmodes/cc-mode.el (c-common-init): When invoking c-before-font-lock-functions, exclude c-restore-<>-properties from the functions invoked. (c-before-change): Initialize c-new-BEG/END here (rather than c-after-change) to allow modification by before-change functions. (c-after-change): Amend c-new-END here, rather than initializing it and c-new-BEG.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Allow line comments ending with escaped NL to be continued to the next line.Alan Mackenzie2015-12-281-0/+8
| | | | | | | | | | | | | | | Use this in C, C++, and Objective C Modes. Fixes bug#22246 * src/syntax.c (comment-end-can-be-escaped): New buffer local variable. (forw-comment, back-comment): On encountering an end of comment character, test whether it is escaped when `comment-end-can-be-escaped' is non-nil. * doc/lispref/syntax.texi (Control Parsing): Describe `comment-end-can-be-escaped'. * etc/NEWS (Lisp Changes): Describe `comment-end-can-be-escaped'. * lisp/progmodes/cc-langs.el: New c-lang-setvar `comment-end-can-be-escaped'.
* CC Mode: eliminate almost all byte compilation warningsAlan Mackenzie2015-11-241-2/+5
| | | | | | | | | | | | | | * lisp/progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): Remove. (cc-require): Remove the crude hack that saved and restored byte-compile-noruntime-functions. (cc-conditional-require, cc-conditional-require-after-load): New macros. * lisp/progmodes/cc-defs.el (top level): Reformulate code which loaded cc-fix.el using the new macros in cc-bytecomp.el. * lisp/progmodes/cc-langs.el (c++-template-syntax-table) (c-no-parens-syntax-table): Add extra "(eval ..)"s around "'(lambda ..)" forms to remove the superflous quotes.
* Backslash cleanup in Elisp source filesPaul Eggert2015-09-171-21/+21
| | | | | | | | | | | This patch should not change behavior. It typically omits backslashes where they are redundant (e.g., in the string literal "^\$"). In a few places, insert backslashes where they make regular expressions clearer: e.g., replace "^\*" (equivalent to "^*") with "^\\*", which has the same effect as a regular expression. Also, use ‘\ %’ instead of ‘\%’ when avoiding confusion with SCCS IDs, and similarly use ‘\ $’ instead of ‘\$’ when avoiding confusion with RCS IDs, as that makes it clearer that the backslash is intended.
* * lisp/progmodes/cc-langs.el (c-make-init-lang-vars-fun): Use dolistStefan Monnier2015-09-141-8/+6
|
* Replace `cadar' with `cadr/car', since `cadar' is problematic on Emacs.Alan Mackenzie2015-09-141-2/+2
| | | | | (c-make-init-lang-vars-fun): Replace two occurrences of `cadar' with `cadr/car'.
* Fix some more docstring etc. quoting problemsPaul Eggert2015-09-031-6/+6
| | | | | | | | | | | | | | | | | | | Mostly these fixes prevent the transliteration of apostrophes that should stay apostrophes. Also, prefer curved quotes in Bahá’í proper names, as that’s the preferred Bahá’í style and these names are chock-full of non-ASCII characters anyway. * lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload) (eieio-defclass-internal): * lisp/emacs-lisp/eieio.el (defclass): * lisp/hi-lock.el (hi-lock-mode): Don’t transliterate Lisp apostrophes when generating a doc string or diagnostic. * lisp/international/mule-diag.el (list-coding-systems-1): * lisp/international/ogonek.el (ogonek-jak, ogonek-how): * lisp/mail/sendmail.el (sendmail-query-user-about-smtp): * lisp/vc/ediff-mult.el (ediff-redraw-registry-buffer): * lisp/vc/ediff-ptch.el (ediff-fixup-patch-map): Substitute quotes before putting them in the help buffer.
* Quoting fixes in lisp/progmodesPaul Eggert2015-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-bos-report-error): * lisp/progmodes/cpp.el (cpp-edit-reset): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional) (etags-tags-apropos, list-tags, tags-apropos): * lisp/progmodes/executable.el (executable-set-magic): * lisp/progmodes/octave.el (octave-sync-function-file-names) (octave-help, octave-find-definition-default-filename) (octave-find-definition): Respect text quoting style in doc strings and diagnostics. * lisp/progmodes/cc-langs.el (c-populate-syntax-table): * lisp/progmodes/verilog-mode.el (verilog-auto-reset-widths): * lisp/progmodes/vhdl-mode.el (vhdl-electric-quote): Escape apostrophes in doc strings. * lisp/progmodes/cmacexp.el (c-macro-expansion): Use straight quoting in ASCII comment. * lisp/progmodes/idlwave.el (idlwave-auto-fill-split-string) (idlwave-pad-keyword): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate) (vhdl-electric-open-bracket, vhdl-electric-close-bracket): (vhdl-electric-semicolon, vhdl-electric-comma) (vhdl-electric-period, vhdl-electric-equal): Use directed quotes in diagnostics and doc strings.
* Prefer directed to neutral quotesPaul Eggert2015-08-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefer directed to neutral quotes in docstings and diagnostics. In docstrings, escape apostrophes that would otherwise be translated to curved quotes using the newer, simpler rules. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-lang.el (math-read-giac-subscr) (math-read-math-subscr): * lisp/calc/calc-misc.el (report-calc-bug): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/dabbrev.el (dabbrev-expand): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/elint.el (elint-get-top-forms): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emulation/viper-cmd.el (viper-toggle-search-style): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-arg.el (eshell-parse-arguments): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/files-x.el (modify-file-local-variable): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer) (filesets-update-pre010505): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/gnus/auth-source.el (auth-source-netrc-parse-entries): * lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer) (gnus-agent-fetch-headers): * lisp/gnus/gnus-int.el (gnus-start-news-server): * lisp/gnus/gnus-registry.el: (gnus-registry--split-fancy-with-parent-internal): * lisp/gnus/gnus-score.el (gnus-summary-increase-score): * lisp/gnus/gnus-start.el (gnus-convert-old-newsrc): * lisp/gnus/gnus-topic.el (gnus-topic-rename): * lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/gnus/spam.el (spam-check-blackholes): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mpc.el (mpc-playlist-rename): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/tramp-cache.el: * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-bibtex.el (org-bibtex-fields): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question) (dun-rooms, dun-endgame-questions): * lisp/progmodes/ada-mode.el (ada-goto-matching-start): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/antlr-mode.el (antlr-options-alists): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/server.el (server-get-auth-key): * lisp/subr.el (version-to-list): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/vc/ediff-diff.el (ediff-same-contents): * lisp/vc/vc-cvs.el (vc-cvs-mode-line-string): * test/automated/tramp-tests.el (tramp-test33-asynchronous-requests): Use directed rather than neutral quotes in diagnostics.
* * lisp/progmodes/cc-*.el: Fix up commenting styleStefan Monnier2015-08-211-4/+4
| | | | | | | | | | | * lisp/progmodes/cc-vars.el, lisp/progmodes/cc-styles.el: * lisp/progmodes/cc-mode.el, lisp/progmodes/cc-menus.el: * lisp/progmodes/cc-langs.el, lisp/progmodes/cc-guess.el: * lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-engine.el: * lisp/progmodes/cc-defs.el, lisp/progmodes/cc-cmds.el: * lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-awk.el: * lisp/progmodes/cc-align.el, lisp/net/soap-client.el: Fix up commenting style.
* Introduce new macros to cover Emacs's new names in cl-lib.el.Alan Mackenzie2015-08-121-100/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also eliminates `mapcan' warnings in XEmacs. progmodes/cc-defs.el (c--mapcan-status): new variable to characterise [X]Emacs versions. (top-level): Require either 'cl or 'cl-lib, depending on c--mapcan-status. Change this back to cc-external-require from an eval-when-compile require. (c--mapcan, c--set-difference, c--intersection, c--macroexpand-all) (c--delete-duplicates): New macros which expand into either old or new names. (c-make-keywords-re, c-lang-defconst, c-lang-const) Use the new macros rather than the old names. progmodes/cc-engine.el (c-declare-lang-variables): Use c--mapcan rather than mapcan. progmodes/cc-fonts.el (c-compose-keywords-list): Use c--mapcan. progmodes/cc-langs.el (top-level): Require either 'cl or 'cl-lib, depending on c--mapcan-status. (c-filter-ops, c-all-op-syntax-tokens, c-assignment-op-regexp) (c-type-start-kwds, c-prefix-spec-kwds, c-specifier-key) (c-not-decl-init-keywords, c-not-primitive-type-keywords) (c-paren-any-kwds, c-<>-sexp-kwds, c-block-stmt-kwds, c-expr-kwds) (c-decl-block-key, c-keywords, c-keywords-obarray) (c-regular-keywords-regexp, c-primary-expr-regexp, c-primary-expr-regexp) (c-block-prefix-disallowed-chars, c-known-type-key, c-nonlabel-token-key) (c-make-init-lang-vars-fun): Use the new macros rather than the old names.
* Add C-language keyword constants to C++Daniel Colascione2015-05-251-1/+1
| | | | | * lisp/progmodes/cc-langs.el (c-constant-kwds): Add C-language keyword constants to C++.
* Fix the CC Mode fixes from 2015-03-30. Fixes debbugs#20240.Alan Mackenzie2015-04-011-1/+1
| | | | | | | * progmodes/cc-mode.el (c-extend-after-change-region): Widen before applying text properties. * progmodes/cc-langs.el (c-before-font-lock-functions): Update an entry to a new function name.
* Correct calculation of CC Mode's font-lock region.Alan Mackenzie2015-03-301-2/+2
| | | | | | | | | | | | | | | | | | | | * cc-mode.el (c-fl-decl-start): Renamed from c-set-fl-decl-start. * Change signature such that nil is returned when no declaration is found. (c-change-expand-fl-region): Renamed from c-change-set-fl-decl-start. This now also handles expanding the font lock region to whole lines. (c-context-expand-fl-region): Renamed from c-context-set-fl-decl-start. This now also handles expanding the font lock region to whole lines. (c-font-lock-fontify-region): When a change font lock region is spuriously enlarged to the beginning-of-line by jit-lock, fontify the extra bit separately from the region calculated by CC Mode. (c-extend-after-change-region): Explicitly apply 'fontified properties to the extended bits of the font lock region. * cc-langs.el (c-before-font-lock-functions) (c-before-context-fontification-functions): Use new names for existing functions (see above).
* Allow compilation during loading of Modes derived from a CC Mode mode.Alan Mackenzie2015-01-131-4/+1
| | | | | | | | | | | | | | | | | | | | | | | Fixes debbugs#19206. cc-bytecomp.el (cc-bytecomp-compiling-or-loading): new function which walks the stack to discover whether we're compiling or loading. (cc-bytecomp-is-compiling): Reformulate, and move towards beginning. (cc-bytecomp-is-loading): New defsubst. (cc-bytecomp-setup-environment, cc-bytecomp-restore-environment): Use the above defsubsts. (cc-require-when-compile, cc-bytecomp-defvar) (cc-bytecomp-defun): Simplify conditionals. cc-defs.el (cc-bytecomp-compiling-or-loading): "Borrow" this function from cc-bytecomp.el. (c-get-current-file): Reformulate using the above. (c-lang-defconst): Prevent duplicate entries of file names in a symbol's 'source property. (c-lang-const): Use cc-bytecomp-is-compiling. cc-langs.el (c-make-init-lang-vars-fun): Use cc-bytecomp-is-compiling.
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Make C++11 uniform init syntax work. New keywords "final" and "override"Alan Mackenzie2014-12-191-1/+1
| | | | | | | | | | | | | cc-engine.el (c-back-over-member-initializer-braces): New function. (c-guess-basic-syntax): Set `containing-sex' and `lim' using the new function. cc-fonts.el (c-font-lock-declarations): Check more carefully for "are we at a declarator?" using c-back-over-member-initializers. cc-langs.el (c-type-modifier-kwds): include "final" and "override" in the C++ value.
* * lisp/progmodes/cc-cmds.el (c-subword-mode): Alias to subword-mode.Stefan Monnier2014-12-181-3/+3
| | | | | | | (c-update-modeline): * lisp/progmodes/cc-langs.el (c-mode-menu): Use c-subword-mode. * lisp/progmodes/cc-mode.el (subword-mode): Move autoload to cc-cmds.el. (c-mode-base-map): Use c-subword-mode.
* Merge some of the differences from the standalone CC-mode.Stefan Monnier2014-12-011-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main change is to only use the `category' text-property only when available. For that many calls are changed to use c-get-char-property, c-next-single-property-change, c-sc-scan-lists, c-sc-parse-partial-sexp, c-unmark-<->-as-paren. * lisp/progmodes/cc-align.el (c-lineup-respect-col-0): New function. * lisp/progmodes/cc-cmds.el (c-forward-into-nomenclature) (c-backward-into-nomenclature): Use cc-subword if subword-mode is not available. (c-beginning-of-defun, c-end-of-defun, c-mark-function) (c-indent-line-or-region): Use c-region-is-active-p. * lisp/progmodes/cc-defs.el (c-version): Bump up to 5.33. (c-use-category): New const. (c-next-single-property-change): New macro. (c-region-is-active-p): Prefer region-active-p when available. (c-search-backward-char-property): Fix old min/max typo; probably a copy/paste error. (c-mark-<-as-paren, c-mark->-as-paren, c-unmark-<->-as-paren): Turn them into macros that obey c-use-category. (c-sc-scan-lists-no-category+1+1, c-sc-scan-lists-no-category+1-1) (c-sc-scan-lists-no-category-1+1, c-sc-scan-lists-no-category-1-1) (c-sc-scan-lists, c-sc-parse-partial-sexp) (c-looking-at-non-alphnumspace): New macros. (c-sc-parse-partial-sexp-no-category): New function. (c-emacs-features): Add `category-properties' element. * lisp/progmodes/cc-engine.el (c-invalidate-state-cache, c-parse-state): Handle the case where categories are not available. (c-record-parse-state-state, c-replay-parse-state-state): Handle marker values. (c-before-change-check-<>-operators): Look for the `syntax-table' property rather than for the corresponding `category'. (c-looking-at-decl-block): Remove unused var `c-disallow-comma-in-<>-arglists'. (c-forward-<>-arglist-recur): Remove unused var `orig-record-found-types'. * lisp/progmodes/cc-langs.el (c-modified-constant): New lang var. (c-known-type-key): Don't make a list just to throw it away. * lisp/progmodes/cc-bytecomp.el (cc-bytecomp-unbound-variables) (cc-bytecomp-original-functions, cc-bytecomp-original-properties) (cc-bytecomp-loaded-files): Re-set each time the file is loaded. (cc-bytecomp-obsolete-var, cc-bytecomp-ignore-obsolete) (cc-bytecomp-obsolete-fun): Delete unused functions. * lisp/progmodes/cc-mode.el (c-just-done-before-change): New var. (c-basic-common-init): Initialize it. (c-common-init): Only use mode-require-final-newline when available. (c-before-change): Check and set c-just-done-before-change. (c-after-change): Re-set c-just-done-before-change. (c-advise-fl-for-region): New macro. (lazy-lock-defer-rest-after-change, lazy-lock-defer-line-after-change) (font-lock-after-change-function, jit-lock-after-change): Advise if needed.