Commit a2634462 authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

Backport fix to bug #18749 to Emacs-24 branch.

parent ceb7a7df
2014-10-18 Alan Mackenzie <>
Check that a "macro" found near point-min isn't a ## operator.
Fixes bug #18749. Backported from trunk, 2014-11-05.
* progmodes/cc-engine.el (c-macro-is-genuine-p): New function.
(c-beginning-of-macro): Use the above new function.
2014-11-05 Alan Mackenzie <>
Fix wrong bound to c-font-lock-declarators. Fixes bug #18948.
......@@ -248,6 +248,24 @@
(setq c-macro-cache-start-pos beg
c-macro-cache-syntactic nil))))
(defun c-macro-is-genuine-p ()
;; Check that the ostensible CPP construct at point is a real one. In
;; particular, if point is on the first line of a narrowed buffer, make sure
;; that the "#" isn't, say, the second character of a "##" operator. Return
;; t when the macro is real, nil otherwise.
(let ((here (point)))
(if (and (eq (point) (point-min))
(/= (point) 1))
(and (looking-at c-anchored-cpp-prefix)
(eq (match-beginning 1) here)))
(goto-char here))))
(defun c-beginning-of-macro (&optional lim)
"Go to the beginning of a preprocessor directive.
Leave point at the beginning of the directive and return t if in one,
......@@ -278,7 +296,8 @@ comment at the start of cc-engine.el for more info."
(forward-line -1))
(if (and (<= (point) here)
(looking-at c-opt-cpp-start))
(looking-at c-opt-cpp-start)
(setq c-macro-cache (cons (point) nil)
c-macro-cache-start-pos here)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment