unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill <theo@thornhill.no>
To: Eli Zaretskii <eliz@gnu.org>
Cc: casouri@gmail.com, emacs-devel@gnu.org
Subject: Re: Missing features in c-ts-mode
Date: Wed, 15 Feb 2023 21:21:45 +0100	[thread overview]
Message-ID: <87y1oy65nq.fsf@thornhill.no> (raw)
In-Reply-To: <838rgyae6z.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Theodor Thornhill <theo@thornhill.no>
>> Cc: casouri@gmail.com, emacs-devel@gnu.org
>> Date: Wed, 15 Feb 2023 20:18:32 +0100
>> 
>> >> Isn't M-a and M-e available on master?
>> >
>> > Maybe, I didn't look there, sorry.  If they work there, then this one
>> > is fine.
>> >
>> 
>> They should be there, but they may need tweaking.  Let me know if they
>> behave unexpectedly.
>
> Hmm... they behave...strangely.
>
> Visit dispnew.c, turn on c-ts-mode, then go to line 174.  Type M-a and
> watch in disbelief where it goes.  Same surprise if you type M-e.
> Conclusion: preprocessor directives seem to drive this feature crazy.
>

Hmm, I cannot find any preproc directives there, but I think I
understand what you mean anyway.

> OK, so let's find a place without cpp directives.  Go to line 368:
>
> static void
> adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y, struct dim dim)
> {
>   int i;
>   int new_rows;
>   bool marginal_areas_changed_p = 0;
>   bool tab_line_changed_p = 0;  <<<<<<<<<<<<<<<<<<<<
>   bool tab_line_p = 0;
>
> Position point in the middle of the line and press M-a -- point goes
> to the first non-blank character of the line: good.  Now type M-a
> again -- point goes to the first non-blank character of the _previous_
> line: why?

Likely because that is the beginning of the "first" previous node
covered by the regexp.  Is that unexpected?

>
> Now go to line 382:
>
>   if (w)
>     {
>       window_box (w, ANY_AREA, 0, 0, &window_width, &window_height);
>
>       tab_line_p = window_wants_tab_line (w);
>       tab_line_changed_p = tab_line_p != matrix->tab_line_p; <<<<<<<<<<<<<<<
>
>       header_line_p = window_wants_header_line (w);
>       header_line_changed_p = header_line_p != matrix->header_line_p;
>     }
>   matrix->tab_line_p = tab_line_p;
>
> Position point anywhere inside that line and press M-a -- point goes
> to the "if" that encloses this block: why?  Moreover, if you go to the
> first line _after_ the braces, the one which begins with "matrix->",
> and press M-a, point still goes to that "if": why?
>
> C-M-f also appears broken: I cannot get it to move from an opening
> brace to the matching closing brace -- instead, it goes to the closing
> parenthesis of some inner expression.  For example, try C-M-f here:
>
>   else
>     {
>       /* If MATRIX->pool is null, MATRIX is responsible for managing
> 	 its own memory.  It is a window matrix for window-based redisplay.
> 	 Allocate glyph memory from the heap.  */
>       if (dim.width > matrix->matrix_w
> 	  || new_rows
> 	  || tab_line_changed_p
> 	  || header_line_changed_p
> 	  || marginal_areas_changed_p)
> 	{
> 	  struct glyph_row *row = matrix->rows;
>

Yeah, this is the same bug as in a different bug report, bug#61374.  I
didn't get to it yet, apologies!

> Place point at the opening brace after "else" and type "C-M-f" --
> point goes to the closing paren after "marginal_areas_changed_p".
>
> So this "needs work", I'd say ;-)


Hehe yeah. Thanks!  I'll check if just tweaking the regexps is enough,
but likely we need something more in the code dealing with this
too. Thanks for the detailed report though, now I have some clear
expectations to devise tests from.

Theo



  reply	other threads:[~2023-02-15 20:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 17:59 Missing features in c-ts-mode Eli Zaretskii
2023-02-15 18:29 ` Theodor Thornhill
2023-02-15 19:05   ` Eli Zaretskii
2023-02-15 19:18     ` Theodor Thornhill
2023-02-15 19:31       ` Theodor Thornhill
2023-02-15 19:48         ` Eli Zaretskii
2023-02-15 19:59           ` Theodor Thornhill
2023-02-16 19:14             ` Theodor Thornhill
2023-02-16 20:38               ` Eli Zaretskii
2023-02-16 21:05                 ` Theodor Thornhill
2023-02-17  8:29               ` Ergus
2023-02-17  8:42                 ` Eli Zaretskii
2023-02-17  9:56                 ` Theodor Thornhill
2023-02-17 12:20                   ` Eli Zaretskii
2023-02-17 16:37                     ` Ergus
2023-02-17 17:34                       ` Theodor Thornhill
2023-02-17 18:02                         ` Ergus
2023-02-17 18:10                           ` Theodor Thornhill
2023-02-17 18:27                             ` Ergus
2023-02-17 18:43                               ` Theodor Thornhill
2023-02-15 20:31           ` Felix
2023-02-16  7:35             ` Eli Zaretskii
2023-02-16  8:08               ` Theodor Thornhill
2023-02-16 12:10               ` Felix
2023-02-15 20:03       ` Eli Zaretskii
2023-02-15 20:21         ` Theodor Thornhill [this message]
2023-02-16  7:04           ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87y1oy65nq.fsf@thornhill.no \
    --to=theo@thornhill.no \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).