Setting static Codepage in Far3-Editor.

Something is missing in Far Manager? You have a great idea that should be heard? Write here.
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

Latest post of the previous page:

I am using this macro, it is working again. Thank you.
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

Please, I need help.
I don't know how to write this macro for viewer.
2useven10
Posts: 5209
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 310 times

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 »

because of lack viewer-api try to use this 'old-school' version:

Code: Select all

Event {
  description="Set 28592 codepage";
  group="ViewerEvent"; filemask="*.4gl,*.err";
  action=function(Id,Event,Param)
    if Event == far.Flags.VE_READ then
      far.MacroPost([[
        local cp, favorite = 28592, false
        Keys("ShiftAltF9 Down Down 3 Enter")
        Keys("ShiftF8")
        if Object.ItemCount < 20 then Keys("CtrlH"); favorite = true end
        if Menu.Select(cp,1) > 0 then Keys("Enter") else Keys("Esc") end
        if favorite then Keys("ShiftF8 CtrlH Esc") end
      ]])
    end
  end;
} 
Last edited by 2useven10 on Thu 22 May, 2014 02:43, edited 2 times in total.
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

Thank you, it is working fine.
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

I don't know, what changed in Far3, but macro about Viewer is not working in version 3900 and later of Far3.
There is printing error "invalid flag combination" on line:
far.MacroPost([[
Can you help me?
Shmuel
Posts: 6820
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel »

Far3c wrote:There is printing error "invalid flag combination"
This is because KMFLAGS_DISABLEOUTPUT is no longer valid. Please delete "KMFLAGS_DISABLEOUTPUT" and restart Far.
  1. -      ]],"KMFLAGS_DISABLEOUTPUT")
  2.  
  3. +      ]])
User avatar
John Doe
Бюрократ
Posts: 13807
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 426 times
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by John Doe »

Far3c
Just in case: much time has passed since the topic was started, and Far Manager now have some useful features:
- it's possible to choose any system codepage as default for editor and viewer.
- it's possible to finetune autodetection, e.g. you can limit it to Favorite codepages.
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

Thank you Shmuel, now is macro working again.
I would like ask of John Doe about second suggestion (first tip I know), where can I find this "limit about Favorite codepage" for autodetection?
User avatar
John Doe
Бюрократ
Posts: 13807
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 426 times
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by John Doe »

Launch configuration editor far:config and find Codepages.NoAutoDetectCP.
You can open relevant help article by pressing Shift-F1, unfortunately it is not translated yet, so I'll try to explain this parameter.

You have 2 alternatives here: forbid some codepages, or opposite - forbid all codepages except System/Unicode/Favorites.
  1. Set Codepages.NoAutoDetectCP to string emumerating all codepages you want to forbid (use comma to separate numbers).
    Note that it's still impossible to forbid Unicode (1200, 1201, 65001)
  2. Set Codepages.NoAutoDetectCP = "-1", then open Options / Code Pages, and choose your Favorites in Other section (with Ins key).
    Then press Ctrl-H to hide Other section.
Not sure, but maybe it's also necessary to save settings / restart Far.
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

Very nice feature, this Far-Config. Thank you very match for this notice.
User avatar
John Doe
Бюрократ
Posts: 13807
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 73 times
Been thanked: 426 times
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by John Doe »

Some params listed there are not available elsewhere, you can see (outdated) list in Documentation\eng\TechInfo.txt
Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

OK. Thank you.
Post Reply

Return to “Suggestions and Ideas”