Setting static Codepage in Far3-Editor.

Something is missing in Far Manager? You have a great idea that should be heard? Write here.
User avatar
ur4ltz
Posts: 76
Joined: Fri 08 Jan, 2010 14:07
Location: Харьков
Has thanked: 1 time

Re: Setting static Codepage in Far3-Editor.

Post by ur4ltz »

Latest post of the previous page:

Far3c wrote:I don't know what I am doing bad, but in my Far3 doesn't work this ESC-Plugin.
I would like ask again:
Is there any way to run Makto when I open the editor with some file automaticaly?
This version ESC compatible with latest Far3 build 3156.
ESC-v2.9x32.7z
ESC-v2.9x32.7z
(70.33 KiB) Downloaded 329 times
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel »

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: 5192
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 309 times

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 »

Да так логичнее выгдядит.
Ещё бы заменить 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: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

Setting static Codepage in Far3-Editor.

Post by John Doe »

2useven10 wrote:Да так логичнее выгдядит.
Ещё логичнее будет с использованием Menu.Select
2useven10 wrote:event="Load" ...
Это да
User avatar
t-rex
Страшный и ужасный
Posts: 4910
Joined: Tue 15 Mar, 2005 16:17
Location: Tel-Aviv
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by t-rex »

No russian in the english forum please!
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel »

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: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by John Doe »

Shmuel wrote:"key" versus "event" -- didn't want to add new fields.
http://forum.farmanager.com/viewtopic.p ... 41#p100541
Shmuel
Posts: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel »

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: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

Re: Setting static Codepage in Far3-Editor.

Post by John Doe »

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

Re: Setting static Codepage in Far3-Editor.

Post by Far3c »

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: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel »

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 »

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: 5192
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 309 times

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 »

Shmuel
Trunk version doesn't work.
Sorry CP select favorite mode was activated (Ctrl-H).
2useven10
Posts: 5192
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 309 times

Re: Setting static Codepage in Far3-Editor.

Post by 2useven10 »

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: 6815
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 526 times

Re: Setting static Codepage in Far3-Editor.

Post by Shmuel »

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 »

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

Return to “Suggestions and Ideas”