1. 23 Apr, 2019 1 commit
    • Alan Mackenzie's avatar
      Optimize for typing characters into long C++ raw strings. · 0d5caa9a
      Alan Mackenzie authored
      * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare)
      (c-font-lock-objc-methods) (c-font-lock-declarations, c-font-lock-enum-tail)
      (c-font-lock-cut-off-declarators, c-font-lock-enclosing-decls): If the chunk
      been fontified consists entirely of comments and strings, don't attempt to
      perform the function's action.
      * lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Don't
      expand (c-new-BEG c-new-END) unnecessarily to the entire raw string being
      (c-fl-decl-start, c-fl-decl-end): When in a (raw or otherwise) string, don't
      return a position outside of the string (which used to cause unneeded
  2. 20 Apr, 2019 1 commit
    • Alan Mackenzie's avatar
      Fix Pike Mode's autodoc doc comments style's continued lines. · a85befa4
      Alan Mackenzie authored
      * lisp/progmodes/cc-engine.el (c-forward-sws, c-backward-sws): Recognize
      matches of c-doc-line-join-re as syntactic whitespace.
      (c-find-decl-prefix-search): Recognize and move over matches of
      c-doc-line-join-re as whitespace.
      (c-find-decl-spots): Before moving backward a char, check (bobp).  Before
      moving forward over a comment, check it isn't possibly a "bright" comment.
      * lisp/progmodes/cc-fonts.el (c-get-doc-comment-style): New function,
      extracted from c-compose-keywords-list.
      (c-compose-keywords-list): Call the above new function.
      (pike-font-lock-keywords, pike-font-lock-keywords-2)
      (pike-font-lock-keywords-3): Call c-set-doc-comment-res.
      (c-doc-line-join-re, c-doc-bright-comment-start-re, c-doc-line-join-end-ch):
      New variables.
      (c-set-doc-comment-re-element, c-set-doc-comment-char-list): New macros.
      (c-set-doc-comment-res): New function.
      (c-font-lock-doc-comments): For consistency and repeatability, in a sequence
      of C++ style doc comments, don't fontify the region between BOL and the
      comment marker.
      (autodoc-line-join-re, autodoc-bright-comment-start-re)
      (autodoc-line-join-end-ch): New variables.
      * lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end): New
      (c-change-expand-fl-region, c-context-expand-fl-region): Call the above two
      new functions for extra possibilities for the start and end of a construct.
      * doc/misc/cc-mode.texi (Doc Comments): Add a sentence drawing attention to
      the possibility of fontifying constructs within a doc comment.
  3. 27 Mar, 2019 1 commit
    • Alan Mackenzie's avatar
      Improve C++ raw string fontification. · 29ec1e48
      Alan Mackenzie authored
      Integrate the handling of raw string and ordinary string fontification.
      * lisp/progmodes/cc-defs.el (c-font-lock-flush)
      (c-search-forward-char-property-without-value-on-char): new macros.
      (c-point): In the 'eoll arm, check for eobp.
      (c-search-forward-char-property-with-value-on-char): Handle the &optional
      limit argument being nil.
      (c-clear-char-property-with-value-on-char): Return the position of the first
      cleared property.
      * lisp/progmodes/cc-engine.el (c-find-decl-prefix-search): Don't spuriously
      recognize the change of face at a ) as the start of a string (a
      "pseudo match").
      (c-old-beg-rs c-old-end-rs): New variables.
      (c-raw-string-pos): Analyze raw string delimiters more carefully.
      (c-raw-string-in-end-delim): New function.
      (c-depropertize-raw-string): Largely rewritten.
      (c-before-change-check-raw-strings): New functionality: only remove the
      syntax-table text properties from raw strings whose delimiters are about to
      (c-propertize-raw-string-id): New function.
      (c-after-change-re-mark-raw-strings): Remove, incorporating functionality into
      other functions.
      (c-propertize-raw-string-opener): Largely rewritten.
      (c-after-change-re-mark-raw-strings): Removed.
      (c-after-change-unmark-raw-strings, c-after-change-unmark-raw-strings): New
      * lisp/progmodes/cc-fonts.el (c-font-lock-raw-strings): Largely rewritten.
      * lisp/progmodes/cc-langs.el (c-before-font-lock-functions): Replace
      c-after-change-re-mark-unbalanced-strings by
      c-after-change-mark-abnormal-strings in the t, c+objc, c++ and java sections.
      Add c-after-change-unmark-raw-strings and remove
      c-after-change-re-mark-raw-strings from the c++ section.
      * lisp/progmodes/cc-mode.el (c-old-BEG c-old-END): Remove.
      (c-old-END-literality): New variable.
      (c-depropertize-CPP): Remove syntax-table properties from raw strings within
      (c-before-change-check-unbalanced-strings): Call
      c-truncate-semi-nonlit-pos-cache to preserve the integrity of the cache.
      (c-before-change-check-unbalanced-strings): Call
      c-truncate-semi-nonlit-pos-cache, largely rewritten.
      (c-after-change-re-mark-unbalanced-strings): Renamed to
      c-after-change-mark-abnormal-strings.  Call c-maybe-re-mark-raw-string.
  4. 12 Mar, 2019 1 commit
    • Alan Mackenzie's avatar
      Correct the indentation of CC Mode brace lists · aa1a4cce
      Alan Mackenzie authored
      while preserving the indentation of nested C++ uniform initialization.
      * lisp/progmodes/cc-align.el (c-lineup-2nd-brace-entry-in-arglist)
      (c-lineup-class-decl-init-+, c-lineup-class-decl-init-after-brace): New
      indentation functions.
      * lisp/progmodes/cc-engine.el (c-forward-class-decl): New function.
      (c-do-declarators): New function, partially extracted from
      c-font-lock-declarators, which now calls the new function.
      (c-inside-bracelist-p): Amend the introductory comment.
      (c-add-stmt-syntax): Add code to prevent the spurious recognition of a
      'defun-block-intro when a brace pair is used as an initializer.
      (c-evaluate-offset): No longer ignore vectors of length >= 2.
      (c-calc-offset): Refactor clumsily nested `if'/`or' into a cond form.
      * lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Replace the bulk of
      this function by a call to the new c-forward-class-decl.
      * lisp/progmodes/cc-langs.el (c-type-decl-prefix-key): Recognize "~" as a
      type decl operator.
      * lisp/progmodes/cc-mode.el (c-fl-decl-start): While searching backward for a
      "}" at an EOD, deal with actually finding the end of a brace list.
      * doc/misc/cc-mode.texi (List Line-Up): document
      c-lineup-2nd-brace-entry-in-arglist, c-lineup-class-decl-init-+, and
      * lisp/progmodes/cc-styles.el (c-style-alist): In styles "gnu", "bsd",
      "stroustrup", "python", and "java", change the offset for brace-list-intro
      from the default value or c-lineup-arglist-intro-after-paren to a list
      beginning with the symbol first, followed by two of the new alignment
      functions, followed by +.
      * lisp/progmodes/cc-vars.el (c-offset-alist): Change the default value of
      brace-list-entry from c-lineup-under-anchor back to 0.
  5. 01 Jan, 2019 1 commit
  6. 20 Dec, 2018 1 commit
  7. 10 Dec, 2018 1 commit
  8. 25 Nov, 2018 1 commit
    • Michael Heerdegen's avatar
      Replace insignificant backquotes · 1808d254
      Michael Heerdegen authored
      Replace most insignificant occurrences of '`' with a straight quote,
      sharp quote or nothing.  This includes backquotes in 'pcase' patterns.
      * admin/admin.el:
      * lisp/apropos.el:
      * lisp/arc-mode.el:
      * lisp/auth-source.el:
      * lisp/avoid.el:
      * lisp/bindings.el:
      * lisp/bs.el:
      * lisp/calculator.el:
      * lisp/calendar/todo-mode.el:
      * lisp/cedet/semantic.el:
      * lisp/cedet/semantic/analyze/debug.el:
      * lisp/cedet/semantic/bovine.el:
      * lisp/cedet/semantic/dep.el:
      * lisp/cedet/semantic/grammar.el:
      * lisp/cedet/semantic/wisent/comp.el:
      * lisp/cedet/semantic/wisent/grammar.el:
      * lisp/cedet/srecode/mode.el:
      * lisp/cus-edit.el:
      * lisp/doc-view.el:
      * lisp/elec-pair.el:
      * lisp/electric.el:
      * lisp/emacs-lisp/autoload.el:
      * lisp/emacs-lisp/benchmark.el:
      * lisp/emacs-lisp/byte-opt.el:
      * lisp/emacs-lisp/bytecomp.el:
      * lisp/emacs-lisp/cconv.el:
      * lisp/emacs-lisp/cl-extra.el:
      * lisp/emacs-lisp/cl-generic.el:
      * lisp/emacs-lisp/cl-macs.el:
      * lisp/emacs-lisp/copyright.el:
      * lisp/emacs-lisp/debug.el:
      * lisp/emacs-lisp/eieio-compat.el:
      * lisp/emacs-lisp/ert.el:
      * lisp/emacs-lisp/generator.el:
      * lisp/emacs-lisp/inline.el:
      * lisp/emacs-lisp/macroexp.el:
      * lisp/emacs-lisp/map.el:
      * lisp/emacs-lisp/package-x.el:
      * lisp/emacs-lisp/package.el:
      * lisp/emacs-lisp/radix-tree.el:
      * lisp/emacs-lisp/smie.el:
      * lisp/epa.el:
      * lisp/erc/erc-dcc.el:
      * lisp/erc/erc-track.el:
      * lisp/erc/erc.el:
      * lisp/eshell/em-ls.el:
      * lisp/eshell/esh-cmd.el:
      * lisp/files.el:
      * lisp/filesets.el:
      * lisp/font-lock.el:
      * lisp/frameset.el:
      * lisp/gnus/gnus-agent.el:
      * lisp/gnus/gnus-art.el:
      * lisp/gnus/gnus-cite.el:
      * lisp/gnus/gnus-group.el:
      * lisp/gnus/gnus-msg.el:
      * lisp/gnus/gnus-salt.el:
      * lisp/gnus/gnus-srvr.el:
      * lisp/gnus/gnus-sum.el:
      * lisp/gnus/gnus-topic.el:
      * lisp/gnus/gnus-util.el:
      * lisp/gnus/gnus.el:
      * lisp/gnus/message.el:
      * lisp/gnus/mm-util.el:
      * lisp/gnus/mml.el:
      * lisp/gnus/nnheader.el:
      * lisp/gnus/nnimap.el:
      * lisp/gnus/nnmairix.el:
      * lisp/gnus/spam.el:
      * lisp/hexl.el:
      * lisp/hi-lock.el:
      * lisp/ibuf-ext.el:
      * lisp/ibuffer.el:
      * lisp/ido.el:
      * lisp/info.el:
      * lisp/international/mule-cmds.el:
      * lisp/international/mule-util.el:
      * lisp/json.el:
      * lisp/jsonrpc.el:
      * lisp/language/cyrillic.el:
      * lisp/language/european.el:
      * lisp/language/georgian.el:
      * lisp/language/tibetan.el:
      * lisp/language/utf-8-lang.el:
      * lisp/language/vietnamese.el:
      * lisp/ldefs-boot.el:
      * lisp/mail/mail-extr.el:
      * lisp/man.el:
      * lisp/menu-bar.el:
      * lisp/mh-e/mh-acros.el:
      * lisp/mh-e/mh-folder.el:
      * lisp/mh-e/mh-mime.el:
      * lisp/mh-e/mh-show.el:
      * lisp/mh-e/mh-speed.el:
      * lisp/minibuffer.el:
      * lisp/mpc.el:
      * lisp/net/ange-ftp.el:
      * lisp/net/hmac-def.el:
      * lisp/net/newst-backend.el:
      * lisp/net/quickurl.el:
      * lisp/net/tramp-archive.el:
      * lisp/net/tramp-compat.el:
      * lisp/notifications.el:
      * lisp/obsolete/pgg-parse.el:
      * lisp/obsolete/vc-arch.el:
      * lisp/obsolete/xesam.el:
      * lisp/org/ob-C.el:
      * lisp/org/ob-core.el:
      * lisp/org/ob-exp.el:
      * lisp/org/ob-groovy.el:
      * lisp/org/ob-haskell.el:
      * lisp/org/ob-io.el:
      * lisp/org/ob-lisp.el:
      * lisp/org/ob-lob.el:
      * lisp/org/ob-lua.el:
      * lisp/org/ob-octave.el:
      * lisp/org/ob-perl.el:
      * lisp/org/ob-python.el:
      * lisp/org/ob-ref.el:
      * lisp/org/ob-ruby.el:
      * lisp/org/ob-sql.el:
      * lisp/org/org-agenda.el:
      * lisp/org/org-capture.el:
      * lisp/org/org-clock.el:
      * lisp/org/org-colview.el:
      * lisp/org/org-duration.el:
      * lisp/org/org-element.el:
      * lisp/org/org-entities.el:
      * lisp/org/org-gnus.el:
      * lisp/org/org-indent.el:
      * lisp/org/org-info.el:
      * lisp/org/org-inlinetask.el:
      * lisp/org/org-lint.el:
      * lisp/org/org-list.el:
      * lisp/org/org-mouse.el:
      * lisp/org/org-plot.el:
      * lisp/org/org-src.el:
      * lisp/org/org-table.el:
      * lisp/org/org.el:
      * lisp/org/ox-ascii.el:
      * lisp/org/ox-html.el:
      * lisp/org/ox-latex.el:
      * lisp/org/ox-man.el:
      * lisp/org/ox-md.el:
      * lisp/org/ox-org.el:
      * lisp/org/ox-publish.el:
      * lisp/org/ox-texinfo.el:
      * lisp/org/ox.el:
      * lisp/play/bubbles.el:
      * lisp/play/gamegrid.el:
      * lisp/progmodes/autoconf.el:
      * lisp/progmodes/cc-defs.el:
      * lisp/progmodes/cc-engine.el:
      * lisp/progmodes/cc-fonts.el:
      * lisp/progmodes/cc-langs.el:
      * lisp/progmodes/cperl-mode.el:
      * lisp/progmodes/ebrowse.el:
      * lisp/progmodes/elisp-mode.el:
      * lisp/progmodes/flymake-cc.el:
      * lisp/progmodes/flymake.el:
      * lisp/progmodes/fortran.el:
      * lisp/progmodes/grep.el:
      * lisp/progmodes/gud.el:
      * lisp/progmodes/idlwave.el:
      * lisp/progmodes/js.el:
      * lisp/progmodes/m4-mode.el:
      * lisp/progmodes/make-mode.el:
      * lisp/progmodes/mixal-mode.el:
      * lisp/progmodes/modula2.el:
      * lisp/progmodes/octave.el:
      * lisp/progmodes/opascal.el:
      * lisp/progmodes/prolog.el:
      * lisp/progmodes/ps-mode.el:
      * lisp/progmodes/python.el:
      * lisp/progmodes/ruby-mode.el:
      * lisp/progmodes/sh-script.el:
      * lisp/progmodes/sql.el:
      * lisp/progmodes/verilog-mode.el:
      * lisp/ps-mule.el:
      * lisp/rtree.el:
      * lisp/ruler-mode.el:
      * lisp/ses.el:
      * lisp/simple.el:
      * lisp/startup.el:
      * lisp/subr.el:
      * lisp/term/ns-win.el:
      * lisp/textmodes/bibtex.el:
      * lisp/textmodes/conf-mode.el:
      * lisp/textmodes/css-mode.el:
      * lisp/textmodes/refill.el:
      * lisp/textmodes/sgml-mode.el:
      * lisp/textmodes/tex-mode.el:
      * lisp/tutorial.el:
      * lisp/url/url-dav.el:
      * lisp/url/url-gw.el:
      * lisp/url/url-http.el:
      * lisp/url/url-methods.el:
      * lisp/url/url-privacy.el:
      * lisp/vc/cvs-status.el:
      * lisp/vc/diff-mode.el:
      * lisp/vc/ediff-init.el:
      * lisp/vc/ediff-ptch.el:
      * lisp/vc/log-edit.el:
      * lisp/vc/log-view.el:
      * lisp/vc/pcvs-info.el:
      * lisp/vc/pcvs.el:
      * lisp/vc/smerge-mode.el:
      * lisp/vc/vc-git.el:
      * lisp/vc/vc-hg.el:
      * lisp/vc/vc-mtn.el:
      * lisp/vc/vc-rcs.el:
      * lisp/whitespace.el:
      * lisp/window.el:
      * test/lisp/electric-tests.el:
      * test/lisp/emacs-lisp/cl-lib-tests.el:
      * test/lisp/emacs-lisp/ert-tests.el:
      * test/lisp/epg-tests.el:
      * test/lisp/jsonrpc-tests.el:
      * test/src/data-tests.el:
      * test/src/json-tests.el: Replace most insignificant backquotes.
  9. 15 Oct, 2018 1 commit
    • Alan Mackenzie's avatar
      Add ~44 edebug specs to CC Mode. · aba7910e
      Alan Mackenzie authored
      * lisp/progmodes/cc-cmds.el, lisp/progmodes/cc-defs.el
      lisp/progmodes/cc-engine.el, lisp/progmodes/cc-fonts.el
      lisp/progmodes/cc-langs.el: Add lots of edebug specs.
      * lisp/progmodes/cc-engine.el (c-state-maybe-marker): Tidy up so as to
      evaluate an argument only once at runtime.
  10. 20 May, 2018 1 commit
    • Alan Mackenzie's avatar
      Enhance CC Mode's fontification, etc., of unterminated strings. · bb591f13
      Alan Mackenzie authored
      String delimiters, including escaped new lines, of correctly terminated
      strings are left in font-lock-string-face.  All others get
      font-lock-warning-face.  The latter get syntax-table text properties on the
      opening string delim and the "terminating EOL".
      Correct two miscellaneous bugs: the handling of text properties on Java Mode's
      generic delimiters; the handling of c-just-done-before-change.
      * lisp/progmodes/cc-defs.el (c-point): New position 'eoll "end of logical line".
      (c-characterp): New macro.
      * lisp/progmodes/cc-fonts.el (c-font-lock-invalid-string): Removed.
      (c-basic-matchers-before): Use a simple matcher in place of the form around
      * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Add
      c-before-change-check-unbalanced-strings to the value for all modes except AWK
      Mode.  Also add c-before-change-check-<>-operators to Java Mode, correcting an
      error in that mode's handling of generic delimiters.
      (c-before-font-lock-functions): Add c-after-change-re-mark-unbalanced-strings
      to the value for all modes except AWK Mode.
      (c-single-quotes-quote-strings, c-string-delims): New lang variables for
      future enhancements.
      (c-string-innards-re-alist): New lang variable.
      * lisp/progmodes/cc-mode.el (c-just-done-before-change): Do not set this
      variable when a change is the alteration of text properties.
      (c-basic-common-init): Set parse-sexp-lookup-properties (and the XEmacs
      equivalent) also for Pike Mode.
      (c-neutralize-CPP-line): No longer neutralize unbalanced quotes here.
      (c-unescaped-nls-in-string-p, c-multiline-string-start-is-being-detached)
      (c-pps-to-string-delim, c-before-change-check-unbalanced-strings)
      (c-after-change-re-mark-unbalanced-strings): New functions.
      (c-after-change): Fix a bug with the handling of c-just-done-before-change.
  11. 02 Feb, 2018 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Fix an enum intro being parsed as defun-block-intro · d3090a3a
      Alan Mackenzie authored
      * lisp/progmodes/cc-engine.el (c-inside-bracelist-p): Return a bufpos rather
      than t for the enum case.
      (c-add-stmt-syntax, c-guess-continued-construct): Replace
      c-looking-at-or-maybe-in-bracelist by c-inside-bracelist-p, since the former
      does not recognize enum brace lists, but the latter does.
      * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Replace
      c-looking-at-or-maybe-in-bracelist by c-inside-bracelist-p.
  12. 01 Jan, 2018 1 commit
  13. 21 Dec, 2017 1 commit
  14. 13 Dec, 2017 1 commit
    • Alan Mackenzie's avatar
      Don't misfontify "foo ()" inside C++ initialization parentheses as a type · 4cb8696e
      Alan Mackenzie authored
      Also recognize and handle function names introduced by "extern" inside a
      * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add a new element to
      the result list which is t when our declaration is, or is to be treated as,
      being at top level.
      * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Detect being
      inside a C++ uniform initialization and return (not-decl nil) for this case.
      (c-font-lock-declarations): Use the new element 4 of the result of
      * lisp/progmodes/cc-langs.el (c-make-top-level-kwds, c-make-top-level-key):
      New lang consts/vars.
  15. 26 Oct, 2017 1 commit
    • Alan Mackenzie's avatar
      Fix another "wrong side of point" error in CC Mode. · ad68bbd0
      Alan Mackenzie authored
      This fixes (a follow-up to) bug #28850.
      A internal generated form for scanning text to fontify had a LIMIT parameter.
      It also locally bound LIMIT to a value possibly beyond the original LIMIT,
      allowing point to move beyond the original LIMIT, and to create the wrong side
      error.  Fix it by checking point is not beyond LIMIT in the outer context
      before using it.
      * lisp/progmodes/cc-fonts.el (c-make-font-lock-search-form): Add a new
      parameter CHECK-POINT which, when non-nil, directs the function to generate a
      check on point.
      (c-make-font-lock-context-search-function): Invoke the above function with new
      argument value t.
  16. 25 Oct, 2017 1 commit
    • Alan Mackenzie's avatar
      Fix a "wrong side of point" error in CC Mode. Fixes bug #28850. · 46540a1c
      Alan Mackenzie authored
      The cause was a scanning over a bracket pair taking us beyond the supplied
      LIMIT parameter in c-forward-declarator.
      * lisp/progmodes/cc-engine.el (c-forward-declarator): Add three checks (<
      (point) limit) whilst dealing with tokens after the declared identifier.
      * lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Don't supply a LIMIT
      argument to `c-forward-declarator' (twice), since we want to fontify up till
      the end of a declarator, not an arbitrary jit-lock chunk end.
  17. 22 Oct, 2017 1 commit
    • Alan Mackenzie's avatar
      Refactor c-forward-token-2 with new function c-forward-over-token-and-ws. · b7c4aa95
      Alan Mackenzie authored
      Use the new function directly in several places where c-forward-token-2
      wouldn't move over the last token in the buffer.  This caused an infinite loop
      in c-restore-<>-properties.
      * lisp/progmodes/cc-engine.el (c-forward-over-token-and-ws): New function,
      extracted from c-forward-token-2.
      (c-forward-token-2): Refactor, calling the new function.
      (c-restore-<>-properties): Fix infinite loop.
      (c-forward-<>-arglist-recur, c-in-knr-argdecl)
      (c-looking-at-or-maybe-in-bracelist): Call the new function directly in place
      of c-forward-token-2.
      * lisp/progmodes/cc-cmds.el (c-defun-name) Call the new function directly in
      place of c-forward-token-2.
      * lisp/progmodes/cc-fonts.el (c-font-lock-enclosing-decls): Call the new
      function directly in place of c-forward-token-2.
  18. 05 Oct, 2017 1 commit
    • Alan Mackenzie's avatar
      Fix irregularities with CC Mode fontification, particularly with "known types" · 57ab49f7
      Alan Mackenzie authored
      * lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Introduce a new
      optional parameter, template-class.  In "class <X = Y>", fontify "Y" as a
      (c-font-lock-single-decl): New variable template-class, set to non-nil when we
      have a construct like the above.  Pass this as argument to
      (c-font-lock-cut-off-declarators): Check more rigorously that a declaration
      being processed starts before the function's starting position.
      (c-complex-decl-matchers): Remove the redundant clause which fontified "types
      preceded by, e.g., "struct"".
      * lisp/progmodes/cc-langs.el (c-template-typename-kwds)
      (c-template-typename-key): New lang defconsts and defvar.
  19. 18 Sep, 2017 1 commit
    • Alan Mackenzie's avatar
      Fix irregularities with CC Mode fontification, particularly with "known types" · 61a5c30e
      Alan Mackenzie authored
      * lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Introduce a new
      optional parameter, template-class.  In "class <X = Y>", fontify "Y" as a
      (c-font-lock-single-decl): New variable template-class, set to non-nil when we
      have a construct like the above.  Pass this as argument to
      (c-font-lock-cut-off-declarators): Check more rigorously that a declaration
      being processed starts before the function's starting position.
      (c-complex-decl-matchers): Remove the redundant clause which fontified "types
      preceded by, e.g., "struct"".
      * lisp/progmodes/cc-langs.el (c-template-typename-kwds)
      (c-template-typename-key): New lang defconsts and defvar.
  20. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
  21. 31 Aug, 2017 1 commit
  22. 27 Jul, 2017 2 commits
    • Alan Mackenzie's avatar
      Fix C++ class initializers not always being fontified at mode start. · eaa5dc9d
      Alan Mackenzie authored
      The problem here happened when an "outer list" of declarations moved beyond an
      "inner list" containing class initializers.  These weren't being checked for
      by the code.
      Also, fix places in c-get-fontification-context where point is undefined.
      * lisp/progmodes/cc-fonts.el (c-get-fontification-context): when argument
      not-front-decl is set, test for class initializers.  Also, anchor point in
      places where it is moved and is otherwise undefined.
    • Alan Mackenzie's avatar
      Fix variables in C++ "for" statement not always being fontified. · 30e6e558
      Alan Mackenzie authored
      The error happened when there was a comma inside template delimiters.
      * lisp/progmodes/cc-fonts.el (c-get-fontification-context): In "for"
      statements, recognise template delimiters containing "," and "&".
  23. 01 Jul, 2017 1 commit
    • Alan Mackenzie's avatar
      Make C++ digit separators work. Amend the handling of single quotes generally · 59d07875
      Alan Mackenzie authored
      Single quotes, even in strings and comments, are now marked with the
      "punctuation" syntax-table property, except where they are validly bounding a
      character literal.  They are font locked with font-lock-warning-face except
      where they are valid.  This is done in C, C++, ObjC, and Java Modes.
      * lisp/progmodes/cc-defs.el (c-clear-char-property-with-value-on-char-function)
      (c-clear-char-property-with-value-on-char, c-put-char-properties-on-char): New
      * lisp/progmodes/cc-fonts.el (c-font-lock-invalid-single-quotes): New function.
      (c-basic-matchers-before): invoke c-font-lock-invalid-single-quotes.
      * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Remove
      c-before-after-change-digit-quote from wherever it occurs.  Insert
      c-parse-quotes-before-change into the entries for the languages where it is
      (c-before-font-lock-functions): Remove c-before-after-change-digit-quote from
      wherever it occurs.  Insert c-parse-quotes-after-change into the entries for
      the languages which need it.
      (c-has-quoted-numbers): New lang-defconst/-defvar.
      * lisp/progmodes/cc-mode.el (c-before-after-change-digit-quote): Remove.
      (c-maybe-quoted-number-head, c-maybe-quoted-number-tail)
      (c-maybe-quoted-number): New defconsts.
      (c-quoted-number-head-before-point, c-quoted-number-tail-after-point)
      (c-quoted-number-straddling-point, c-parse-quotes-before-change)
      (c-parse-quotes-after-change): New functions.
  24. 25 Jun, 2017 2 commits
    • Stefan Monnier's avatar
      * lisp/progmodes/cc-fonts.el: Remove/mark unused vars · ebb4e61c
      Stefan Monnier authored
      (c-font-lock-declarators): Remove unused vars `id-end', `paren-depth',
      and `brackets-after-id'.
      (c-font-lock-objc-methods): Mark unused args.
    • Alan Mackenzie's avatar
      Make CC Mode load cl-lib rather than cl in Emacs 26. · b0042b76
      Alan Mackenzie authored
      * lisp/progmodes/cc-cmds.el (c-declaration-limits): Remove unused local
      * lisp/progmodes/cc-defs.el (c--mapcan-status): Remove.
      (c--cl-library): New variable.
      (Top level): Amend the form which requires library cl or cl-lib.
      (c--mapcan, c--set-difference, c--intersection, c--macroexpand-all)
      (c--delete-duplicate): Amend to use c--cl-library instead of
      * lisp/progmodes/cc-engine.el (c-syntactic-skip-backward)
      (c-back-over-compound-identifier): Remove unused local variables.
      * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Remove an unused
      local variable.
      * lisp/progmodes/cc-langs.el (Top level): Amend to use c--cl-library instead
      of c--mapcan-status.
      * lisp/progmodes/cc-styles.el (Top level): Add a cc-bytecomp-defun to try to
      silence a compiler warning.
  25. 16 Jun, 2017 1 commit
    • Alan Mackenzie's avatar
      Ensure C++ initializer lists don't get fontified. · 8c21f8fa
      Alan Mackenzie authored
      * lisp/progmodes/cc-cmds.el (c-block-comment-flag): Move declaration to solve
      compiler warning.
      * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Add an extra
      clause to handle C++ member initialization lists.
      (c-font-lock-single-decl): New function, extracted from
      (c-font-lock-declarations): Call c-font-lock-single-decl in place of inline
      (c-font-lock-cut-off-declarators): Make more rigorous by calling
      c-get-fontification-context, c-forward-decl-or-cast-1, and
      c-font-lock-single-decl in place of rather approximate code.
  26. 22 Apr, 2017 1 commit
    • Alan Mackenzie's avatar
      Fix fontification of C++ declaration with type FOO::FOO. · d354fc38
      Alan Mackenzie authored
      * lisp/progmodes/cc-engine.el (c-find-decl-spots): Initialize
      cfd-top-level properly.
      (c-forward-decl-or-cast-1): On finding FOO::FOO, check it is followed by "("
      before deciding it is a constructor.
      * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare): Negate the
      result of the c-bs-at-toplevel-p call passed to c-font-lock-declarators
      (simple bug fix).
  27. 30 Mar, 2017 1 commit
    • Alan Mackenzie's avatar
      Fix C++ fontification problems 500 bytes after typing a space, and other bugs · ef7df187
      Alan Mackenzie authored
      Also implement the "asymmetric space" rule for fontifying otherwise
      * lisp/progmodes/cc-engine.el (c-before-change-check-<>-operators): Don't set
      c-new-BEG or c-new-END when there is no need.
      (c-forward-decl-or-cast-1): Add "CASE 17.5" to implement the "asymmetric
      space" rule.
      * lisp/progmodes/cc-fonts.el (c-get-fontification-context): New function,
      extracted from c-font-lock-declarations.  Add to this function processing to
      make `context' 'decl for lines contained within parens when these are also
      (c-font-lock-declarations): Call the newly extracted function above in place
      of inline code.
      * lisp/progmodes/cc-mode.el (c-fl-decl-start): Set point before calling
      * lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag): New user option.
      * doc/misc/cc-mode.texi (Misc Font Locking): New node documenting the new
      "asymmetric fontification" rule, including the variable
  28. 01 Jan, 2017 1 commit
  29. 30 Dec, 2016 1 commit
    • Alan Mackenzie's avatar
      CC Mode: Fix the fontification of a spuriously recognised enum member. · a285645b
      Alan Mackenzie authored
      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
      * 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
  30. 29 Dec, 2016 1 commit
    • Alan Mackenzie's avatar
      Partially correct fontification of "(b*3)", and the like, in C++ Mode · 11b81a54
      Alan Mackenzie authored
      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
      * lisp/progmodes/cc-langs.el (c-arithmetic-operators, c-arithmetic-op-regexp):
      New lang consts and vars.
  31. 11 Sep, 2016 1 commit
    • Alan Mackenzie's avatar
      Correctly fontify C++ direct initializations with parens inside functions · c417f08b
      Alan Mackenzie authored
      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-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-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
  32. 31 Aug, 2016 1 commit
  33. 30 Aug, 2016 1 commit
    • Alan Mackenzie's avatar
      Correctly analyze C++ list initialization in member init areas. · a9118afc
      Alan Mackenzie authored
      * lisp/progmodes/cc-engine.el (c-back-over-list-of-member-inits): Remove a
      superfluous call to c-backward-syntactic-ws.
      (c-looking-at-or-maybe-in-bracelist): Change calling convention, so that it
      reports encountering the Java "new" keyword.  Add, as an alternative, a check
      that we can move back over member initializations, and handle this as finding
      a brace block.
      (c-looking-at-special-brace-list, c-guess-continued-construct): Adapt to the
      new calling convention of c-looking-at-or-maybe-in-bracelist.
      (c-guess-basic-syntax, CASE 5A.3): Replace lots of inline ad-hoc code with
      calls to c-backward-over-enum-header and c-looking-at-or-maybe-in-bracelist,
      using the extra info from the value of that function to generate a
      topmost-into-cont element where needed (in Java).
      * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Adapt to the new
      calling convention of c-looking-at-or-maybe-in-bracelist.
      * lisp/progmodes/cc-mode.el (c-fl-decl-start): Adapt to the new calling
      convention of c-looking-at-or-maybe-in-bracelist.
  34. 25 Aug, 2016 1 commit
    • Alan Mackenzie's avatar
      Fix an infinite loop in C++ Mode when we have "{ .... [ .... }" · 93c67f6b
      Alan Mackenzie authored
      * lisp/progmodes/cc-fonts.el (c-font-lock-c++-lambda-captures): In the inner
      `while' form's condition, check for "\\s)" rather than merely "\\]", so that
      the loop won't hang at a "terminating" paren of a different type (due to the
      c-syntactic-re-search-forward at the end of the loop stopping at such
  35. 21 Aug, 2016 1 commit
    • Alan Mackenzie's avatar
      Adapt CC Mode for C++11 uniform initialization. · 578d9aaf
      Alan Mackenzie authored
      For fontification, introduce a new "context", 'non-decl, to be used for
      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.
  36. 15 Aug, 2016 1 commit
    • Alan Mackenzie's avatar
      Handle C++11 lambda functions. · ce1ed9c8
      Alan Mackenzie authored
      * 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.
  37. 12 Jul, 2016 1 commit
    • Alan Mackenzie's avatar
      Amend CC Mode to handle big C++ raw strings correctly. · a1db933c
      Alan Mackenzie authored
      Problems were caused by such a string spanning jit-lock chunks, and by a flaw
      in the +-500 bytes boundaries imposed for macros.
      * lisp/progmodes/cc-mode.el (c-extend-region-for-CPP): Check the +-500 byte
      macro boundaries here.
      (c-extend-font-lock-region-for-macros): Remove the check on the +-500 byte
      lower boundary.  Fix the check on the upper boundary.
      * lisp/progmodes/cc-fonts.el (c-font-lock-raw-strings): Handle the starting
      point already being within a raw string.
      * lisp/progmodes/cc-engine.el (c-raw-string-pos)
      (c-depropertize-raw-strings-in-region, c-after-change-re-mark-raw-strings):
      Modify regexp element "\\{,16\\}" to "\\{0,16\\}" for greater compatibility
      with other Emacsen.
  38. 03 Jul, 2016 1 commit