(load "cc-bytecomp" nil t)))
(cc-require 'cc-defs)
-(cc-require-when-compile 'cc-langs)
(cc-require 'cc-vars)
+(cc-require-when-compile 'cc-langs)
(cc-require 'cc-engine)
(cc-require 'cc-styles)
(cc-require 'cc-cmds)
;; Silence the compiler.
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
-(cc-bytecomp-defun set-keymap-parents) ; XEmacs
(cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1
;; We set these variables during mode init, yet we don't require
((cc-bytecomp-fboundp 'set-keymap-parent)
(set-keymap-parent map c-mode-base-map))
;; XEmacs
- ((cc-bytecomp-fboundp 'set-keymap-parents)
+ ((fboundp 'set-keymap-parents)
(set-keymap-parents map c-mode-base-map))
;; incompatible
(t (error "CC Mode is incompatible with this version of Emacs")))
;; Add needed properties to each CPP construct in the region.
(goto-char c-new-BEG)
- (let ((pps-position c-new-BEG) pps-state mbeg)
+ (skip-chars-backward " \t")
+ (let ((pps-position (point)) pps-state mbeg)
(while (and (< (point) c-new-END)
(search-forward-regexp c-anchored-cpp-prefix c-new-END t))
;; If we've found a "#" inside a string/comment, ignore it.
pps-position (point))
(unless (or (nth 3 pps-state) ; in a string?
(nth 4 pps-state)) ; in a comment?
- (goto-char (match-beginning 0))
+ (goto-char (match-beginning 1))
(setq mbeg (point))
(if (> (c-syntactic-end-of-macro) mbeg)
(progn
(c-neutralize-CPP-line mbeg (point))
- (c-set-cpp-delimiters mbeg (point))
- ;(setq pps-position (point))
- )
+ (c-set-cpp-delimiters mbeg (point)))
(forward-line)) ; no infinite loop with, e.g., "#//"
)))))
;; This calls the language variable c-before-font-lock-functions, if non nil.
;; This typically sets `syntax-table' properties.
- (c-save-buffer-state ()
+ (c-save-buffer-state (case-fold-search)
;; When `combine-after-change-calls' is used we might get calls
;; with regions outside the current narrowing. This has been
;; observed in Emacs 20.7.
(setq beg end)))
;; C-y is capable of spuriously converting category properties
- ;; c-</>-as-paren-syntax into hard syntax-table properties. Remove
- ;; these when it happens.
+ ;; c-</>-as-paren-syntax and c-cpp-delimiter into hard syntax-table
+ ;; properties. Remove these when it happens.
(c-clear-char-property-with-value beg end 'syntax-table
c-<-as-paren-syntax)
(c-clear-char-property-with-value beg end 'syntax-table
c->-as-paren-syntax)
+ (c-clear-char-property-with-value beg end 'syntax-table nil)
(c-trim-found-types beg end old-len) ; maybe we don't need all of these.
(c-invalidate-sws-region-after beg end)
;; `c-set-fl-decl-start' for the detailed functionality.
(cons (c-set-fl-decl-start beg) end))
-(defvar c-standard-font-lock-fontify-region-function nil
- "Standard value of `font-lock-fontify-region-function'")
-
(defun c-font-lock-fontify-region (beg end &optional verbose)
;; Effectively advice around `font-lock-fontify-region' which extends the
;; region (BEG END), for example, to avoid context fontification chopping
(setq new-region (funcall fn new-beg new-end))
(setq new-beg (car new-region) new-end (cdr new-region)))
c-before-context-fontification-functions))))
- (funcall c-standard-font-lock-fontify-region-function
+ (funcall (default-value 'font-lock-fontify-region-function)
new-beg new-end verbose)))
(defun c-after-font-lock-init ()
;; Put on `font-lock-mode-hook'. This function ensures our after-change
- ;; function will get executed before the font-lock one. Amongst other
- ;; things.
+ ;; function will get executed before the font-lock one.
(remove-hook 'after-change-functions 'c-after-change t)
- (add-hook 'after-change-functions 'c-after-change nil t)
- (setq c-standard-font-lock-fontify-region-function
- (default-value 'font-lock-fontify-region-function)))
+ (add-hook 'after-change-functions 'c-after-change nil t))
(defun c-font-lock-init ()
"Set up the font-lock variables for using the font-lock support in CC Mode.