[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ name and add-log-current-defun
From: |
Herbert Euler |
Subject: |
Re: C++ name and add-log-current-defun |
Date: |
Wed, 20 Dec 2006 10:26:20 +0800 |
I found this not complete yet, since only going back one sexp
sometimes cannot reach the beginning of a name. Please take
``class_1::sub_class_2::method'' as an example. A complete
solution could be
*** add-log.el.~1.146.2.22.~ Mon Nov 13 10:58:16 2006
--- add-log.el Wed Dec 20 10:13:47 2006
*************** (defun add-log-current-defun ()
*** 916,922 ****
;; Include certain keywords if they
;; precede the name.
(setq middle (point))
! (forward-sexp -1)
;; Is this C++ method?
(when (and (< 2 middle)
(string= (buffer-substring (-
middle 2)
--- 916,923 ----
;; Include certain keywords if they
;; precede the name.
(setq middle (point))
! (while (not (looking-back "\\(^\\|
\\|\t\\)"))
! (forward-sexp -1))
;; Is this C++ method?
(when (and (< 2 middle)
(string= (buffer-substring (-
middle 2)
Regards,
Guanpeng Xu
From: Masatake YAMATO <address@hidden>
To: address@hidden, "Herbert Euler" <address@hidden>
CC: address@hidden
Subject: Re: C++ name and add-log-current-defun
Date: Fri, 22 Sep 2006 13:36:08 +0900 (JST)
Hi,
> Herbert Euler wrote:
> > add-log-current-defun cannot handle C++ names well. For
> > example, the current function:
> >
> > int some_class::some_method(int arg)
> > {
> > // ...
> > }
> >
> > If one invoke add-change-log-entry-other-window when point
> > is in this function, one would get
> >
> > * some_file.cpp (class::some_method):
> >
> > rather than
> >
> > * some_file.cpp (some_class::some_method):
> >
> > This is because add-log-current-defun in add-log.el calculates
> > the function name wrong. Below is the code:
> >
> > ;; Now find the right beginning of the name.
> > ;; Include certain keywords if they
> > ;; precede the name.
> > (setq middle (point))
> > (forward-word -1)
> > ;; Is this C++ method?
> > ;; ...
> >
> > (forward-word -1) wouldn't put point before `some_class',
> > but puts point before `c' in `some_class'.
> >
> > How about changing it to like this?
> >
> > (while (not (looking-back "\\(^\\|[ \t]\\)"))
> > (backward-word 1))
>
> How about making the intent clear:
>
> (skip-syntax-backward "w_") ; word and symbol characters
How about this one?
*** add-log.el 31 5 2006 16:12:48 +0900 1.177
--- add-log.el 22 9 2006 13:32:30 +0900
***************
*** 914,920 ****
;; Include certain keywords if they
;; precede the name.
(setq middle (point))
! (forward-word -1)
;; Is this C++ method?
(when (and (< 2 middle)
(string= (buffer-substring (- middle
2)
--- 914,920 ----
;; Include certain keywords if they
;; precede the name.
(setq middle (point))
! (forward-sexp -1)
;; Is this C++ method?
(when (and (< 2 middle)
(string= (buffer-substring (- middle
2)
Masatake YAMATO
_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
- Re: C++ name and add-log-current-defun,
Herbert Euler <=