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 » Tue 12 Feb, 2013 17:10

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 » Tue 19 Mar, 2013 11:26

Please, I need help.
I don't know how to write this macro for viewer.

2useven10
Posts: 3045
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 2 times
Been thanked: 83 times

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 » Tue 19 Mar, 2013 11:58

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 » Wed 20 Mar, 2013 07:50

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 » Wed 21 May, 2014 05:57

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: 5230
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 151 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Wed 21 May, 2014 06:12

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. +      ]])

User avatar
John Doe
Бюрократ
Posts: 11415
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 17 times
Been thanked: 101 times

Re: Setting static Codepage in Far3-Editor.

Post by John Doe » Wed 21 May, 2014 07:24

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 » Wed 21 May, 2014 08:35

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: 11415
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 17 times
Been thanked: 101 times

Re: Setting static Codepage in Far3-Editor.

Post by John Doe » Wed 21 May, 2014 08:52

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 » Wed 21 May, 2014 09:38

Very nice feature, this Far-Config. Thank you very match for this notice.

User avatar
John Doe
Бюрократ
Posts: 11415
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 17 times
Been thanked: 101 times

Re: Setting static Codepage in Far3-Editor.

Post by John Doe » Wed 21 May, 2014 09:43

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 » Wed 21 May, 2014 13:46

OK. Thank you.

Post Reply

Return to “Suggestions and Ideas”