1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

168 Commits

Author SHA1 Message Date
Alan Mackenzie
b293aa91bc CC Mode. Allow fontification of "wrong" style comments with warning face.
This fixes bug #4192.

* etc/NEWS: Add a new entry.

* lisp/progmodes/cc-defs.el (c-font-lock-flush): New macro.

* lisp/progmodes/cc-cmds.el (c-toggle-comment-style): On toggling the comment
style, invoke c-font-lock-flush when c-mark-wrong-style-of-comment is non-nil,
to cause that marking to be done instead on the other style of comment.

* lisp/progmodes/cc-fonts.el (c-maybe-font-lock-wrong-style-comments): New
function.
(c-cpp-matchers): Call c-maybe-font-lock-wrong-style-comments when
appropriate.

* lisp/progmodes/cc-vars.el (c-mark-wrong-style-of-comment): New customizable
option.

* doc/misc/cc-mode.texi (top level, Indentation Commands, Guessing the Style,
Custom Macros): For some opening quote marks, correct '' to ``.
(Minor Modes): Add an xref to the new page "Wrong Comment Style" in a
footnote.
(Wrong Comment Style): New page.
2019-11-09 12:09:30 +00:00
Alan Mackenzie
ec16dd1a1e CC Mode. Fix slow scrolling by adding a search limit.
This fixes bug #10149.

* lisp/progmodes/cc-fonts.el (c-font-lock-single-decl) Limit the search by
c-go-up-list-backwards to 500 non-literal characters.
2019-11-02 13:03:50 +00:00
Alan Mackenzie
2f646633e0 CC Mode: Stop /**/ spuriously fontifying as a doc comment under gtkdoc
Also fix infinite loops by correcting two regexps.

* lisp/progmodes/cc-langs.el (c-last-c-comment-end-on-line-re)
(c-last-open-c-comment-start-on-line-re): Correct the regexp fragments
"\\*+[^/]" to "\\*+\\([^*/]\\|$\\)".

* lisp/progmodes/cc-fonts.el (gtkdoc-font-lock-keywords): Disallow /**/ for
doc comment fontification.
2019-07-27 12:55:53 +00:00
Alan Mackenzie
87b1495f30 * lisp/progmodes/cc-fonts.el (gtkdoc-font-lock-keywords): Fix faulty regexp 2019-07-17 09:35:26 +00:00
Alan Mackenzie
6d529b658a C++ Mode: change the default doc comment style from nothing to gtkdoc
Also amend a pertinent regular expression.  This fixes bug #11865.

* lisp/progmodes/cc-vars.el (c-doc-comment-style): Insert an entry for
c++-mode, namely gtkdoc.

* lisp/progmodes/cc-fonts.el (gtkdoc-font-lock-keywords): Amend the regexp
recognizing the introductory "/**" to allow subsequent characters on that
line.
2019-06-30 15:02:13 +00:00
Alan Mackenzie
da6deda8d4 Move defvars of c-doc-line-join-re + two others from cc-fonts.el to cc-mode.el
This is because these variables are needed at runtime even when cc-fonts.el
hasn't been loaded, as in XEmacs when font locking hasn't been enabled.

* lisp/progmodes/cc-fonts.el (c-doc-line-join-re)
(c-doc-bright-comment-start-re, c-doc-line-join-end-ch): Move definitions to
cc-mode.el.
2019-06-17 20:22:06 +00:00
Alan Mackenzie
e6fb9a443f CC Mode: Remedy recent loss in performance
* lisp/progmodes/cc-engine.el (c-back-over-member-initializers): call
c-parse-state outside of the narrowing operation.

* lisp/progmodes/cc-fonts.el (c-get-fontification-context)
(c-font-lock-cut-off-declarators): Replace calls to c-determine-limit with
crude position calculations for speed.
2019-06-16 15:46:12 +00:00
Alan Mackenzie
6b5388794b Depessimize bits of CC Mode for long C macros.
* lisp/progmodes/cc-engine.el (c-end-of-macro): Check for being in a
degenerate zero length "macro", when setting the macro cache.
(c-determine-+ve-limit): Add in a missing goto-char form for when start-pos is
non-nil.
(c-back-over-member-initializers): Add a search limit parameter.

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Add a search limit
to c-go-up-list-backward.
(c-font-lock-cut-off-declarators): Add a search limit to
c-back-over-member-initializers.

* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Don't
set c-new-END to the end of logical line (which might be a long macro).
(c-after-change-mark-abnormal-strings): Calculate end-hwm in place of the
setting of c-new-END (above).  Use this as a search limit rather than
c-new-END.
2019-06-13 14:10:02 +00:00
Alan Mackenzie
9dee49ed64 Tidy up the literal cacheing in CC Mode, optimizing c-full-pp-to-literal
(Intermediate commit)

* lisp/progmodes/cc-engine.el, lisp/progmodes/cc-fonts.el
* lisp/progmodes/cc-mode.el : Rename:
c-state-semi-nonlit-pos-cache -> c-lit-pos-cache,
c-state-semi-nonlit-pos-cache-limit -> c-lit-pos-cache-limit,
c-state-semi-nonlit-near-cache -> c-semi-lit-near-cache,
c-truncate-semi-nonlit-pos-cache -> c-truncate-lit-pos-cache,
c-state-semi-trim-near-cache -> c-semi-trim-near-cache,
c-state-semi-get-near-cache-entry -> c-semi-get-near-cache-entry,
c-state-semi-put-near-cache-entry -> c-semi-put-near-cache-entry,
c-state-semi-pp-to-literal -> c-semi-pp-to-literal,
c-state-full-pp-to-literal -> c-full-pp-to-literal,
c-state-semi-trim-cache -> c-trim-lit-pos-cache.

* lisp/progmodes/cc-engine.el (c-semi-near-cache-limit): New variable.
(c-truncate-lit-pos-cache): This now truncates the cache variables for all
three lit- sub-caches.
(c-semi-put-near-cache-entry): Increase c-semi-near-cache-limit to the
position of the new entry.
(c-full-near-cache-limit, c-full-lit-near-cache): New variables.
(c-full-trim-near-cache, c-full-get-near-cache-entry)
(c-full-put-near-cache-entry): New functions.
(c-full-pp-to-literal): Amend to use the new functions, and to optimize the
use of the available caches, similarly to c-semi-pp-to-literal.
2019-06-01 19:56:07 +00:00
Paul Eggert
852d281769 Update author/maintainer info
Update email addresses and fix spellings of some author and
maintainer names.
2019-05-26 01:00:16 -07:00
Mattias Engdegård
26f735ff19 Add standard unmatchable regexp
Add `regexp-unmatchable' as a standard unmatchable regexp, defined as
"\\`a\\`".  Use it where such a regexp is needed, replacing slower
expressions in several places.
From a suggestion by Philippe Schnoebelen.

* lisp/subr.el (regexp-unmatchable): New defconst.
* etc/NEWS (Lisp Changes): Mention `regexp-unmatchable'.
* doc/lispref/searching.texi (Regexp Functions): Document it.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt)
* lisp/progmodes/cc-defs.el (cc-conditional-require-after-load)
(c-make-keywords-re)
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1)
(c-forward-<>-arglist-recur, c-forward-decl-or-cast-1)
(c-looking-at-decl-block)
* lisp/progmodes/cc-fonts.el (c-doc-line-join-re)
(c-doc-bright-comment-start-re)
* lisp/progmodes/cc-langs.el (c-populate-syntax-table)
(c-assignment-op-regexp)
(c-block-comment-ender-regexp, c-font-lock-comment-end-skip)
(c-block-comment-start-regexp, c-line-comment-start-regexp)
(c-doc-comment-start-regexp, c-decl-start-colon-kwd-re)
(c-type-decl-prefix-key, c-type-decl-operator-prefix-key)
(c-pre-id-bracelist-key, c-enum-clause-introduction-re)
(c-nonlabel-token-2-key)
* lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end)
* lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re)
(c-noise-macro-name-re, c-make-noise-macro-regexps)
* lisp/progmodes/octave.el (octave-help-mode)
* lisp/vc/vc-bzr.el (vc-bzr-log-view-mode, vc-bzr-revision-completion-table)
* lisp/vc/vc-git.el (vc-git-log-view-mode)
* lisp/vc/vc-hg.el (vc-hg-log-view-mode)
* lisp/vc/vc-mtn.el (vc-mtn-log-view-mode):
Use `regexp-unmatchable'.
* lisp/textmodes/ispell.el (ispell-non-empty-string):
Use `regexp-unmatchable', fixing a broken never-match regexp.
2019-05-15 18:55:27 +02:00
Stefan Monnier
35ef33dd23 * lisp/progmodes/cc-fonts.el: Silence some compiler warnings
(c-font-lock-declarators): Mark `id_end` and `not-top` as unused.
2019-04-30 13:42:44 -04:00
Alan Mackenzie
2885372168 CC Mode: in certain font lock loops, check point is not beyond limit.
* /lisp/progmodes/cc-fonts.el (c-font-lock-enum-body)
(autodoc-font-lock-line-markup): As part of the `while' condition, check that
the previous iteration of the loop hasn't moved point past `limit', thus
obviating "wrong side of point" errors in re-search-forward, etc.
2019-04-30 13:20:22 +00:00
Alan Mackenzie
0c2d921a75 Restore fontification of delimiters of multiline CC Mode strings.
E.g., on typing the closing delimiter of a string continued onto a second
line, the opening delimiter retained its font-lock-warning-face.

