rules in mc.ext



Hello,

can I change the default internal viewer to something else (less)? I
think I could change each line individually:

  View=%view{ascii} mediainfo %f

to

  View=mediainfo %f | less

but I would rather change this once, globally.

Also, I am confused how the include directive works in mc.ext. As it
says in mc.ext, the rules are applied from top to bottom. Therefore, I
want to have exact, specific rules at the top

  shell/i/.tar.xz

and vague, "dirty-hack" rules as low as possible, ie

  type/^PC\ bitmap

I also think calling external command "file" is expensive, so I don't
want to call it too early, when simple regex rule is sufficient.

Anyways, so I have relatively early:

  shell/i/.gif
        Include=image

  include/image
        Open=([ "$DISPLAY" ] && gpicview %f >/dev/null 2>&1 &)
        View=%view{ascii} file %f

and at the bottom, I have:

  type/^PC\ bitmap
        Include=image

but this does not work because this last rule is after "include/image".
I thought, "include/image" just defines what "Include=image" means. But
apparently it must be right after I used "Include=image" ?

Lastly, is there some optimization in processing this decision tree?
Lets say I have 100 rules in mc.ext. And I press F3 on file.foo. MC goes
from top to bottom, testing each rule. If there are 50 rules "type/",
does it mean MC calls the file command 50 times (if it does not find
match earlier) ?

PS: I am using my original mc.ext file, which I kept over upgrades. I
noticed the format has changed, and it now uses scripts stored in
/usr/lib/mc/ext.d/:

  View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.xz

I would like to stick with my original format.

thank you,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]