Setting static Codepage in Far3-Editor.

Something is missing in Far Manager? You have a great idea that should be heard? Write here.
Shmuel
Posts: 5234
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Tue 05 Feb, 2013 19:59

Latest post of the previous page:

Try this macro with the next nightly build of Far Manager:

Code: Select all

Macro {
  description="Set 28592 codepage"; filemask="*.4gl";
  area="Editor"; key="Read"; flags="DisableOutput";
  action=function()
    Keys("ShiftF8 CtrlAltF 2 8 5 9 2")
    if Menu.GetValue():match("^28592") then Keys("Enter")
    else Keys("Esc")
    end
  end;
}

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

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 » Tue 05 Feb, 2013 20:06

Да так логичнее выгдядит.
Ещё бы заменить key="Read" на event="Load" ...

It looks more appropriate.
One suggestion to change key="Read" to event="Load" ...
Last edited by 2useven10 on Tue 05 Feb, 2013 20:20, edited 1 time in total.

User avatar
John Doe
Бюрократ
Posts: 11421
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 » Tue 05 Feb, 2013 20:09

2useven10 wrote:Да так логичнее выгдядит.
Ещё логичнее будет с использованием Menu.Select
2useven10 wrote:event[/color]="Load" ...
Это да

User avatar
t-rex
Страшный и ужасный
Posts: 4872
Joined: Tue 15 Mar, 2005 16:17
Location: Tel-Aviv
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by t-rex » Tue 05 Feb, 2013 20:11

No russian in the english forum please!

Shmuel
Posts: 5234
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Tue 05 Feb, 2013 22:07

2useven10 wrote:It looks more appropriate.
One suggestion to change key="Read" to event="Load" ...
"key" versus "event" -- didn't want to add new fields.
"read" versus "load" -- the terminology used in plugins API was chosen.
But these issues are still open to discussion.

User avatar
John Doe
Бюрократ
Posts: 11421
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 » Tue 05 Feb, 2013 23:09

Shmuel wrote:"key" versus "event" -- didn't want to add new fields.
viewtopic.php?p=100541#p100541

Shmuel
Posts: 5234
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Tue 05 Feb, 2013 23:21

John Doe
We can move to the Russian part of the forum and open a new topic dedicated to the latest changes in macro specification.

User avatar
John Doe
Бюрократ
Posts: 11421
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 » Tue 05 Feb, 2013 23:23


Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c » Wed 06 Feb, 2013 09:01

Thank you very much. It's working fine. (Molodci, sposibo.)
I want write yet:
I starting Far3 from another task so:
"\Far3\Far.exe /e blabla.4gl"
Therefore solutions with:
area="Editor"; key="Read";
is OK, but solutions with:
area="Shell"; key="F4";
is not usable.
Thank you once more.

Shmuel
Posts: 5234
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Thu 07 Feb, 2013 19:37

Far3c
Starting from the next nightly build your macro should look like this:

Code: Select all

Event {
  description="Set 28592 codepage"; filemask="*.4gl";
  group="EditorEvent"; name="Read";
  action=function()
    far.MacroPost([[
      Keys("ShiftF8 CtrlAltF 2 8 5 9 2")
      if Menu.GetValue():match("^28592") then Keys("Enter")
      else Keys("Esc")
      end
      ]],"KMFLAGS_DISABLEOUTPUT")
  end;
}

Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c » Fri 08 Feb, 2013 10:22

Thank you, Shmuel. I have next 3 questions.
I would like in this macro:
- add *.4gl and *.err files
- change setting:
F9 -> Options -> Editor settings -> Tab size=3
I would like run command "chcp 850" with start FarManager.

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

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 » Fri 08 Feb, 2013 11:55

Shmuel
Trunk version doesn't work.
Sorry CP select favorite mode was activated (Ctrl-H).

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

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 » Fri 08 Feb, 2013 12:42

Far3c
Try this version...

Code: Select all

Event {
  description="Set 28592 codepage"; filemask="*.4gl,*.err";
  group="EditorEvent"; name="Read";
  action=function()
    far.MacroPost([[
      local cp, favorite = 28592, false
      Keys("ShiftAltF9 Down Down 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
    ]],"KMFLAGS_DISABLEOUTPUT")
  end;
}
It should work with favorite mode too...

Shmuel
Posts: 5234
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Fri 08 Feb, 2013 14:50

Far3c wrote:Thank you, Shmuel. I have next 3 questions.
I would like in this macro:
- add *.4gl and *.err files
- change setting:
F9 -> Options -> Editor settings -> Tab size=3
I would like run command "chcp 850" with start FarManager.

Code: Select all

Event {
  description="Set 28592 codepage"; filemask="*.4gl,*.err";
  group="EditorEvent"; name="Read";
  action=function()
    editor.SetParam(nil, "ESPT_CODEPAGE", 28592)
    editor.SetParam(nil, "ESPT_TABSIZE", 3)
  end;
}
 
With regards to "chcp 850" I currently have no answer (lack of time).

Far3c
Posts: 14
Joined: Mon 04 Feb, 2013 15:27

Re: Setting static Codepage in Far3-Editor.

Post by Far3c » Fri 08 Feb, 2013 15:48

Super. In Editor and Viewer Settings is selection default Codepage now.
Thank you.

Shmuel
Posts: 5234
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 16 times
Been thanked: 152 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel » Mon 11 Feb, 2013 10:46

Far3c
If you're still using this macro, update it for the next nightly build to the version below:

Code: Select all

Event {
  description="Set 28592 codepage";
  group="EditorEvent"; filemask="*.4gl,*.err";
  action=function(Id,Event,Param)
    if Event == far.Flags.EE_READ then
      editor.SetParam(nil, "ESPT_CODEPAGE", 28592)
      editor.SetParam(nil, "ESPT_TABSIZE", 3)
    end
  end;
}
 

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

I am using this macro, it is working again. Thank you.

Post Reply

Return to “Suggestions and Ideas”