Ticket #3497 (new enhancement)

Opened 9 years ago

Last modified 9 years ago

auto turn off sorting

Reported by: Nicolas Rybkin Owned by:
Priority: major Milestone: Future Releases
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

This change I made turns off sorting before cd'ing in some particular virtual file systems. Line in mc.ext that describes what to do for "Open" operation must end with "u", like this:

Open=%cd %p/uc1541://u

When user leaves this extfs sort order used before will be restored (even if user changed sort order while being in this vfs).
I added some code to /src/filemanager/panel.c. This isn't nice solution, of course. The best way would be use of some interface between script and mc, like script tells mc to turn off sorting with exit code, or just put some control code in the list it prints. This is bigger problem, but the solution I used works and seems to make no problems although maybe it is looking little rough. Yes, it can be called a "hack".
Why I want this feature: you know files order is important for many 8bit programms that if you copy files in other order the copy wouldn't run. It would be very convinient for user when he open and image of a diskette or a tape that mc turns of sort automatically and then restores sort_order when he cd'es back. Hope this change will be applied.

Attachments

panel.c (134.8 KB) - added by Nicolas Rybkin 9 years ago.
panel.c.diff (640 bytes) - added by Nicolas Rybkin 9 years ago.

Change History

Changed 9 years ago by Nicolas Rybkin

Changed 9 years ago by Nicolas Rybkin

comment:1 Changed 9 years ago by mooffie

I'd mark this a duplicate of ticket:2719.

comment:2 Changed 9 years ago by mooffie

maybe it is looking little rough. Yes, it can be called a "hack".

That's probably an understatement. This patch is an ad-hoc solution that would hardly be useful to anybody else (or even to yourself in a few months).

The best way would be [...]

The best way is to use mc^2. It lets you do such customizations easily without touching the C code. Here, in 5 minutes I wrote a snippet that does what you want:

https://github.com/mooffie/mc/blob/lua-4.8.14-port/src/lua/tests/snippets/sort_by_filesystem.lua

Note: See TracTickets for help on using tickets.