diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-12-01 15:06:49 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-12-01 15:06:49 -0500 |
commit | 517505322a965a042d2d05385a25f7c13704e022 (patch) | |
tree | 4dc8d0ff2b1a3048f3584aaffd60ae17fc82336b /lisp/progmodes/cc-bytecomp.el | |
parent | 808699f13673a881949ab94d3c0e87f5ba9cd4cf (diff) | |
download | emacs-517505322a965a042d2d05385a25f7c13704e022.tar.gz emacs-517505322a965a042d2d05385a25f7c13704e022.tar.bz2 emacs-517505322a965a042d2d05385a25f7c13704e022.zip |
Merge some of the differences from the standalone CC-mode.
The main change is to only use the `category' text-property only when
available. For that many calls are changed to use c-get-char-property,
c-next-single-property-change, c-sc-scan-lists,
c-sc-parse-partial-sexp, c-unmark-<->-as-paren.
* lisp/progmodes/cc-align.el (c-lineup-respect-col-0): New function.
* lisp/progmodes/cc-cmds.el (c-forward-into-nomenclature)
(c-backward-into-nomenclature): Use cc-subword if subword-mode is
not available.
(c-beginning-of-defun, c-end-of-defun, c-mark-function)
(c-indent-line-or-region): Use c-region-is-active-p.
* lisp/progmodes/cc-defs.el (c-version): Bump up to 5.33.
(c-use-category): New const.
(c-next-single-property-change): New macro.
(c-region-is-active-p): Prefer region-active-p when available.
(c-search-backward-char-property): Fix old min/max typo; probably
a copy/paste error.
(c-mark-<-as-paren, c-mark->-as-paren, c-unmark-<->-as-paren):
Turn them into macros that obey c-use-category.
(c-sc-scan-lists-no-category+1+1, c-sc-scan-lists-no-category+1-1)
(c-sc-scan-lists-no-category-1+1, c-sc-scan-lists-no-category-1-1)
(c-sc-scan-lists, c-sc-parse-partial-sexp)
(c-looking-at-non-alphnumspace): New macros.
(c-sc-parse-partial-sexp-no-category): New function.
(c-emacs-features): Add `category-properties' element.
* lisp/progmodes/cc-engine.el (c-invalidate-state-cache, c-parse-state):
Handle the case where categories are not available.
(c-record-parse-state-state, c-replay-parse-state-state):
Handle marker values.
(c-before-change-check-<>-operators): Look for the `syntax-table'
property rather than for the corresponding `category'.
(c-looking-at-decl-block): Remove unused var
`c-disallow-comma-in-<>-arglists'.
(c-forward-<>-arglist-recur): Remove unused var
`orig-record-found-types'.
* lisp/progmodes/cc-langs.el (c-modified-constant): New lang var.
(c-known-type-key): Don't make a list just to throw it away.
* lisp/progmodes/cc-bytecomp.el (cc-bytecomp-unbound-variables)
(cc-bytecomp-original-functions, cc-bytecomp-original-properties)
(cc-bytecomp-loaded-files): Re-set each time the file is loaded.
(cc-bytecomp-obsolete-var, cc-bytecomp-ignore-obsolete)
(cc-bytecomp-obsolete-fun): Delete unused functions.
* lisp/progmodes/cc-mode.el (c-just-done-before-change): New var.
(c-basic-common-init): Initialize it.
(c-common-init): Only use mode-require-final-newline when available.
(c-before-change): Check and set c-just-done-before-change.
(c-after-change): Re-set c-just-done-before-change.
(c-advise-fl-for-region): New macro.
(lazy-lock-defer-rest-after-change, lazy-lock-defer-line-after-change)
(font-lock-after-change-function, jit-lock-after-change):
Advise if needed.
Diffstat (limited to 'lisp/progmodes/cc-bytecomp.el')
-rw-r--r-- | lisp/progmodes/cc-bytecomp.el | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index 19366279b6c..2db5a100050 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -65,8 +65,7 @@ ;; elsewhere in the load path. ;; ;; To suppress byte compiler warnings, use the macros -;; `cc-bytecomp-defun', `cc-bytecomp-defvar', -;; `cc-bytecomp-obsolete-fun', and `cc-bytecomp-obsolete-var'. +;; `cc-bytecomp-defun' and `cc-bytecomp-defvar'. ;; ;; This file is not used at all after the package has been byte ;; compiled. It is however necessary when running uncompiled. @@ -78,6 +77,12 @@ (defvar cc-bytecomp-original-functions nil) (defvar cc-bytecomp-original-properties nil) (defvar cc-bytecomp-loaded-files nil) + +(setq cc-bytecomp-unbound-variables nil) +(setq cc-bytecomp-original-functions nil) +(setq cc-bytecomp-original-properties nil) +(setq cc-bytecomp-loaded-files nil) + (defvar cc-bytecomp-environment-set nil) (defmacro cc-bytecomp-debug-msg (&rest args) @@ -370,33 +375,6 @@ the file. Don't use outside `eval-when-compile'." "cc-bytecomp-put: Bound property %s for %s to %s" ,propname ,symbol ,value))) -(defmacro cc-bytecomp-obsolete-var (symbol) - "Suppress warnings that the given symbol is an obsolete variable. -Don't use within `eval-when-compile'." - `(eval-when-compile - (if (get ',symbol 'byte-obsolete-variable) - (cc-bytecomp-put ',symbol 'byte-obsolete-variable nil) - ;; This avoids a superfluous compiler warning - ;; about calling `get' for effect. - t))) - -(defun cc-bytecomp-ignore-obsolete (form) - ;; Wraps a call to `byte-compile-obsolete' that suppresses the warning. - (let ((byte-compile-warnings byte-compile-warnings)) - (byte-compile-disable-warning 'obsolete) - (byte-compile-obsolete form))) - -(defmacro cc-bytecomp-obsolete-fun (symbol) - "Suppress warnings that the given symbol is an obsolete function. -Don't use within `eval-when-compile'." - `(eval-when-compile - (if (eq (get ',symbol 'byte-compile) 'byte-compile-obsolete) - (cc-bytecomp-put ',symbol 'byte-compile - 'cc-bytecomp-ignore-obsolete) - ;; This avoids a superfluous compiler warning - ;; about calling `get' for effect. - t))) - (defmacro cc-bytecomp-boundp (symbol) "Return non-nil if the given symbol is bound as a variable outside the compilation. This is the same as using `boundp' but additionally @@ -423,4 +401,8 @@ exclude any functions that have been bound during compilation with (provide 'cc-bytecomp) +;;; Local Variables: +;;; indent-tabs-mode: t +;;; tab-width: 8 +;;; End: ;;; cc-bytecomp.el ends here |