* lisp/progmodes/cc-defs.el (c-c++-raw-string-opener-re)
(c-c++-raw-string-opener-1-re): New constants.
(c-sub-at-c++-raw-string-opener, c-at-c++-raw-string-opener): New macros.

* lisp/progmodes/cc-engine.el (c-raw-string-pos)
(c-depropertize-raw-strings-in-region, c-after-change-unmark-raw-strings):
Replace uses of open-coded raw string regexps by the new constants and macros
in cc-defs.el.

* lisp/progmodes/cc-fonts.el (c-font-lock-raw-strings): Ditto

* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Set
c-new-BEG to the beginning of the string when we encounter its closing ".
When not in a raw string, but in a string, clear syntax-table properties from
its delimiters and set c-new-BEG/END to its limits.
(c-after-change-mark-abnormal-strings): When applying syntax-table properties
to string delimiters, also set c-new-BEG/END to ensure subsequent
fontification.
2019-04-25 18:00:15 +00:00
Alan Mackenzie
0d5caa9a0c Optimize for typing characters into long C++ raw strings.
* 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
fontified.
(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
fontification).
2019-04-23 09:16:05 +00:00
Alan Mackenzie
a85befa4aa Fix Pike Mode's autodoc doc comments style's continued lines.
* 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
functions.
(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.
2019-04-20 11:30:55 +00:00
Alan Mackenzie
29ec1e4888 Improve C++ raw string fontification.
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-function)
(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
change.
(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
functions.

* 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
macros.
(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.
2019-03-27 11:50:53 +00:00
Alan Mackenzie
aa1a4cceca Correct the indentation of CC Mode brace lists
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
c-lineup-class-decl-init-after-brace.

* 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.
2019-03-12 18:33:31 +00:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Glenn Morris
62112a77f1 Merge from origin/emacs-26
081fb69 (origin/emacs-26) Check result from c-backward-token-2 to avo...
f4ea746 cl-make-random-state was not copying its arg
2018-12-20 07:51:17 -08:00
Alan Mackenzie
081fb694c3 Check result from c-backward-token-2 to avoid infinite loop
This fixes bug #33784.

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): While moving back
over enclosing parentheses, check that c-backward-token-2 actually moves.
2018-12-20 12:21:16 +00:00
Glenn Morris
037aabba49 Merge from origin/emacs-26
2075864 (origin/emacs-26) CC Mode: stop extra parens on expression ca...
2018-12-10 09:43:05 -08:00
Alan Mackenzie
2075864c77 CC Mode: stop extra parens on expression causing false fontification as type
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): recognize
arithmetic operator followed by several open parentheses, not just one, as not
being an argument list.
2018-12-10 14:30:40 +00:00
Michael Heerdegen
1808d254a5 Replace insignificant backquotes
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.
2018-11-25 21:08:08 +01:00
Alan Mackenzie
aba7910e36 Add ~44 edebug specs to CC Mode.
* 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.
2018-10-15 00:45:24 +00:00
Alan Mackenzie
bb591f139f Enhance CC Mode's fontification, etc., of unterminated strings.
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
c-font-lock-invalid-string.

* 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.
2018-05-20 13:28:14 +00:00
Alan Mackenzie
d3090a3a3e CC Mode: Fix an enum intro being parsed as defun-block-intro
* 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.
2018-02-02 20:46:35 +00:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Alan Mackenzie
293720e930 Fix loss of documentation face in certain CC Mode doc comment situations
* lisp/progmodes/cc-fonts.el (c-font-lock-doc-comments): Take into account
the possibility of font-lock-comment-delimiter-face.  Test rigorously for
"/**" (etc.) being itself inside a literal, rather than just depending on the
face of the previous character.
2017-12-21 17:18:40 +00:00
Alan Mackenzie
4cb8696e47 Don't misfontify "foo ()" inside C++ initialization parentheses as a type
Also recognize and handle function names introduced by "extern" inside a
function.

* 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
c-forward-decl-or-cast-1.

* lisp/progmodes/cc-langs.el (c-make-top-level-kwds, c-make-top-level-key):
New lang consts/vars.
2017-12-13 20:55:03 +00:00
Alan Mackenzie
ad68bbd0da Fix another "wrong side of point" error in CC Mode.
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.
2017-10-26 18:29:39 +00:00
Alan Mackenzie
46540a1c7a Fix a "wrong side of point" error in CC Mode. Fixes bug #28850.
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.
2017-10-25 18:14:00 +00:00
Alan Mackenzie
b7c4aa951c Refactor c-forward-token-2 with new function c-forward-over-token-and-ws.
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.
2017-10-22 14:18:20 +00:00
Alan Mackenzie
57ab49f7da Fix irregularities with CC Mode fontification, particularly with "known types"
* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Introduce a new
optional parameter, template-class.  In "class <X = Y>", fontify "Y" as a
type.
(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-declarators.
(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.
2017-10-05 17:16:10 +00:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
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.
2017-09-13 15:54:37 -07:00
Alan Mackenzie
201f950e66 Correct the fontification of C++ Mode enclosed declarations.
* lisp/progmodes/cc-fonts.el (c-font-lock-enclosing-decls): abolish the
spurious check that the character before the start of an enclosed declaration
must be ; or }.  It might also be {.
2017-08-31 18:08:21 +00:00
Alan Mackenzie
eaa5dc9d10 Fix C++ class initializers not always being fontified at mode start.
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.
2017-07-27 17:56:23 +00:00
Alan Mackenzie
30e6e55870 Fix variables in C++ "for" statement not always being fontified.
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 "&".
2017-07-27 17:05:53 +00:00
Alan Mackenzie
59d07875df Make C++ digit separators work. Amend the handling of single quotes generally
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
functions/macros.

* 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
needed.
(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.
2017-07-01 15:43:07 +00:00
Stefan Monnier
ebb4e61c59 * lisp/progmodes/cc-fonts.el: Remove/mark unused vars
(c-font-lock-declarators): Remove unused vars `id-end', `paren-depth',
and `brackets-after-id'.
(c-font-lock-objc-methods): Mark unused args.
2017-06-25 18:47:57 -04:00
Alan Mackenzie
b0042b7678 Make CC Mode load cl-lib rather than cl in Emacs 26.
* lisp/progmodes/cc-cmds.el (c-declaration-limits): Remove unused local
variable.

* 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
c--mapcan-status.

* 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.
2017-06-25 13:55:50 +00:00
Alan Mackenzie
8c21f8fab9 Ensure C++ initializer lists don't get fontified.
* 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.
(c-font-lock-declarations): Call c-font-lock-single-decl in place of inline
code.
(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.
2017-06-16 11:26:59 +00:00
Alan Mackenzie
d354fc3828 Fix fontification of C++ declaration with type FOO::FOO.
* 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).
2017-04-22 14:45:24 +00:00
Alan Mackenzie
ef7df187eb Fix C++ fontification problems 500 bytes after typing a space, and other bugs
Also implement the "asymmetric space" rule for fontifying otherwise
ambiguous
declarations/expressions.

* 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
declarations.
(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
c-literal-start.

* 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
c-asymmetric-fontification-flag.
2017-03-30 20:24:39 +00:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Alan Mackenzie
a285645b8b CC Mode: Fix the fontification of a spuriously recognised enum member.
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.
2016-12-30 15:31:42 +00:00
Alan Mackenzie
11b81a54d5 Partially correct fontification of "(b*3)", and the like, in C++ Mode
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.
2016-12-29 15:34:36 +00:00
Alan Mackenzie
c417f08b16 Correctly fontify C++ direct initializations with parens inside functions
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.
2016-09-11 21:09:08 +00:00