summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-mode.el
Commit message (Collapse)AuthorAge
* CC Mode: On removal of "typedef", remove pertinent types from c-found-typesAlan Mackenzie2023-01-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For this purpose, record the type names declared by typedef in a text property, c-typedef, on the typedef. On any change to that "typedef" or a type, remove the old identifier(s) from c-found-types. This should fix bug #59671. * lisp/progmodes/cc-defs.el (c-search-forward-non-nil-char-property): New macro. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Move the scope of identifier-start from the "inner" let form to the outer one. Amend the return value such that the middle element of the second element is now the position of the "typedef", not merely non-nil. * lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Disregard the LIMIT parameter when fontifying the declarators of a typedef construct. Also in this case, set the c-typedef text property on the "typedef" to the list of declared types. Amend this list when these declared types change. (c-font-lock-single-decl): Massage the `types' argument given to c-font-lock-declarators. (c-font-lock-cut-off-declarators): Amend to work when the starting point of the fontification is inside a brace block. * lisp/progmodes/cc-mode.el (c-before-change-de-typedef) (c-after-change-de-typedef): New functions. (c-update-new-id): Replace the erroneous c-end-of-current-token with a clause containing c-forward-token-2. (c-before-change): Call c-before-change-de-typedef. (c-after-change): Call c-after-change-de-typedef.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
|
* CC Mode: Make it scroll fast over buffers with only #define'sAlan Mackenzie2022-11-24
| | | | | | | | | | | * lisp/progmodes/cc-engine.el (c-forward-over-token): New LIMIT parameter * lisp/progmodes/cc-langs.el (c-anchored-hash-define-no-parens): Replace ill-formed regular expression (which mixed \\sw and character alternative) with simpler efficient regexp. * lisp/progmodes/cc-mode.el (c-fl-decl-end): New forward limit LIM+ used in c-forward-declarator and c-forward-over-token.
* ; Fix typosStefan Kangas2022-11-23
|
* ; Fix typosStefan Kangas2022-11-18
|
* ; Fix typosStefan Kangas2022-11-11
|
* * lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix off-by-one error.Alan Mackenzie2022-11-10
| | | | This fixes bug #59070.
* CC Mode: Cease adding types to found-types too eagerlyAlan Mackenzie2022-10-19
| | | | | | | | | | | | | | | | | | | | This fixes bug #58537 and bug #58539. * lisp/progmodes/cc-engine.el (c-forward-type): Remove trailing whitespace from an identifier before passing it to c-add-type. (c-forward-decl-or-cast-1): CASE 3: Do not recognize two consecutive identifiers as type + variable/function unless certain conditions are met. CASE 10: Do not recognize the "type" as a found type unless certain condtions are met. (Near end): Do not recognize the identifier in a cast as a type unless certain conditions are met. * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Recognize being in declaration parens when there is a syntactially wrong "foo ((bar))" preceding the match position. * lisp/progmodes/cc-mode.el (c-update-new-id): Set c-new-id-is-type unconditionally to nil to prevent a second identifier being wrongly marked as a type.
* ; Prefer HTTPS to HTTP in many URLsStefan Kangas2022-10-15
|
* CC Mode: Make c-forward-declarator move over a suffix after parens, e.g. constAlan Mackenzie2022-10-04
| | | | | | | | | | | | | | Also tidy up several inaccuracies in the code. * lisp/progmodes/cc-engine.el (c-forward-decl-arglist): Move point for modes other than C++ Mode. (c-forward-declarator): Move over a suffix following arglist parens (e.g. const). Set the ARGLIST element of the return value to non-nil on encountering an unbalanced open parenthesis. Don't move forward out of enclosing parens. * lisp/progmodes/cc-mode.el (c-fl-decl-end): Handle being in a multi-line string. Move forward over token after declarator.
* CC Mode: Refactor c-forward-delarator and callersAlan Mackenzie2022-09-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | c-forward-declarator now moves over a complete declarator, including any arglist expression, but possibly not including certain C++20 constructs. * lisp/progmodes/cc-engine.el (c-forward-decl-arglist): New function, extracted from c-do-declarators. (c-forward-declarator): Extend the result list by one element, denoting whether the function parsed an argument list. Insert special handling for a C++ operator<op> construct. If there is a parenthesis expression, and it is an argument list, move forward over it. (c-do-declarators): Append an optional parameter, cdd-anon-accepted instructing the function to handle declarators without identifiers. Extract c-forward-decl-arglist. * lisp/progmodes/cc-fonts.el (c-font-lock-declarators): New &optional parameter accept-anon, as above. Analyze and use the identifier location returned by c-do-declarators, rather than using c-last-identifier-range. (c-font-lock-single-decl): Determine accept-anon from the context, passing it as argument to c-font-lock-declarators. * lisp/progmodes/cc-langs.el (c-opt-identifier-prefix-key): Make a c-lang-defvar out of this existing c-lang-defconst. * lisp/progmodes/cc-mode.el (c-fl-decl-end): Adapt for the new c-forward-declarator which now moves over arglists. Amend better to handle certain syntactically invalid constructs in C++.
* CC Mode: Handle C++20 conceptsAlan Mackenzie2022-09-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-align.el (c-lineup-topmost-intro-cont): Amend so as not to indent lines following a requires line. * lisp/progmodes/cc-engine.el (c-forward-primary-expression) (c-forward-c++-requires-clause): New functions. (c-forward-declarator): Skip forward over any trailing requires clause. (c-forward-decl-or-cast-1): Skip requires clauses before and after the type. Amend the second element of the return list to include information on two consecutive identifiers in <...>. (c-looking-at-or-maybe-in-bracelist): Don't recognize braces in requires expressions as brace lists. (c-guess-basic-syntax): CASE 5D.7: New case to handle the continuation of a "concept foo = " line. * lisp/progmodes/cc-fonts.el (c-basic-matchers-before): Add a new clause to handle the declaration of a concept. (c-get-fontification-context): Treat the arglist of a requires construct as a declaration arglist. * lisp/progmodes/cc-langs.el (c-equals-nontype-decl-kwds/key) (c-fun-name-substitute-kwds/key, c-pre-concept-<>-kwds/key): New c-lang-consts/vars. (c-constant-key): New c-lang-var. (c-type-decl-suffix-key): Include "requires" in the keywords matched. * lisp/progmodes/cc-mode.el (c-fl-decl-start): Fix an off by one error. Use equal rather than eq to compare two syntax contexts.
* CC Mode. Make AWK Mode work with electric-pair-modeAlan Mackenzie2022-09-24
| | | | | | | | | | | | | | | | Also fix some minor anomalies with other CC Mode modes in electric-pair-mode. This fixes bug #53446. * lisp/progmodes/cc-mode.el (c-open-string-opener): New buffer local variable. (c-after-change-mark-abnormal-strings): Set c-open-string-opener when an unbalanced string is detected. (c-before-change): Initilize c-open-string-opener to nil, each buffer change. (c-electric-pair-inhibit-predicate): Use the value of c-open-string-opener to flag an unbalaced string rather than trying to calculate it again. * lisp/progmodes/cc-awk.el (c-awk-syntax-tablify-string): Set c-open-string-opener when an unbalanced string is detected.
* Delete many items obsolete since 24.3Stefan Kangas2022-09-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/allout.el (allout-exposure-change-hook) (allout-structure-added-hook, allout-structure-deleted-hook) (allout-structure-shifted-hook): * lisp/arc-mode.el (archive-extract-hooks): * lisp/buff-menu.el (Buffer-menu-buffer+size-width): * lisp/calendar/timeclock.el (timeclock-modeline-display) (timeclock-modeline-display, timeclock-update-modeline): * lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym-function-arglist): * lisp/cedet/semantic/db-file.el (semanticdb-save-database-hooks): * lisp/cedet/semantic/edit.el (semantic-change-hooks) (semantic-edits-new-change-hooks) (semantic-edits-delete-change-hooks) (semantic-edits-reparse-change-hooks): * lisp/cedet/semantic/lex.el (semantic-lex-reset-hooks): * lisp/comint.el (comint--unquote&expand-filename) (comint-unquote-filename): * lisp/custom.el (user-variable-p): * lisp/dired.el (dired-shrink-to-fit, dired-pop-to-buffer) (dired-sort-set-modeline): * lisp/ebuff-menu.el (Electric-buffer-menu-mode): * lisp/emacs-lisp/byte-run.el (macro-declaration-function): * lisp/emacs-lisp/checkdoc.el (custom-print-functions) (checkdoc-comment-style-hooks): * lisp/emacs-lisp/cl-lib.el (custom-print-functions): * lisp/emacs-lisp/edebug.el (gud-inhibit-global-bindings): * lisp/erc/erc-dcc.el (erc-dcc-chat-filter-hook): * lisp/eshell/esh-mode.el (eshell-status-in-modeline): * lisp/eshell/eshell.el (eshell-add-to-window-buffer-names) (eshell-remove-from-window-buffer-names): * lisp/faces.el (set-face-underline-p, font-list-limit): * lisp/files.el (automount-dir-prefix, toggle-read-only): * lisp/filesets.el (filesets-cache-fill-content-hooks): * lisp/frame.el (automatic-hscrolling): * lisp/generic-x.el (javascript-generic-mode) (javascript-generic-mode-hook): * lisp/gnus/gnus-start.el (gnus-subscribe-newsgroup-hooks): * lisp/gnus/nndiary.el (nndiary-request-create-group-hooks) (nndiary-request-update-info-hooks) (nndiary-request-accept-article-hooks): * lisp/htmlfontify.el (hfy-post-html-hooks): * lisp/international/mule-cmds.el (inactivate-current-input-method-function) (inactivate-input-method, input-method-inactivate-hook) (ucs-insert): * lisp/international/quail.el (quail-inactivate) (quail-inactivate-hook): * lisp/international/robin.el (robin-inactivate) (robin-inactivate-hook): * lisp/leim/quail/hangul.el (hangul-input-method-inactivate): * lisp/leim/quail/uni-input.el (ucs-input-inactivate): * lisp/mail/emacsbug.el (report-emacs-bug-info): * lisp/mh-e/mh-e.el (mh-kill-folder-suppress-prompt-hooks): * lisp/mpc.el (mpc-string-prefix-p): * lisp/net/rcirc.el (rcirc-print-hooks, rcirc-sentinel-hooks) (rcirc-receive-message-hooks, rcirc-activity-hooks): * lisp/obsolete/crisp.el (crisp-mode-modeline-string): * lisp/pcomplete.el (pcomplete-arg-quote-list) (pcomplete-quote-argument): * lisp/progmodes/cc-mode.el (c-prepare-bug-report-hooks): * lisp/progmodes/python.el (python-info-ppss-context) (python-info-ppss-context-type) (python-info-ppss-comment-or-string-p, python-indent) (python-guess-indent, python-buffer, python-preoutput-result) (python-proc, python-send-receive, python-send-string) (python-use-skeletons): * lisp/progmodes/sh-script.el (sh-maybe-here-document): * lisp/replace.el (query-replace-interactive): * lisp/strokes.el (strokes-modeline-string): * lisp/subr.el (redraw-modeline): * lisp/term.el (term-default-fg-color, term-default-bg-color): * lisp/textmodes/tex-mode.el (latex-string-prefix-p) (tex-string-prefix-p): * lisp/url/url-parse.el (url-recreate-url-attributes): * lisp/vc/add-log.el (change-log-acknowledgement): * lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically): * lisp/vc/pcvs-util.el (cvs-string-prefix-p): * lisp/vc/vc.el (vc-string-prefix-p): * lisp/window.el (display-buffer-function): * lisp/winner.el (winner-mode-leave-hook): Remove many functions and variables obsolete since 24.3. * lisp/buff-menu.el (list-buffers--refresh): * lisp/dired.el (dired-mode-map): * lisp/files.el (abbreviate-file-name): * lisp/generic-x.el (generic-default-modes): * lisp/mh-e/mh-funcs.el (mh-kill-folder): * lisp/progmodes/hideif.el (hide-ifdef-mode-submap): * lisp/replace.el (query-replace-read-from): * lisp/term.el (term): * lisp/window.el (display-buffer): Don't use above deleted functions and variables. * src/marker.c (Fbuffer_has_markers_at): Delete DEFUN obsolete since 24.3. (syms_of_marker) <Sbuffer_has_markers_at>: Delete defsubr. * lisp/subr.el (buffer-has-markers-at): Remove obsoletion of above deleted DEFUN. * etc/TODO: Doc fix; don't mention above deleted function. * admin/cus-test.el (cus-test-get-options): * lisp/pcomplete.el: Doc fixes; don't mention removed items. ; * etc/NEWS: List removed items.
* CC Mode: Fontify args correctly when arglist closing ) is not on the same lineAlan Mackenzie2022-08-24
| | | | | | | | | | | | | This fixes bug #56841. * lisp/progmodes/cc-engine.el (c-forward-declarator): Fix an off-by-one comparing the position after a c-forward-name with a limit. * lisp/progmodes/cc-mode.el (c-fl-decl-end): Handle correctly point starting inside a literal. Insert a missing c-backward-syntactic-ws in the handling of C++ attributes. Correctly handle an unmatched (. Better handle point starting inside a [ or (. Tidy up the handling of syntactic whitespace at the end of the buffer.
* CC Mode: Fix looping in patch from yesterdayAlan Mackenzie2022-08-07
| | | | | | * lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings) (c-after-change-mark-abnormal-strings): Check (eobp) in loops advancing over escaped newlines.
* CC Mode: Optimize font-locking stanzas for long raw strings.Alan Mackenzie2022-08-06
| | | | | | | | | | | | | | | Also replace some regexp searches which had caused regexp engine stack overflows with simple end-of-line calls. * lisp/progmodes/cc-fonts.el (c-make-syntactic-matcher) (c-make-font-lock-search-form): Start the generated functions with a skipping of comments and strings. (c-make-font-lock-BO-decl-search-function): Start the generated function with a (fast) movement to the start of any literal. * lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings) (c-after-change-mark-abnormal-strings): Replace complicated regexp searches for end of logical line with basic Lisp functions.
* CC Mode: Add accurate handling for backslash in C line and block commentsAlan Mackenzie2022-06-18
| | | | | | | | | | | | | | | This is needed to handle the idiosyncratic meaning of backslash in comments in the C and C++ standards. * lisp/progmodes/cc-engine.el: Correct a spelling error. * lisp/progmodes/cc-mode.el (c-before-change-fix-comment-escapes) (c-after-change-fix-comment-escapes): New functions. * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Add c-before-change-fix-comment-escapes to the C/Objc and C++ values. (c-before-font-lock-functions): Add c-after-change-fix-comment-escapes to the C/Objc and C++ values.
* CC Mode: Restore string fence properties at each relevant external entry pointAlan Mackenzie2022-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #55230. * lisp/progmodes/cc-defs.el (c-string-fences-set-flag, c-with-string-fences): New variable and macro. * lisp/progmodes/cc-mode.el (c-called-from-text-property-change-p): Add remove-text-properties to the list of accepted functions. (c-clear-string-fences, c-restore-string-fences): Surround the functions' innards with c-save-buffer-state to prevent text property changes causing change functions to be called. (c-before-change, c-after-change, c-font-lock-fontify-region): Replace the explicit calls to c-restore-string-fences and c-clear-string-fences with invocations of the new macro c-with-string-fences. * lisp/progmodes/cc-awk.el (c-awk-extend-and-syntax-tablify-region) (c-awk-end-of-defun) * lisp/progmodes/cc-cmds.el (c-show-syntactic-information) (c-electric-backspace, c-hungry-delete-backwards, c-electric-delete-forward) (c-hungry-delete-forward, c-electric-pound, c-electric-brace) (c-electric-slash, c-electric-star, c-electric-semi&comma, c-electric-colon) (c-electric-lt-gt, c-electric-paren, c-beginning-of-defun, c-end-of-defun) (c-display-defun-name, c-mark-function, c-beginning-of-statement) (c-end-of-statement, c-indent-command, c-indent-exp, c-indent-defun) (c-indent-line-or-region, c-fill-paragraph, c-indent-new-comment-line) (c-context-line-break) * lisp/progmodes/cc-guess.el (c-guess-region-no-install): These are all "boundary" functions to CC Mode. Surround each by c-with-string-fences.
* * lisp/progmodes/cc-mode.el (c-common-init): Bind case-fold-search to nilAlan Mackenzie2022-01-31
| | | | This fixes bug #53605.
* Merge from origin/emacs-28Eli Zaretskii2022-01-01
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-01
| |
* | CC Mode: Remove annoying background fontification. Should fix bug #52298Alan Mackenzie2021-12-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partially revert the commits from 2021-10-24 - 2021-10-26, "CC Mode: Fontify "found types" which are recognized after being first scanned". This removes the background fontification which ran off of a 0.1s timer, but leaves the facility of normal fontification causing the fontification throughout the buffer of newly found types. * lisp/progmodes/cc-fonts.el (c-find-types-background) (c-type-finder-timer-func): Remove. * lisp/progmodes/cc-mode.el (c-type-finder-timer, c-inhibit-type-finder) (c-type-finder-pos, c-post-gc-hook): Remove. (c-leave-cc-mode-mode): Remove the manipulations of c-type-finder-timer and c-post-gc-hook. (c-basic-common-init): Remove the manipulations of c-type-finder-pos, c-type-finder-timer, and c-post-gc-hook. * lisp/progmodes/cc-vars.el (c-type-finder-time-slot) (c-type-finder-repeat-time, c-type-finder-chunk-size): Remove. * doc/misc/cc-mode.texi (Found Types): Remove. Amend some menu entries.
* | Improve behavior of 'electric-pair-mode' in 'cc-mode'Jim Porter2021-11-06
| | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-mode.el (c-electric-pair-inhibit-predicate): Inhibit insertion of paired quote in fewer cases. * test/lisp/electric-tests.el (define-electric-pair-test): Add 'c-mode' to list of modes to test by default (bug#50538). This ensures that quotes are paired correctly within comments, allows for insertion of quote pairs immediately before another quote, and allows inserting quote pairs within a string (thus splitting the string in two).
* | CC Mode: Fontify "found types" which are recognized after being first scannedAlan Mackenzie2021-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This aims to fix the scenario where on jit-lock's first scan of a type, it is not recognized as such, and only later does this happen. The fontification of such found types is now done by background scanning in short time slices immediately after initialising the mode. * lisp/progmodes/cc-engine.el (c-add-type-1): New function. (c-add-type): Extract c-add-type-1 from it, and reformulate the mechanism for protecting c-found-types from excessive partial identifiers. * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare): Remove the code which cleared c-found-types on fontification at BOB. (c-find-types-background): New function, based on c-font-lock-declarations). (c-type-finder-timer-func): New function. (c-re-redisplay-timer): New variable. (c-force-redisplay, c-fontify-new-found-type): New functions. * lisp/progmodes/cc-mode.el (c-type-finder-timer, c-inhibit-type-finder): New variables. (c-leave-cc-mode-mode): Nullify c-post-command-hook, c-post-gc-hook, and c-type-finder-timer when the last CC Mode buffer of a session is killed. (c-type-finder-pos): New variable. (c-basic-common-init): Initialize/Install c-post-command, c-c-type-finder-pos, c-type-finder-timer, and c-post-gc-hook. (c-new-id-start, c-new-id-end, c-new-id-is-type): New variables. (c-update-new-id): New function. (c-post-command): New post command hook function, used for checking moving away from partially typed identifiers, and making them full identifiers. (c-post-gc-hook): New hook to prevent CC Mode activity immediately following GC, thus allowing keyboard/mouse input to be registered. (c-before-change): Add code to clear c-found-types on a buffer change at BOB. (c-after-change): Call c-update-new-id to keep track of partially typed identifiers. * doc/misc/cc-mode.texi (Found Types): New @section in the @Chapter Font Locking. * lisp/progmodes/cc-vars.el (c-type-finder-time-slot) (c-type-finder-repeat-time, c-type-finder-chunk-size): New customizable options.
* | Revert "CC Mode: Fontify "found types" which are recognized after being ..."Alan Mackenzie2021-10-23
| | | | | | | | | | This reverts commit 51719617eb19833056618ebac403cdcaf711551a. The commit caused a hang at start-up with a big desktop.
* | CC Mode: Fontify "found types" which are recognized after being first scannedAlan Mackenzie2021-10-22
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This aims to fix the scenario where on jit-lock's first scan of a type, it is not recognized as such, and only later does this happen. The fontification of such found types is now done by background scanning in short time slices immediately after initialising the mode. * lisp/progmodes/cc-engine.el (c-add-type-1): New function. (c-add-type): Extract c-add-type-1 from it, and reformulate the mechanism for protecting c-found-types from excessive partial identifiers. * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare): Remove the code which cleared c-found-types on fontification at BOB. (c-find-types-background): New function, based on c-font-lock-declarations). (c-types-finder-timer-func): New function. (c-re-redisplay-timer): New variable. (c-force-redisplay, c-fontify-new-found-type): New functions. * lisp/progmodes/cc-mode.el (c-type-finder-timer): New variable. (c-leave-cc-mode-mode): Nullify c-post-command-hook and c-type-finder-timer when the last CC Mode buffer of a session is killed. (c-type-finder-pos): New variable. (c-basic-common-init): Initialize c-type-finder-pos and c-type-finder-timer. (c-new-id-start, c-new-id-end, c-new-id-is-type): New variables. (c-update-new-id): New function. (c-post-command): New post command hook function, used for checking moving away from partially typed identifiers, and making them full identifiers. (c-before-change): Add code to clear c-found-types on a buffer change at BOB. (c-after-change): Call c-update-new-id to keep track of partially typed identifiers. * doc/misc/cc-mode.texi (Found Types): New @section in the @Chapter Font Locking. * lisp/progmodes/cc-vars.el (c-type-finder-time-slot) (c-type-finder-repeat-time, c-type-finder-chunk-size): New customizable options.
* ; Minor stylistic fixes found by checkdocStefan Kangas2021-10-05
|
* ; More minor stylistic fixes found by checkdocStefan Kangas2021-09-22
|
* ; Minor stylistic fixes found by checkdocStefan Kangas2021-09-16
|
* CC Mode: Fix a bug in yesterday's patchAlan Mackenzie2021-08-13
| | | | | | * lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Check the language has multi-line strings before calling c-ml-string-opener-at-or-around-point.
* CC Mode: Enhance C++ Mode raw strings to multi-line strings for any languageAlan Mackenzie2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/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 property. * lisp/progmodes/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-ml-string-delims-around-point,c-position-wrt-ml-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. * lisp/progmodes/cc-fonts.el (c-basic-matchers-before): Replace c-font-lock-raw-strings with c-font-lock-ml-strings. (c-font-lock-ml-strings): New function taking the place of the old c-font-lock-ml-strings. * lisp/progmodes/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. * lisp/progmodes/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-before-change-check-unbalanced-strings) (c-after-change-mark-abnormal-strings, c-after-change-escape-NL-in-string): Adapt for multi-line strings.
* Tweak c-mode bug reporting addressGlenn Morris2021-05-23
| | | | | | | | * lisp/progmodes/cc-mode.el (c-mode-help-address): Switch to bug-gnu-emacs. This is an alias for the previous submit@debbugs address, except that if no Package header can be found, as often seems to happen for cc-mode reports, debbugs will assign the report to the "emacs" package rather than to "debbugs.gnu.org".
* CC Mode: Put debug specs inside declare forms. Add missing debug specs.Alan Mackenzie2021-04-15
| | | | | | | | | * lisp/progmodes/cc-bytecomp.el, 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, lisp/progmodes/cc-mode.el: Change the explicit def-edebug-spec for many macros into a (declare (debug ...) ..) form. Add such forms to macros which were previously lacking def-edebug-spec forms.
* Convert CC Mode to lexical binding in EmacsAlan Mackenzie2021-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lisp/progmodes/cc-align.el, lisp/progmodes/cc-awk.el, lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-cmds.el, lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el, lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-guess.el, lisp/progmodes/cc-langs.el, lisp/progmodes/cc-menus.el, lisp/progmodes/cc-mode.el, lisp/progmodes/cc-styles.el, lisp/progmodes/cc-subword.el, lisp/progmodes/cc-vars.el: Mark these files with a `lexical-binding' setting in line 1. lisp/progmodes/cc-align.el, lisp/progmodes/cc-engine.el, lisp/progmodes/cc-vars.el (c-syntactic-context, c-syntactic-element): Declare these as special variables. lisp/progmodes/cc-bytecomp.el (cc-bytecomp-debug-msg): prefix the parameter ARGS with a _, and remove an `ignore' call. lisp/progmodes/cc-cmds.el (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. lisp/progmodes/cc-engine.el (c-cache-to-parse-ps-state): Remove two unneeded variables, `last' and `intermediate'. lisp/progmodes/cc-fonts.el (c-font-lock-c++-using): Remove unused variable. lisp/progmodes/cc-langs.el (c-vsemi-status-unknown-p-fn): Replace the doc string with the more precise one from stand-alone CC Mode. lisp/progmodes/cc-styles.el (c-set-offset): Give the `ignored' parameter a leading _.
* Merge from origin/emacs-27Paul Eggert2021-01-01
|\ | | | | | | 33d159c36f Fix copyright years by hand
| * Update copyright year to 2021Paul Eggert2021-01-01
| | | | | | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* | Update copyright year to 2021Paul Eggert2021-01-01
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | CC Mode: correct the handling of empty stringsAlan Mackenzie2020-12-30
| | | | | | | | | | | | | | | | | | | | | | In particular, have the macro cache invalidated after its last use in c-before-change. * lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Remove c-invalidate-macro-cache from the entries it's in, moving it to.... * lisp/progmodes/cc-mode.el (c-before-change): Call c-invalidate-macro-cache directly from the functions, after the call to c-invalidate-state-cache.
* | CC Mode: Add newish AWK Mode facilities, as used in gawk-4.Alan Mackenzie2020-12-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/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. * lisp/progmodes/cc-fonts.el (top level): No longer require 'cc-awk. * lisp/progmodes/cc-langs.el (c-before-context-fontification-functions): Give AWK the value c-awk-context-expand-fl-region rather than nil. * lisp/progmodes/cc-mode.el (top level): Declare awk-mode-syntax-table as a variable.
* | CC Mode: introduce a new cache for brace structures. This fixes bug #45248Alan Mackenzie2020-12-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also fix three infinite loops. The new cache accelerates backward searches for struct beginnings in c-looking-at-or-maybe-in-bracelist. * lisp/progmodes/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 lim. (c-laomib-loop): New function extracted from c-looking-at-or-maybe-in-bracelist. (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. * lisp/progmodes/cc-mode.el (c-basic-common-init): Initialise the new cach (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 c-looking-at-or-maybe-in-bracelist.
* | CC Mode: Optimize for scrolling large buffers containing few bracesAlan Mackenzie2020-12-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. * lisp/progmodes/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-beginning-of-statement-1. (c-determine-limit-no-macro): New function. (c-determine-limit-get-base): Remove unlimted invocation of c-backward-syntactic-ws. (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'. * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare) (c-font-lock-declarations, c-font-lock-c++-using): Give search limits to, or amend existing ones to c-backward-syntactic-ws, c-beginning-of-decl-1. * lisp/progmodes/cc-mode.el (c-unfind-coalesced-tokens, c-before-changer) (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.
* | Make XEmacs compat aliases easy-menu-{add,remove} obsoleteStefan Kangas2020-11-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/easymenu.el (easy-menu-remove, easy-menu-add): Make XEmacs compat aliases obsolete. * lisp/allout.el (allout-setup-menubar): * lisp/cus-edit.el (Custom-mode): * lisp/gnus/gnus-art.el (gnus-article-edit-mode): * lisp/gnus/message.el (message-mode): * lisp/net/sieve.el (sieve-manage-mode): * lisp/org/org-agenda.el (org-agenda-mode): * lisp/org/org-table.el (org-table-edit-formulas, orgtbl-mode): * lisp/org/org.el: * lisp/progmodes/cperl-mode.el (cperl-mode): * lisp/progmodes/hideshow.el (hs-minor-mode): * lisp/progmodes/idlw-help.el (idlwave-help-mode): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode): * lisp/progmodes/idlwave.el (idlwave-mode): * lisp/progmodes/meta-mode.el (meta-common-mode): * lisp/progmodes/octave.el (octave-mode): * lisp/progmodes/prolog.el (prolog-menu): * lisp/progmodes/tcl.el (tcl-mode): * lisp/speedbar.el (speedbar-reconfigure-keymaps): * lisp/term.el (term-mode, term-char-mode, term-process-pager): * lisp/textmodes/dns-mode.el (dns-mode): * lisp/wid-browse.el (widget-browse-mode): Don't call above obsolete aliases. * lisp/cedet/semantic/grammar.el (semantic-grammar-setup-menu-xemacs): * lisp/mh-e/mh-folder.el (mh-folder-mode): * lisp/mh-e/mh-identity.el (mh-identity-add-menu): * lisp/mh-e/mh-letter.el (mh-letter-mode): * lisp/mh-e/mh-search.el (mh-search-mode): * lisp/mh-e/mh-show.el (mh-show-mode): * lisp/obsolete/otodo-mode.el (todo-mode): * lisp/progmodes/antlr-mode.el (antlr-mode): * lisp/progmodes/cc-mode.el (c-mode, c++-mode, objc-mode) (java-mode, idl-mode, pike-mode): * lisp/progmodes/sql.el (sql-mode, sql-interactive-mode): * lisp/progmodes/vhdl-mode.el (vhdl-update-mode-menu) (vhdl-add-source-files-menu, vhdl-mode): * lisp/textmodes/reftex-index.el (reftex-index-mode) (reftex-index-phrases-mode): * lisp/textmodes/reftex-toc.el (reftex-toc-mode): * lisp/textmodes/reftex.el (reftex-mode): Only call above obsolete aliases in XEmacs. * lisp/progmodes/prolog.el (prolog-inferior-menu): * lisp/erc/erc-menu.el (erc-menu-add, erc-menu-remove): Don't call above obsolete aliases. Make obsolete. * lisp/erc/erc-menu.el (menu, erc-menu-add, erc-menu-remove): * lisp/progmodes/prolog.el (prolog-inferior-mode): Adjust callers. * lisp/speedbar.el (speedbar-previous-menu): Make obsolete. (Bug#44731)
* | CC Mode: fix many compiler warnings which would appear with lexical bindingAlan Mackenzie2020-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/cc-align.el (three places) prefix langelem with a _. * lisp/progmodes/cc-{cmds,engine}.el: Remove superfluous local variables. * lisp/progmodes/cc-defs.el (c-will-be-unescaped): Remove unused parameter end. * lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Remove unused parameter containing-sexp. (c-looking-at-special-brace-list); Remove unused parameter lim. (c-add-class-syntax): Remove unused parameter paren-state.
* | C++ Mode: handle __attribute__,etc. inside constructor argument listsAlan Mackenzie2020-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corrects both the fontification and indentation of these things, fixing bug #42270. * lisp/progmodes/cc-engine.el (c-do-declarators): Skip over "hangon keys" and noise macros whilst scanning a putative C++ function. (c-forward-decl-or-cast-1): When checking for typeless functions, skip over "hangon keys" and noise macros. * lisp/progmodes/cc-mode.el (c-fl-decl-end): Deal with certain invalid "nested declarators" by scanning over them with a recursive call of c-fl-decl-end. * lisp/progmodes/cc-vars.el (c-noise-macro-names) (c-noise-macro-with-parens-names): State in the doc strings that if either of these is a regexp, it must have a submatch 1 which matches the noise macro exactly.
* | CC Mode: Fix minor bugs in the string handling functionsAlan Mackenzie2020-09-11
| | | | | | | | | | | | | | | | | | | | These sometimes gave rise to the tail of a buffer being "stringed out". * lixp/progmodes/cc-defs.el (c-will-be-unescaped): New macro. * lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings) (c-after-change-mark-abnormal-strings): Fix bugs in the handling of string fence syntax-table text properties.
* | Merge from origin/emacs-27Glenn Morris2020-08-31
|\| | | | | | | | | | | | | | | f20169399d (origin/emacs-27) Fix typo in Introduction to Emacs Lisp 7605060d51 Update Elisp Manual reference to which-function-mode 29708cbde7 Some precisions to bug handling dddc971f0e CC Mode: Fix processing for when c-multiline-string-start-... 4a73fb9668 Fix description of %-constructs in 'mode-line-format'
| * CC Mode: Fix processing for when c-multiline-string-start-char is a characterAlan Mackenzie2020-08-29
| | | | | | | | | | | | | | | | * lisp/progmodes/cc-mode.el (c-pps-to-string-delim) (c-multiline-string-check-final-quote): Replace c-clear-char-property by c-clear-syn-tab. (c-multiline-string-check-final-quote): Replace c-put-char-property by c-put-syn-tab.
* | Remove redundant code from c-font-lock-fontify-regionAlan Mackenzie2020-07-19
| | | | | | | | | | * lisp/progmodes/cc-mode.el (c-font-lock-fontify-region): Remove variables string-fence-beg and lim, and the code used to calculate them.
* | * lisp/progmodes/cc-mode.el (c-or-c++-mode--regexp): Change WS to [ \t] in itAlan Mackenzie2020-07-02
| |