* C++ qualified method names
@ 2017-05-26 9:39 Eli Zaretskii
2017-05-26 10:15 ` Yuri Khan
2017-05-26 10:21 ` Alan Mackenzie
0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-05-26 9:39 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
In the C++ method below:
void
regcache::raw_supply_integer (int foo)
{
whatever (foo);
}
invoking "M-: (c-defun-name) RET" produces "raw_supply_integer". Why
does it exclude the class qualification? Is there a way to have that
included? This is important e.g. when producing a ChangeLog entry for
such methods.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ qualified method names
2017-05-26 9:39 C++ qualified method names Eli Zaretskii
@ 2017-05-26 10:15 ` Yuri Khan
2017-05-26 12:37 ` Eli Zaretskii
2017-05-26 10:21 ` Alan Mackenzie
1 sibling, 1 reply; 6+ messages in thread
From: Yuri Khan @ 2017-05-26 10:15 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Alan Mackenzie, Emacs developers
On Fri, May 26, 2017 at 4:39 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> In the C++ method below:
>
> void
> regcache::raw_supply_integer (int foo)
> {
> whatever (foo);
> }
>
> invoking "M-: (c-defun-name) RET" produces "raw_supply_integer". Why
> does it exclude the class qualification? Is there a way to have that
> included? This is important e.g. when producing a ChangeLog entry for
> such methods.
This is a good question that opens a can of worms.
What if the clasess is in a namespace? Do you want to include the
namespace, too? …the whole chain of namespaces up to the root? What if
some of them are inline namespaces?
What if the method is overloaded on argument types? …on method
cv-qualifiers and ref-qualifiers?
What if the thing on which (c-defun-name) is a function template? …a
class template? …an explicit specialization? …a partial
specialization?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ qualified method names
2017-05-26 9:39 C++ qualified method names Eli Zaretskii
2017-05-26 10:15 ` Yuri Khan
@ 2017-05-26 10:21 ` Alan Mackenzie
2017-05-26 13:08 ` Eli Zaretskii
1 sibling, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2017-05-26 10:21 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Hello, Eli.
On Fri, May 26, 2017 at 12:39:00 +0300, Eli Zaretskii wrote:
> In the C++ method below:
> void
> regcache::raw_supply_integer (int foo)
> {
> whatever (foo);
> }
> invoking "M-: (c-defun-name) RET" produces "raw_supply_integer". Why
> does it exclude the class qualification? Is there a way to have that
> included? This is important e.g. when producing a ChangeLog entry for
> such methods.
Please try the following: it has the disadvantage that it doesn't strip
WS when somebody writes the declaration as "regcache :: \n
raw_supply_integer". But it should work in the vast majority of cases.
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index a5ddcb4b92..9c0798e752 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1870,7 +1870,7 @@ c-defun-name
(c-backward-token-2)
(c-backward-syntactic-ws))
(setq name-end (point))
- (c-backward-token-2)
+ (c-back-over-compound-identifier)
(buffer-substring-no-properties (point) name-end)))))))))
(defun c-declaration-limits (near)
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: C++ qualified method names
2017-05-26 10:15 ` Yuri Khan
@ 2017-05-26 12:37 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-05-26 12:37 UTC (permalink / raw)
To: Yuri Khan; +Cc: acm, emacs-devel
> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Fri, 26 May 2017 17:15:40 +0700
> Cc: Alan Mackenzie <acm@muc.de>, Emacs developers <emacs-devel@gnu.org>
>
> > void
> > regcache::raw_supply_integer (int foo)
> > {
> > whatever (foo);
> > }
> >
> > invoking "M-: (c-defun-name) RET" produces "raw_supply_integer". Why
> > does it exclude the class qualification? Is there a way to have that
> > included? This is important e.g. when producing a ChangeLog entry for
> > such methods.
>
> This is a good question that opens a can of worms.
>
> What if the clasess is in a namespace? Do you want to include the
> namespace, too? …the whole chain of namespaces up to the root? What if
> some of them are inline namespaces?
>
> What if the method is overloaded on argument types? …on method
> cv-qualifiers and ref-qualifiers?
>
> What if the thing on which (c-defun-name) is a function template? …a
> class template? …an explicit specialization? …a partial
> specialization?
Since it is easier to delete than to type, I guess my answer would be
"all of the above".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ qualified method names
2017-05-26 10:21 ` Alan Mackenzie
@ 2017-05-26 13:08 ` Eli Zaretskii
2017-05-30 17:10 ` Alan Mackenzie
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-05-26 13:08 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> Date: Fri, 26 May 2017 10:21:01 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
>
> > void
> > regcache::raw_supply_integer (int foo)
> > {
> > whatever (foo);
> > }
>
> > invoking "M-: (c-defun-name) RET" produces "raw_supply_integer". Why
> > does it exclude the class qualification? Is there a way to have that
> > included? This is important e.g. when producing a ChangeLog entry for
> > such methods.
>
> Please try the following: it has the disadvantage that it doesn't strip
> WS when somebody writes the declaration as "regcache :: \n
> raw_supply_integer". But it should work in the vast majority of cases.
Yes, it works well enough, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ qualified method names
2017-05-26 13:08 ` Eli Zaretskii
@ 2017-05-30 17:10 ` Alan Mackenzie
0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2017-05-30 17:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Hello, Eli.
On Fri, May 26, 2017 at 16:08:34 +0300, Eli Zaretskii wrote:
> > Date: Fri, 26 May 2017 10:21:01 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > > void
> > > regcache::raw_supply_integer (int foo)
> > > {
> > > whatever (foo);
> > > }
> > > invoking "M-: (c-defun-name) RET" produces "raw_supply_integer". Why
> > > does it exclude the class qualification? Is there a way to have that
> > > included? This is important e.g. when producing a ChangeLog entry for
> > > such methods.
> > Please try the following: it has the disadvantage that it doesn't strip
> > WS when somebody writes the declaration as "regcache :: \n
> > raw_supply_integer". But it should work in the vast majority of cases.
> Yes, it works well enough, thanks.
I've committed it.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-30 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-26 9:39 C++ qualified method names Eli Zaretskii
2017-05-26 10:15 ` Yuri Khan
2017-05-26 12:37 ` Eli Zaretskii
2017-05-26 10:21 ` Alan Mackenzie
2017-05-26 13:08 ` Eli Zaretskii
2017-05-30 17:10 ` Alan Mackenzie
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.