1. 18 Oct, 2021 1 commit
  2. 29 Aug, 2021 1 commit
  3. 21 Aug, 2021 1 commit
    • Alan Mackenzie's avatar
      Fix c-tentative-buffer-changes to be nestable in c-save-buffer-state · 0662a2909c5e
      Alan Mackenzie authored
      * cc-defs.el (c-benign-error): Move earlier in the file for the benefit of
      (c-tentative-buffer-changes, c-tnt-chng-record-state, c-tnt-chng-cleanup):
      Enhance such that a buffer-undo-list of t is handled specially, so that a nil
      isn't consed onto it.  Thus garbage collection can't later remove the (nil
      . t) from the end of the buffer-undo-list, causing an infinite loop.
  4. 15 Aug, 2021 4 commits
  5. 11 Aug, 2021 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Enhance C++ Mode raw strings to multi-line strings for any language · 6f3e0e8f19c0
      Alan Mackenzie authored
      * cc-defs.el (cadar, caddr, cdddr): Add defsubsts for these for when they are
      missing from the host Emacs.
      (c-point): Add new `position' 'boll "beginning of logical line".
      (c-clear-char-properties): Return the position of the lowest removed
      * cc-engine.el (c-full-pp-to-literal): Fix for rare case where LIMIT < START
      in parse-partial-sexp.
      (c-old-beg-rs, c-old-end-rs, c-raw-string-end-delim-disrupted)
      (c-raw-string-pos, c-raw-string-in-end-delim, c-depropertize-raw-string)
      (c-depropertize-raw-strings-in-region, c-before-change-check-raw-strings)
      (c-propertize-raw-string-id, c-propertize-raw-string-opener): Old functions
      and variables removed or renamed "raw" -> "ml" and adapted.
      (c-old-beg-ml, c-old-1-beg-ml, c-old-end-ml, c-beg-pos, c-end-pos)
      (c-ml-string-end-delim-disrupted, c-depropertize-ml-string-delims)
      (c-before-change-check-ml-strings, c-after-change-unmark-ml-strings)
      (c-maybe-re-mark-ml-string, c-propertize-ml-string-id)
      (c-propertize-ml-string-opener, c-depropertize-ml-string)
      (c-depropertize-ml-strings-in-region): New functions and variables adapted and
      possibly renamed from "raw" -> "ml".
      (c-ml-string-make-closer-re, c-ml-string-make-opener-re)
      (c-c++-make-ml-string-closer-re, c-c++-make-ml-string-opener-re)
      (c-get-ml-closer, c-ml-string-opener-around-point)
      (c-ml-string-opener-intersects-region, c-ml-string-opener-at-or-around-point)
      (c-ml-string-back-to-neutral, c-ml-string-in-end-delim, c-neutralize-pos)
      (c-neutralized-prop): New functions and variables.
      * cc-fonts.el (c-basic-matchers-before): Replace c-font-lock-raw-strings with
      (c-font-lock-ml-strings): New function taking the place of the old
      * cc-langs.el (c-get-state-before-change-functions): Move c-depropertize-CPP
      to the second item of the C++ entry, and replace
      c-before-change-check-raw-strings by c-before-change-check-ml-strings.  Add a
      new entry for Pike Mode.
      (c-before-font-lock-functions): (Replace c-after-change-unmark-raw-strings by
      c-after-change-unmark-ml-strings in the C++ entry, and add a new entry for
      Pike Mode.
      (c-ml-string-backslash-escapes, c-ml-string-non-punc-skip-chars)
      (c-ml-string-opener-re, c-ml-string-max-opener-len, c-ml-string-any-closer-re)
      (c-ml-string-max-closer-len, c-ml-string-max-closer-len-no-leader)
      (c-ml-string-back-closer-re, c-make-ml-string-closer-re-function)
      (c-make-ml-string-opener-re-function, c-ml-string-cpp-or-opener-re)
      (c-cpp-or-ml-match-offset): New c-lang-defconsts and c-land-defvars.
      (c-multiline-string-start-char): Remove the Pike Mode setting.
      * cc-mode.el (c-depropertize-CPP): Test for general ml strings rather than C++
      raw strings.
      (c-unescaped-nls-in-string-p): Handle languages with ml strings.
      (c-clear-string-fences): Fix bug with wrong parenthesisation.
      (c-after-change-mark-abnormal-strings, c-after-change-escape-NL-in-string):
      Adapt for multi-line strings.
  6. 27 Jun, 2021 1 commit
    • Alan Mackenzie's avatar
      C++ Mode: Handle new keywords static_cast, etc., wrt angle brackets · 99922f7a3e93
      Alan Mackenzie authored
      * cc-langs.el (c-<>-arglist-kwds): Add const_cast, dynamic_cast,
      reinterpret_cast and static_cast into this lang const.
      * cc-engine.el (c-clear-<-pair-props, c-clear->-pair-props)
      (c-clear-<-pair-props-if-match-after, c-clear->-pair-props-if-match-before)
      Invalidate caches with c-trunctate-lit-pos-cache.
      (c-forward-<>-arglist-recur): Correct "no match" constant expression.  If in a
      matching <...> expression, the < has a syntax-table property, but the > not,
      remove that property.
  7. 25 Apr, 2021 1 commit
  8. 15 Apr, 2021 1 commit
  9. 14 Apr, 2021 1 commit
  10. 10 Apr, 2021 1 commit
    • Alan Mackenzie's avatar
      Convert CC Mode to lexical binding in Emacs · 3e0f3c4c5b5d
      Alan Mackenzie authored
      cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-defs.el, cc-engine.el,
      cc-fonts.el, cc-guess.el, cc-langs.el, cc-menus.el, cc-mode.el, cc-styles.el,
      cc-subword.el, cc-vars.el: Mark these files with a `lexical-binding' setting
      in line 1.
      cc-align.el, cc-cmds.el, cc-engine.el, cc-vars.el (c-syntactic-context)
      (c-syntactic-element): Declare these as special variables.
      cc-bytecomp.el (cc-bytecomp-debug-msg): prefix the parameter ARGS with a _.
      cc-cmds.el (c--call-post-self-insert-hook-more-safely-1): Use mapc on
      functions in a lexical variable rather than a local variable as a hook.
      (c-where-wrt-brace-construct): Remove `kluge-start', an unused variable.
      (c-while-widening-to-decl-block): Add an extra parameter, which suppresses
      the generation of a setting of variable `where'.
      (c-defun-name-and-limits): Remove variable `where' from the function and use
      the new argument to the previous macro.
      cc-engine.el (c-cache-to-parse-ps-state): Remove two unneeded variables,
      `last' and `intermediate'.
      cc-guess.el (c-guess-view-reorder-offsets-alist-in-style): Remove the
      erroneous binding of `guessed-syntactic-symbols' (which is supplied as a
      cc-langs.el (c-vsemi-status-unknown-p-fn): Shorten the first line of the doc
      string to less than 80 characters.
      cc-mode.el (top-level): Add (cc-bytecomp-defun c-awk-unstick-NL-prop).
      cc-styles.el (c-set-offset): Give the `ignored' parameter a leading _.
      cc-vars.el (c-doc-comment-style): Shorten a line of the doc string to less
      than 80 characters.
  11. 09 Apr, 2021 1 commit
    • Alan Mackenzie's avatar
      CC Mode: fix c-where-wrt-brace-construct to cope with class declarations · 0f14e43254e6
      Alan Mackenzie authored
      Make the function correctly recognize a brace block preceded by an
      introductory line without a parameter list.
      * cc-cmds.el (c-where-wrt-brace-contruct): Reintroduce the use of
      c-beginning-of-decl-1, which was removed some weeks ago, in place of a
      c-syntactic-skip-backward.  Reformulate the code generally.
  12. 29 Mar, 2021 1 commit
    • Alan Mackenzie's avatar
      Fix an infinite loop in C++ Mode redisplay. This was bug #47191. · 7c948d8b9927
      Alan Mackenzie authored
      * cc-defs.el (c-forward-syntactic-ws, c-backward-syntactic-ws): When point is
      on the wrong side of a supplied search limit, leave point unmoved rather than
      setting it to that limit.
      * cc-engine.el (c-forward-name): After scanning a template argument list
      (which is not itself subject to a search limit) recalculate the search limit
      starting from the end point, since these argument lists can legitimately be
      long.  At each of the scanning loops, check point hasn't gone past the limit.
  13. 06 Mar, 2021 1 commit
  14. 03 Mar, 2021 1 commit
  15. 02 Mar, 2021 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Fix analysis of brace lists, particularly in C++ Mode · fd6fc4a4be6e
      Alan Mackenzie authored
      Fix some alignment functionality in cc-align.el.
      * cc-align.el (c-lineup-arglist-intro-after-paren): Align the next line under
      the previous entry rather than one to the right of the paren.
      (c-lineup-2nd-brace-entry-in-arglist): Take the anchor point from the
      brace-list-entry element, not the brace-list-intro one.
      * cc-engine.el (c-looking-at-decl-block): Use c-looking-at-statement-block to
      test whether "struct A {" begins a brace list or a struct declaration.
      (c-looking-at-or-maybe-in-bracelist): Several detailed amendments, correctly
      to recognize brace lists.
      (c-looking-at-statement-block): No longer search for commas, as they are not
      reliable indicators of a brace list.  Search now for a restricted set of
      keywords, since some can appear in brace lists in C++ mode.
      * cc-langs.el (c-stmt-block-only-keywords, c-stmt-block-only-keywords-regexp):
      New lang consts/vars.
      (c-pre-id-bracelist-kwds): New lang const.
      (c-pre-id-bracelist-key): Derive now from the above.
      (c-pre-brace-non-bracelist-key): New lang const/var.
  16. 01 Mar, 2021 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Amend C-M-a/e to handle lambda function in C++ arglist · df51bfc8e6e6
      Alan Mackenzie authored
      * cc-cmds.el (c-where-wrt-brace-construct): Reformulate latter part such that
      the least enclosing braces and parentheses are used when determining
      containment in such.  c-beginning-of-decl-1 has been superseded by list
      movement and syntactic whitespace movement.
      (c-backward-to-nth-BOF-{): Work on least enclosing parens rather than parens
      at any level when moving back to an opening brace.
      (c-forward-to-nth-EOF-\;-or-}): Work on least enclosing parens, as above.
      Move the correction of point when in a "function trailer" to after the main
      loop, correcting a minor bug.
  17. 23 Feb, 2021 1 commit
  18. 02 Feb, 2021 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Prevent "const" inside an identifier being recognized as the keyword · 524031e9e284
      Alan Mackenzie authored
      This fixes bug #45560.
      * cc-engine.el (c-forward-declarator, c-forward-decl-or-cast-1): Amend certain
      regexp match numbers on account of the change below.  Surround some looking-at
      calls with save-match-data.
      * cc-langs.el (c-type-decl-prefix-keywords-key): New lang const.
      (c-type-decl-prefix-key): Reformulate to match operators and keywords
      separately, using the new lang const (above).
  19. 31 Dec, 2020 3 commits
  20. 30 Dec, 2020 1 commit
    • Alan Mackenzie's avatar
      CC Mode: correct the handling of empty strings, also in test program · 2ab971738b2c
      Alan Mackenzie authored
      In particular, have the macro cache invalidated after its last use in
      * cc-engine.el (top level): Enclose five def-edebug-spec's in
      * cc-langs.el (c-get-state-before-change-functions): Remove
      c-invalidate-macro-cache from the entries it's in, moving it to....
      * cc-mode.el (c-before-change): Call c-invalidate-macro-cache directly from
      the functions, after the call to c-invalidate-state-cache.
  21. 28 Dec, 2020 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Add newish AWK Mode facilities, as used in gawk-4. · 92794c7bd79d
      Alan Mackenzie authored
      * cc-awk.el (c-awk-font-lock-invalid-namespace-separators): New function.
      (c-awk-context-expand-fl-region): New function.
      (awk-font-lock-keywords): Enhance handling of function declarations to include
      :: tokens.  Fontify new system variable names FPAT, FUNCTAB, PREC, ROUNDMODE,
      SYNTAB.  Fontify new keywords BEGINFILE and ENDFILE.  Fontify new system
      functions asorti, dcngettext, isarray, patsplit, typeof.  Fontify the new
      directives @include, @load, @namespace.  Call
      c-awk-font-lock-invalid-namespace-separators as a matcher.
      * cc-fonts.el (top level): No longer require 'cc-awk.
      * cc-langs.el (c-before-context-fontification-functions): Give AWK the value
      c-awk-context-expand-fl-region rather than nil.
      * cc-mode.el (top level): Declare awk-mode-syntax-table as a variable.
      * awk-face-1.{awk,face}: Add tests for the new attributes, for the new system
      variables, and for the new keywords.
      * funcs-5.{awk,face}: New test files for new function declarations.
      * statement-22.{awk,face,res}: Add erroneous use of the :: token into
        statements.  The .res file has been converted to "new" style.
  22. 24 Dec, 2020 1 commit
    • Alan Mackenzie's avatar
      CC Mode: introduce a new cache for brace structures. This fixes bug #45248 · 93043918481d
      Alan Mackenzie authored
      Also fix three infinite loops.  The new cache accelerates backward searches
      for struct beginnings in c-looking-at-or-maybe-in-bracelist.
      * cc-engine.el (c-beginning-of-statement-1): In the final loop over unary
      operators, add a check (> (point) lim) to avoid certain infinite loops.
      (c-beginning-of-decl-1): In the first loop add a similar check on point and
      (c-laomib-loop): New function extracted from
      (c-laomib-cache): New buffer local variable.
      (c-laomib-get-cache, c-laomib-put-cache, c-laomib-fix-elt)
      (c-laomib-invalidate-cache): New functions which implement the cache.
      (c-looking-at-or-maybe-in-bracelist): Replace two invocations of
      c-go-up-list-backwards with calls to c-parse-state.  Extract the new function
      c-laomib-loop.  Insert code which calls c-laomib-loop minimally, with the help
      of the new cache.
      * cc-mode.el (c-basic-common-init): Initialise the new cache (at mode start).
      (c-before-change): Invalidate the new cache.
      (c-fl-decl-start): Add an extra check (> (point) bod-lim) to prevent looping.
      Determine the enclosing brace to pass as arguments to
  23. 15 Dec, 2020 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Optimize for scrolling large buffers containing few braces · 967655828f50
      Alan Mackenzie authored
      This fixes bug #25706.  It particularly pertains to .h files which contain
      only macro definitions.  Many of these files are to be found, for example, in
      the driver sections of the Linux kernel.
      * cc-engine.el (c-beginning-of-statement-1, c-on-identifier)
      (c-syntactic-skip-backward, c-find-decl-prefix-search, c-find-decl-spots)
      (c-forward-name, c-back-over-list-of-member-inits)
      (c-back-over-member-initializers, c-looking-at-inexpr-block)
      (c-guess-basic-syntax): Give search limits to, or amend existing ones to
      c-backward-syntactic-ws, c-forward-syntactic-ws, c-backward-token-2,
      (c-determine-limit-no-macro): New function.
      (c-determine-limit-get-base): Remove unlimted invocation of
      (c-determine-limit): Exclude movement between two different macros.  Use new
      function c-determine-limit-no-macro.
      (c-back-over-list-of-member-inits): New parameter `limit'.
      * cc-mode.el (c-unfind-coalesced-tokens, c-before-change, c-fl-decl-end):
      Give search limits to, or amend existing ones to c-backward-syntactic-ws,
      c-forward-syntactic-ws, skip-chars-backward, skip-chars-forward.
  24. 14 Dec, 2020 3 commits
    • Alan Mackenzie's avatar
      Optimise c-font-lock-<>-arglists, particularly for buffers with few <..> pairs · 36aacde9e66b
      Alan Mackenzie authored
      * cc-fonts.el (c-font-lock-<>-arglists): In place of a regexp search for a
      complicated and slow regexp, search simply for "<" ouside of literals together
      with add hoc testing of other requirements for a <...> match.
      * cc-langs.el (c-nonsymbol-key): New c-lang-defvar from the c-lang-const.
    • Alan Mackenzie's avatar
      Optimise c-parse-state for large buffers with few (if any) braces. · f27f3b95798d
      Alan Mackenzie authored
      * cc-engine (c-get-fallback-scan-pos): Search a maximum of 50,000 characters
      back for the two BODs.  Return nil if we dont' find them.
      (c-parse-state-get-strategy): For strategy `forward', always use the position
      `good-pos' for `start-point', even when there's a change of current macro.
      Deal with a possible return value of nil from c-get-fallback-scan-pos (as
      (c-invalidate-state-cache-1): For `c-state-cache-good-pos', instead of
      sometimes using the minimum scan pos (leading to extensive scanning of the
      entire buffer) use a point close to `here'.
    • Alan Mackenzie's avatar
      CC Mode: fix small incompatibilities between Emacs and XEmacs · 9c9162f6c944
      Alan Mackenzie authored
      * cc-engine.el (c-parse-ps-state-to-cache)
      * cc-fonts.el (c-maybe-font-lock-wrong-style-comments): When testing (nth 7
      s), where s is a parser state, check for both values 1 (Emacs) and t
      * cc-mode.el (c-populate-abbrev-table): Do not try to run abbrev-table-p on
      XEmacs, since it doesn't exist there.
  25. 12 Dec, 2020 1 commit
  26. 11 Dec, 2020 1 commit
  27. 26 Nov, 2020 1 commit
  28. 15 Nov, 2020 1 commit
  29. 09 Nov, 2020 1 commit
    • Alan Mackenzie's avatar
      CC Mode: fix many compiler warnings which would appear with lexical binding · 824214fc4b6b
      Alan Mackenzie authored
      * cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-defs.el, cc-engine.el
      cc-fonts.el, cc-langs.el, cc-mode.el, cc-subword.el, cc-vars.el: In many
      places, where function parameters are not used, prefix their names with _.
      * cc-cmds.el (c-electric-brace, c-defun-name-and-limits)
      cc-engine.el (c-cache-to-parse-ps-state, c-full-trim-near-cache)
      (c-after-change-unmark-raw-strings, c-maybe-re-mark-raw-string)
      (c-forward-decl-or-cast-1): Remove unused local variables.
      * cc-defs.el (c-will-be-unescaped): Remove unused parameter end.
      * cc-engine.el (c-looking-at-decl-block): Remove unused parameter
      (c-looking-at-special-brace-list): Remove unused parameter lim.
      (c-add-class-syntax): Remove unused parameter paren-state.
  30. 28 Oct, 2020 1 commit
  31. 08 Oct, 2020 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Move the handling of keyword auto into type handling for C++. · 7b896f471f96
      Alan Mackenzie authored
      This should allow auto, const, static, ... to be in any order.
      * cc-engine.el (c-forward-type): New return value 'no-id for when auto
      precludes the parsing of a type identifier.  Adapt processing for this.
      (c-forward-decl-or-cast-1): Use the new facility from c-forward-type.
      * cc-langs.el (c-type-modifier-prefix-kwds): Insert the value of
      c-no-type-kwds into the value.
      (c-no-type-kwds, c-no-type-key): New lang consts/vars, basically "auto".
      (c-typeless-decl-kwds, c-modifier-kwds): Remove "auto" from the C++ value.
  32. 02 Oct, 2020 1 commit
  33. 20 Sep, 2020 1 commit
    • Alan Mackenzie's avatar
      C++ Mode: Modernize the fontification of "using" · 1eafa3102499
      Alan Mackenzie authored
      Since "using" is now used in three distinct ways in C++, write a special
      function to handle these rather than attempting to adapt the old regular
      * cc-fonts.el (c-font-lock-declarators): Amend to allow the argument TYPES to
      be a face.  This face is given to the declarator being processed.
      (c-font-lock-single-decl): Make an argument to c-font-lock-declarators nil or
      t, not merely nil or non-nil.
      (c-complex-decl-matchers): Include c-font-lock-c++-using in the C++ value of
      this variable.
      (c-font-lock-c++-using): New function.
      * cc-langs.el (c-using-kwds, c-using-key): New lang consts/vars.