all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Knut Anders Hatlen <kahatlen@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: 60397@debbugs.gnu.org
Subject: bug#60397: 29.0.60; c++-ts-mode could report better defun names
Date: Sun, 08 Jan 2023 08:05:30 +0100	[thread overview]
Message-ID: <87ilhhzeth.fsf@gmail.com> (raw)
In-Reply-To: <F0B18510-1230-447D-9BAE-B969477F1A56@gmail.com> (Yuan Fu's message of "Sat, 7 Jan 2023 16:06:18 -0800")

Yuan Fu <casouri@gmail.com> writes:

> Knut Anders Hatlen <kahatlen@gmail.com> writes:
>
>> The defun names reported by c++-ts-mode could still need a couple of
>> improvements:
>>
>> 1) In a buffer with c++-ts-mode and which-function-mode enabled, and
>> this content:
>>
>> struct S {
>>   int f1(int x) {
>>     return x + 1;
>>   }
>>   int g1(int x);
>> };
>>
>> int S::g1(int x) {
>>   return x + 1;
>> }
>>
>> Inside the inline f1 function definition, which-function-mode shows
>> "S.f1". But inside the out-of-line g1 function definition, it shows
>> "n/a" instead of "S.g1". (Not limited to structs. Classes have the same
>> problem.)
>
> Now the second function is displayed as S::g1.

Looks good now. Classes seem to be handled fine too.

>> 2) Namespaces are not handled. Given this content:
>>
>> namespace n {
>> int f1(int x) {
>>   return x + 1;
>> }
>> }
>>
>> namespace {
>> int f2(int x) {
>>   return x + 1;
>> }
>> }
>>
>> Inside the f1 and f2 function bodies, which-function-mode shows "f1" and
>> "f2", respectively. It would be better if it showed "n.f1" for the
>> former, and perhaps something like "(anonymous).f2" for the latter.
>
> Now the first function is shown as n.f1, the second is shown as f2.
> Making it (anonymous).f2 isn’t necessarily better than f2 IMO, and
> requires some non-trivial change to the current code, so I didn’t do it.

Fair enough. Thanks!

-- 
Knut Anders





  reply	other threads:[~2023-01-08  7:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29  7:42 bug#60397: 29.0.60; c++-ts-mode could report better defun names Knut Anders Hatlen
2023-01-02  0:27 ` Yuan Fu
2023-01-08  0:06 ` Yuan Fu
2023-01-08  7:05   ` Knut Anders Hatlen [this message]
2023-01-17  9:39 ` Yuan Fu

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

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

  git send-email \
    --in-reply-to=87ilhhzeth.fsf@gmail.com \
    --to=kahatlen@gmail.com \
    --cc=60397@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    /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 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.