bugGNU nano - Bugs: bug #61691, [Wish] make word-completion take...

 
 

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

bug #61691: [Wish] make word-completion take all open buffers into account

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Fri 17 Dec 2021 02:29:52 PM UTC
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

( Jump to the original submission )

Wed 16 Nov 2022 08:11:40 AM UTC, comment #9: 

Released in nano-7.0.

(And yes, this is standard, non-choosable behavior.  Most users will have just one buffer open, so it will not affect them.  And the users that do use multiple buffers, I'm guessing most will want this behavior.  And we have too many options already.)

Benno Schulenberg <bens>
Project Administrator
Mon 15 Aug 2022 11:04:47 PM UTC, comment #8: 

Thanks Benno (and Marco)! Works like a charm!

PS. I see you've opted for this to be enforced rather than toggleable behaviour?

Tasos Papastylianou <tpapastylianou>
Fri 12 Aug 2022 08:22:47 AM UTC, comment #7: 

Fixed in git, commit a36b726b, by going through the other open buffers when reaching the end of the current one.

Benno Schulenberg <bens>
Project Administrator
Tue 09 Aug 2022 03:45:20 PM UTC, comment #6: 

As there is no response, and there was no signed-off patch, I have implemented the functionality myself, in a somewhat compacter way.  See attached.

(I thought this would be complicated to make, but after looking at Marco's patch last Sunday, I realized that it was in effect quite simple to do.)

(file #53549)

Benno Schulenberg <bens>
Project Administrator
Sun 07 Aug 2022 02:36:47 PM UTC, comment #5: 

Thanks for the patch.  Please post a cleaned-up version to nano-devel, including an adequate commit message.  Possible cleanups:

  • move the first setting of current_buffer to a better place, down to where the other variables for a new completion run are initialized;
  • rename the variable -- the word "current" is overused in nano's source -- I would suggest something like 'scouring' without the "_buffer";
  • trim unneeded comments;
  • trim the unneeded extra call of edit_refresh();
  • trim the unneeded "Trying other buffers..." feedback -- when you have multiple buffers open, it appears always, and thus obscures the important final message "No further matches".
Benno Schulenberg <bens>
Project Administrator
Sun 19 Jun 2022 06:43:52 PM UTC, comment #4: 

I want this feature. Attached is a patch with a preliminary implementation.

(file #53322)

Marco Diego Aurélio Mesquita <marcodiego>
Mon 17 Jan 2022 03:30:19 PM UTC, comment #3: 

Still getting to grips with the source, but I can try :)

Tasos Papastylianou <tpapastylianou>
Wed 12 Jan 2022 03:08:32 PM UTC, comment #2: 

Yes, it would be nice if nano would look at all buffers for possible completions.  If you have a patch...

(No guarantee, though, that the patch would be applied.)

Benno Schulenberg <bens>
Project Administrator
Fri 17 Dec 2021 02:33:03 PM UTC, comment #1: 

PS. A nice side-effect of this is that one could open a separate buffer and fill it with an autocompletion dictionary, that could then be accessed for word-completions in other open buffers.

Tasos Papastylianou <tpapastylianou>
Fri 17 Dec 2021 02:29:52 PM UTC, original submission:  

When editing code, I often have the following situation where:
 - I am editing a primary file
 - The primary file needs to include/import a secondary file, and then use a variable or function defined in this secondary file
 - I would like to perform word-completion from within the PRIMARY file, to get the name of the variable/function defined in the SECONDARY file.

E.g. consider this python example

# in functions.py
def a_very_important_function():   print( "Hello, World!" )

# in main.py
import functions
functions.a_very_important_function()

If a_very_important_function +verbatim+ was defined directly in the primary file, then I could simply type 'a' and then perform word completion (default key-binding: Ctrl-] ).

However, because this only appears in the secondary file, and there's no other instance of this word in the primary file, word-completion will not work, and I'll have to type the entire thing by hand.

Obviously, subsequent autocompletions on the same word will work, because this now exists in the primary file as well. However, I think it would be more useful in general, if word-completion took into account all open buffers, rather than just the current one.

I have no opinion if this behaviour should simply replace the current behaviour, or if it should be toggleable in nature.

Tasos Papastylianou <tpapastylianou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #53322:  0001-Consider-other-buffers-when-applying-completion.patch added by marcodiego (2KiB - text/x-patch - Preliminary implementation)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by marcodiego (Updated the item)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by tpapastylianou (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-11-16 bens Open/ClosedOpen Closed
    2022-08-12 bens StatusReady For Test Fixed
    2022-08-09 bens Attached File- Added 0001-completion-search-through-all-open-buffers-for-possi.patch, #53549
        StatusNone Ready For Test
    2022-08-07 bens Assigned toNone bens
    2022-06-19 marcodiego Attached File- Added 0001-Consider-other-buffers-when-applying-completion.patch, #53322
    2022-01-12 bens Severity3 - Normal 1 - Wish
        Summary[Wish] Make word-completion take into account all open buffers, not just current one [Wish] make word-completion take all open buffers into account

    Back to the top


    Powered by Savane 3.9