From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: Re: C++ name and add-log-current-defun Date: Fri, 22 Sep 2006 13:36:08 +0900 (JST) Message-ID: <20060922.133608.90794729.jet@gyve.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1158903299 20729 80.91.229.2 (22 Sep 2006 05:34:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 22 Sep 2006 05:34:59 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 22 07:34:55 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GQdgT-0001ha-D1 for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2006 07:34:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GQdgS-0007Gz-SV for ged-emacs-devel@m.gmane.org; Fri, 22 Sep 2006 01:34:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GQdgE-00079u-5g for emacs-devel@gnu.org; Fri, 22 Sep 2006 01:34:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GQdgC-00073t-8Y for emacs-devel@gnu.org; Fri, 22 Sep 2006 01:34:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GQdgC-00073W-37 for emacs-devel@gnu.org; Fri, 22 Sep 2006 01:34:28 -0400 Original-Received: from [66.187.233.31] (helo=mx1.redhat.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GQdjr-00074Z-Ky for emacs-devel@gnu.org; Fri, 22 Sep 2006 01:38:15 -0400 Original-Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8M5YPKq026987; Fri, 22 Sep 2006 01:34:25 -0400 Original-Received: from pobox.tokyo.redhat.com (pobox.tokyo.redhat.com [172.16.33.225]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8M5YNBm025133; Fri, 22 Sep 2006 01:34:24 -0400 Original-Received: from localhost (dhcp92.tokyo.redhat.com [172.16.33.92]) by pobox.tokyo.redhat.com (8.12.8/8.12.8) with ESMTP id k8M5YHG0013700; Fri, 22 Sep 2006 14:34:21 +0900 Original-To: ihs_4664@yahoo.com, "Herbert Euler" In-Reply-To: X-Mailer: Mew version 4.2.53 on Emacs 22.0.51 / Mule 5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:60087 Archived-At: 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