unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <jet@gyve.org>
Cc: emacs-devel@gnu.org
Subject: Re: C++ name and add-log-current-defun
Date: Fri, 22 Sep 2006 13:36:08 +0900 (JST)	[thread overview]
Message-ID: <20060922.133608.90794729.jet@gyve.org> (raw)
In-Reply-To: <eeu9p9$h4c$2@sea.gmane.org>

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

  reply	other threads:[~2006-09-22  4:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-21 12:39 C++ name and add-log-current-defun Herbert Euler
2006-09-21 15:05 ` Kevin Rodgers
2006-09-22  4:36   ` Masatake YAMATO [this message]
2006-09-22  7:30     ` Herbert Euler
2006-09-22 10:55       ` Masatake YAMATO
2006-09-22 14:01         ` Herbert Euler
2006-12-20  2:26     ` Herbert Euler
2006-12-22 20:50       ` Kevin Rodgers
2006-12-23  3:27         ` Herbert Euler
2006-12-27  7:50           ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060922.133608.90794729.jet@gyve.org \
    --to=jet@gyve.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).