[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ name and add-log-current-defun

From: Kevin Rodgers
Subject: Re: C++ name and add-log-current-defun
Date: Thu, 21 Sep 2006 09:05:39 -0600
User-agent: Thunderbird (Windows/20060909)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]