[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken
From: |
Alan Mackenzie |
Subject: |
Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken |
Date: |
18 Apr 2007 23:27:55 +0200 |
Date: |
Wed, 18 Apr 2007 23:48:04 +0100 |
User-agent: |
Mutt/1.5.9i |
Hi, Chong,
On Wed, Apr 18, 2007 at 04:43:15PM -0400, Chong Yidong wrote:
> Hi Alan,
> The behavior seems to be correct, as far as I can tell. However:
> > ! ;; Look for struct or union or ... If we find one, it might
> > ! ;; be the return type of a function, or the like. Exclude
> > ! ;; this case.
> > ! (c-syntactic-re-search-forward
> > ! (concat "[;=\(\[{]\\|\\("
> > ! c-opt-block-decls-with-vars-key
> > ! "\\)")
> > ! lim t t t)
> Do you really want to use `lim' here? That argument, if non-nil, is
> supposed to give a lower bound for the search, starting from point. I
> think the correct limit you are looking for is the original point
> where we started.
You're right. I did some careless copying and yanking from somewhere
else in the code. Sorry.
> (In fact, c-in-function-trailer-p is not called with a non-nil
> argument anywhere in Emacs, so this bug wouldn't show up, but it's
> better to be safe than sorry.)
Code should (i.e. must) do what its comments say. ;-)
> Similarly here:
> > ! (c-syntactic-re-search-forward "[;=\(\[{]" lim t t t)
Yes.
This should be better:
2007-04-18 acm <address@hidden>
* progmodes/cc-cmds.el (c-in-function-trailer-p): Fix this: when a
function type contains "struct", "union", etc. c-end-of-defun goes
too far forward.
Index: cc-cmds.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-cmds.el,v
retrieving revision 1.59
diff -c -r1.59 cc-cmds.el
*** cc-cmds.el 17 Apr 2007 20:48:43 -0000 1.59
--- cc-cmds.el 18 Apr 2007 21:23:26 -0000
***************
*** 1360,1369 ****
(and c-opt-block-decls-with-vars-key
(save-excursion
(c-syntactic-skip-backward "^;}" lim)
! (and (eq (char-before) ?\})
! (eq (car (c-beginning-of-decl-1 lim)) 'previous)
! (looking-at c-opt-block-decls-with-vars-key)
! (point)))))
(defun c-where-wrt-brace-construct ()
;; Determine where we are with respect to functions (or other brace
--- 1360,1383 ----
(and c-opt-block-decls-with-vars-key
(save-excursion
(c-syntactic-skip-backward "^;}" lim)
! (let ((eo-block (point))
! bod)
! (and (eq (char-before) ?\})
! (eq (car (c-beginning-of-decl-1 lim)) 'previous)
! (setq bod (point))
! ;; Look for struct or union or ... If we find one, it might
! ;; be the return type of a function, or the like. Exclude
! ;; this case.
! (c-syntactic-re-search-forward
! (concat "[;=\(\[{]\\|\\("
! c-opt-block-decls-with-vars-key
! "\\)")
! eo-block t t t)
! (match-beginning 1) ; Is there a "struct" etc., somewhere?
! (not (eq (char-before) ?_))
! (c-syntactic-re-search-forward "[;=\(\[{]" eo-block t t t)
! (eq (char-before) ?\{)
! bod)))))
(defun c-where-wrt-brace-construct ()
;; Determine where we are with respect to functions (or other brace
I'm off to bed, now. If everything's OK, I'll commit the patch tomorrow.
Thanks for checking my patch.
--
Alan.
- CC Mode 5.31.4 (C/l); c-end-of-defun broken, Andreas Schwab, 2007/04/18
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Glenn Morris, 2007/04/18
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Chong Yidong, 2007/04/18
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Alan Mackenzie, 2007/04/18
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Alan Mackenzie, 2007/04/18
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Chong Yidong, 2007/04/18
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken,
Alan Mackenzie <=
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Alan Mackenzie, 2007/04/19
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Chong Yidong, 2007/04/19
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Richard Stallman, 2007/04/20
- Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken, Chong Yidong, 2007/04/20