From 3b2452fd1ab156e0aa6259ed79c5abe8266233a8 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Tue, 26 Dec 2006 03:53:04 +0000 Subject: [PATCH] (add-log-current-defun): Call `forward-sexp' multiple times to pick a member function name defined as part of nested classes/namespaces. --- lisp/ChangeLog | 8 +++++++- lisp/add-log.el | 14 +++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87a00c26065..6d4d36d3be0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-12-26 Guanpeng Xu (tiny change) + + * add-log.el (add-log-current-defun): Call `forward-sexp' + multiple times to pick a member function name defined as + part of nested classes/namespaces. + 2006-12-26 Vinicius Jose Latorre * emacs-lisp/easymenu.el (easy-menu-change): New arg MAP to indicate @@ -2959,7 +2965,7 @@ * add-log.el (add-log-current-defun): Use `forward-sexp' instead of `forward-word' to pick c++::symbol. - Reported by Herbert Euler . + Reported by Guanpeng Xu . 2006-09-22 Kenichi Handa diff --git a/lisp/add-log.el b/lisp/add-log.el index 70345a122e1..2ecb274b4de 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el @@ -916,7 +916,19 @@ Has a preference of looking backwards." ;; Include certain keywords if they ;; precede the name. (setq middle (point)) - (forward-sexp -1) + ;; Single (forward-sexp -1) invocation is + ;; not enough for C++ member function defined + ;; as part of nested class and/or namespace + ;; like: + ;; + ;; void + ;; foo::bar::baz::bazz () + ;; { ... + ;; + ;; Here we have to move the point to + ;; the beginning of foo, not bazz. + (while (not (looking-back "\\(^\\|[ \t]\\)")) + (forward-sexp -1)) ;; Is this C++ method? (when (and (< 2 middle) (string= (buffer-substring (- middle 2) -- 2.39.2