Re: mc macro recording/editing issues

2017-09-20 Thread Andrew Borodin
On Wed, 20 Sep 2017 12:28:02 +0300 Sergey Naumov  wrote:
> But I will try to use macro too.
> In the code (usermenu.c: expand_format()) I see that despite mcedit manual
> mentions %c, it is not actually supported.
> Could I fix %c and also add %C as file offset (WEdit.buffer.curs1)? Should
> I file a bug for it?

No. usermenu.c isn't related to editor and editor macros. It is related to user 
menu
(called via F2 in file namager or F11 in the editor).

I can't confirm that recorded macro isn't stored in ~/.local/share/mc/mc.macros.
It works for me. But ctrl-space. It is some special case.

-- 
Andrew.
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


Re: mc macro recording/editing issues

2017-09-20 Thread Sergey Naumov
AFAIU the call chain is the following:

{"ExecuteScript", CK_PipeBlock (0)}

/* CK_PipeBlock */ edit_block_process_cmd()  ->  user_menu()  ->
user_menu_cmd()  ->  execute_menu_command()  ->  expand_format()

Therefore format of .local/share/mc/mcedit/macros.d/macro.*.sh is the same
as for usermenu entries - they are handled by the same code.

Thanks,
Sergey.

2017-09-20 12:40 GMT+03:00 Andrew Borodin :

> On Wed, 20 Sep 2017 12:28:02 +0300 Sergey Naumov 
> wrote:
> > But I will try to use macro too.
> > In the code (usermenu.c: expand_format()) I see that despite mcedit
> manual
> > mentions %c, it is not actually supported.
> > Could I fix %c and also add %C as file offset (WEdit.buffer.curs1)?
> Should
> > I file a bug for it?
>
> No. usermenu.c isn't related to editor and editor macros. It is related to
> user menu
> (called via F2 in file namager or F11 in the editor).
>
> I can't confirm that recorded macro isn't stored in
> ~/.local/share/mc/mc.macros.
> It works for me. But ctrl-space. It is some special case.
>
> --
> Andrew.
>
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


Re: mc macro recording/editing issues

2017-09-20 Thread Sergey Naumov
Thanks, Yury.

But I will try to use macro too.
In the code (usermenu.c: expand_format()) I see that despite mcedit manual
mentions %c, it is not actually supported.
Could I fix %c and also add %C as file offset (WEdit.buffer.curs1)? Should
I file a bug for it?

Thanks,
Sergey.



2017-09-19 20:16 GMT+03:00 Yury V. Zaytsev :

> On Tue, 19 Sep 2017, Sergey Naumov wrote:
>
> Also is there a way for macros to get cursor position in a file in a form
>> of offset from the beginning of the file?
>>
>> What I'm trying to achieve is to get some sort of autocompletion for
>> golang using gocode, and it is done like this:
>>
>
> I think you might get luckier with mcedit/etags integration, not sure if
> there it anything etags-like for go, but if I were you, I'd rather look
> into this...
>
> --
> Sincerely yours,
> Yury V. Zaytsev
>
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


Re: mc macro recording/editing issues

2017-09-19 Thread Yury V. Zaytsev

On Tue, 19 Sep 2017, Sergey Naumov wrote:

Also is there a way for macros to get cursor position in a file in a 
form of offset from the beginning of the file?


What I'm trying to achieve is to get some sort of autocompletion for 
golang using gocode, and it is done like this:


I think you might get luckier with mcedit/etags integration, not sure if 
there it anything etags-like for go, but if I were you, I'd rather look 
into this...


--
Sincerely yours,
Yury V. Zaytsev
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


Re: mc macro recording/editing issues

2017-09-19 Thread Sergey Naumov
Also is there a way for macros to get cursor position in a file in a form
of offset from the beginning of the file?

What I'm trying to achieve is to get some sort of autocompletion for golang
using gocode, and it is done like this:

# cat pcap-read.go | gocode autocomplete 552
Found 2 candidates:
  func OpenLive(device string, snaplen int32, promisc bool, timeout
time.Duration) (handle *pcap.Handle, _ error)
  func OpenOffline(file string) (handle *pcap.Handle, err error)


where 552 is a cursor position from the beginning of the file.

Thanks,
Sergey.

2017-09-19 15:41 GMT+03:00 Sergey Naumov :

> Hi All.
>
> I'm trying to use macro in mcedit. Man says, that recoded macros should
> end up in ~/.local/share/mc/mc.macros file. Neither when I record a macro
> nor when I use "save setup" in mcedit or mc I do no see any updates in
> mc.macros. If I exit from mc and start it again, recorded macro get lost.
> If I manually try to describe a macro in mc.macros, I do not see it
> available in mcedit.
>
> So what I've tried:
> 1. Use Ctrl-r to record a macro: it works, but only until I exit from mc.
> 2. Put the following into ~/.local/share/mc/mc.macros:
> [editor]
> ctrl-space=EditWordLeftHighlight:-1;
>
> $ mc -V
> GNU Midnight Commander 4.8.19-65-g5e5f57c
> Built with GLib 2.48.0
> Using the S-Lang library with terminfo database
> With builtin Editor
> With subshell support as default
> With support for background operations
> With mouse support on xterm and Linux console
> With support for X11 events
> With internationalization support
> With multiple codepages support
> Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
> Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
>
> Could you please tell me what I'm doing wrong.
>
> Thanks,
> Sergey.
>
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


mc macro recording/editing issues

2017-09-19 Thread Sergey Naumov
Hi All.

I'm trying to use macro in mcedit. Man says, that recoded macros should end
up in ~/.local/share/mc/mc.macros file. Neither when I record a macro nor
when I use "save setup" in mcedit or mc I do no see any updates in
mc.macros. If I exit from mc and start it again, recorded macro get lost.
If I manually try to describe a macro in mc.macros, I do not see it
available in mcedit.

So what I've tried:
1. Use Ctrl-r to record a macro: it works, but only until I exit from mc.
2. Put the following into ~/.local/share/mc/mc.macros:
[editor]
ctrl-space=EditWordLeftHighlight:-1;

$ mc -V
GNU Midnight Commander 4.8.19-65-g5e5f57c
Built with GLib 2.48.0
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

Could you please tell me what I'm doing wrong.

Thanks,
Sergey.
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel