bugGNU nano - Bugs: bug #56997, an 'extendsyntax' command with...


You are not allowed to post comments on this tracker with your current authentication level.

bug #56997: an 'extendsyntax' command with 'header' or 'magic' reports an error

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sat 05 Oct 2019 11:16:59 AM UTC  
Severity:  3 - Normal Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Closed

Tue 08 Oct 2019 10:30:18 AM UTC, comment #4: 

Thanks for the improvements.  Applied and pushed to master, commit 265d3245.

(I had hoped to check each command after an 'extendsyntax' for validity, but... the nanorc syntax already colors those red, and most typos are likely to happen in the command argument, and those are not parsed anyway until the syntax is used.  So, this will do.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 08 Oct 2019 06:53:19 AM UTC, comment #3: 

extendsyntax c header ...
color red "."
extendsyntax c linter ...
color red "."

That currently displays "A 'color' command requires a preceding 'syntax' command" for both color commands. The first patch only displays it for the second color command, and the second patch doesn't display it at all.

The live_syntax and opensyntax should be set inside the header/magic if block, and the continue restored in the else block. And then set a closesyntax boolean in the if block and use it to turn off opensyntax, unless you see another way to turn off opensyntax.

These changes also don't display an invalid command twice.

(file #47628)

Brand Huntsman <brand>
Mon 07 Oct 2019 07:45:53 AM UTC, comment #2: 

Here's a better patch.  (This fix should in fact have been part of the fix for bug #56478.)

The patch has a small problem: if the extension command is invalid, then it will be reported twice when the syntax gets actually used.

(file #47625)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 06 Oct 2019 05:07:00 PM UTC, comment #1: 

Attached is a proposed solution (without whitespace adjustment).

(file #47624)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 05 Oct 2019 11:16:59 AM UTC, original submission:  

To reproduce, put at the end of your ~/.nanorc (which does an include of the standard c.nanorc syntax file) these two lines:

  extendsyntax c header "oops
  extendsyntax c magic "whoops"

Then run 'src/nano --syntax=c' and type ^X.  Result:

Error in /home/ben/.nanorc on line 262: Command "header" not understood
Error in /home/ben/.nanorc on line 263: Command "magic" not understood

Bug exists since nano-4.3.  In version 4.2 and before it worked fine.  It has something to do with the delayed processing of the used syntax, somehow something is skipped there.  Using the 'comment' or 'linter' commands with 'extendsyntax' works fine.  It's just 'header' and 'magic' that fail.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.



Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by brand (Updated the item)
  • -email is unavailable- added by bens
  • -email is unavailable- added by bens (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-30 bens Open/ClosedOpen => Closed
    2019-10-08 bens StatusIn Progress => Fixed
    2019-10-08 brand Attached File- => Added 3.patch, #47628
    2019-10-07 bens Attached File- => Added 0001-rcfile-process-extensions-to-file-matching-commands-.patch, #47625
    2019-10-06 bens Attached File- => Added process-filematch-extensions-rightaway.patch, #47624
        StatusNone => In Progress
        Summaryan 'extendsyntax'command with'header' or 'magic' does not work => an 'extendsyntax' command with 'header' or 'magic' reports an error
        Carbon-Copy- => Added brand

    Back to the top

    Powered by Savane 3.5