[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112296: Correct the placement of c-c
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112296: Correct the placement of c-cpp-delimiters when there're #s not at col 0. |
Date: |
Mon, 15 Apr 2013 16:10:24 +0000 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 112296
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Mon 2013-04-15 16:10:24 +0000
message:
Correct the placement of c-cpp-delimiters when there're #s not at col 0.
* progmodes/cc-langs.el (c-anchored-cpp-prefix): Reformulate and
place a submatch around the #.
* progmodes/cc-mode.el(c-neutralize-syntax-in-and-mark-CPP): Start
a search at BOL. Put the c-cpp-delimiter category text propertiy
on the #, not BOL.
modified:
lisp/ChangeLog
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-04-15 15:06:51 +0000
+++ b/lisp/ChangeLog 2013-04-15 16:10:24 +0000
@@ -1,3 +1,14 @@
+2013-04-15 Alan Mackenzie <address@hidden>
+
+ Correct the placement of c-cpp-delimiters when there're #s not at
+ col 0.
+
+ * progmodes/cc-langs.el (c-anchored-cpp-prefix): Reformulate and
+ place a submatch around the #.
+ * progmodes/cc-mode.el(c-neutralize-syntax-in-and-mark-CPP): Start
+ a search at BOL. Put the c-cpp-delimiter category text propertiy
+ on the #, not BOL.
+
2013-04-15 Stefan Monnier <address@hidden>
* emacs-lisp/nadvice.el: Properly test names when adding advice.
=== modified file 'lisp/progmodes/cc-langs.el'
--- a/lisp/progmodes/cc-langs.el 2013-03-05 17:13:01 +0000
+++ b/lisp/progmodes/cc-langs.el 2013-04-15 16:10:24 +0000
@@ -812,8 +812,8 @@
(c-lang-defconst c-anchored-cpp-prefix
"Regexp matching the prefix of a cpp directive anchored to BOL,
in the languages that have a macro preprocessor."
- t (if (c-lang-const c-opt-cpp-prefix)
- (concat "^" (c-lang-const c-opt-cpp-prefix))))
+ t "^\\s *\\(#\\)\\s *"
+ (java awk) nil)
(c-lang-defvar c-anchored-cpp-prefix (c-lang-const c-anchored-cpp-prefix))
(c-lang-defconst c-opt-cpp-start
=== modified file 'lisp/progmodes/cc-mode.el'
--- a/lisp/progmodes/cc-mode.el 2013-01-02 16:13:04 +0000
+++ b/lisp/progmodes/cc-mode.el 2013-04-15 16:10:24 +0000
@@ -936,7 +936,8 @@
;; 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.
@@ -945,14 +946,12 @@
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., "#//"
)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112296: Correct the placement of c-cpp-delimiters when there're #s not at col 0.,
Alan Mackenzie <=