From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Re: C++ name and add-log-current-defun Date: Wed, 20 Dec 2006 10:26:20 +0800 Message-ID: References: <20060922.133608.90794729.jet@gyve.org> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1166581608 19204 80.91.229.10 (20 Dec 2006 02:26:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 20 Dec 2006 02:26:48 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 20 03:26:47 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GwrAG-0000fs-Pv for ged-emacs-devel@m.gmane.org; Wed, 20 Dec 2006 03:26:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GwrAG-0005rB-An for ged-emacs-devel@m.gmane.org; Tue, 19 Dec 2006 21:26:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GwrA5-0005pl-M7 for emacs-devel@gnu.org; Tue, 19 Dec 2006 21:26:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GwrA2-0005k8-Kg for emacs-devel@gnu.org; Tue, 19 Dec 2006 21:26:29 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GwrA2-0005jN-Ci for emacs-devel@gnu.org; Tue, 19 Dec 2006 21:26:26 -0500 Original-Received: from [65.54.246.207] (helo=bay0-omc3-s7.bay0.hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GwrA1-0002bj-98 for emacs-devel@gnu.org; Tue, 19 Dec 2006 21:26:25 -0500 Original-Received: from hotmail.com ([64.4.26.37]) by bay0-omc3-s7.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Tue, 19 Dec 2006 18:26:24 -0800 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 19 Dec 2006 18:26:24 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Wed, 20 Dec 2006 02:26:20 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: <20060922.133608.90794729.jet@gyve.org> Original-To: jet@gyve.org, ihs_4664@yahoo.com X-OriginalArrivalTime: 20 Dec 2006 02:26:24.0098 (UTC) FILETIME=[3E75FC20:01C723DE] 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:63977 Archived-At: 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 >To: ihs_4664@yahoo.com, "Herbert Euler" >CC: emacs-devel@gnu.org >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 >Emacs-devel@gnu.org >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/