Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_tab_dist() does not work #290

Closed
tksoh opened this issue Jan 18, 2021 · 8 comments
Closed

set_tab_dist() does not work #290

tksoh opened this issue Jan 18, 2021 · 8 comments

Comments

@tksoh
Copy link
Contributor

tksoh commented Jan 18, 2021

Tried to run "set_tab_dist(10)" in a macro. The tab space does not change and there's a warning message on the terminal window:

Warning: NEdit: set_tab_dist requires integer argument > 0 and <= 20

Using nedit commit 3d7f8ca

2021-01-18 16_45_30-Macro Commands

eteran added a commit that referenced this issue Jan 18, 2021
@eteran
Copy link
Owner

eteran commented Jan 18, 2021

Should be fixed in master, had an error flag check inverted :-(

PS. OK, now you've me curious, what is the practical application of setting the tab distance in a macro?

@eteran eteran closed this as completed Jan 18, 2021
@tksoh
Copy link
Contributor Author

tksoh commented Jan 19, 2021

If you must know... I am working on a macro version of editorconfig support, which might be helpful to nedit 5 users too. Actually, this is also what prompted me to submit issue #288 .

BTW, I also wonder if any other macro functions might be having some kind of issues too. Not knowing what level of testing you have done so far.

@eteran
Copy link
Owner

eteran commented Jan 19, 2021

I checked :-).

There was one other macro (set_wrap_margin) that needed fixing of the same kind (The downside to C&P during coding...). I Think we are in good shape with regards to this specific bug.

@eteran
Copy link
Owner

eteran commented Jan 19, 2021

BTW, very cool about trying to implement .editorconfig via macros. At the very least, until the necessary hooks are made available, you can have a macro that via a menu "applies .editorconfig settings" Or something like that. Not the ideal implementation, but workable.

@tksoh
Copy link
Contributor Author

tksoh commented Jan 19, 2021

Yup, that's the idea. I managed to get the indentation/tab setting working with your fix commit. It's pretty dumped down right now, but a good start nonetheless.

I'm a little upset with the fact the functions must be defined in a .nm file, and not within macros, which makes the macro much less sharable. Something for future enhancement maybe. If we upgrade the macro capability enough, there's actually quite a lot of things could be potentially done without hacking the source code.

Or we could switch to python :-P

@eteran
Copy link
Owner

eteran commented Jan 19, 2021

Honestly, I would LOVE to switch to python, it's on the TODO list 100%. The main hold up is I need to figure out a clever solution for being able to suspend/stop a python script in progress.

For NEdit macros, we literally implement a VM and execute a bunch of "instructions" at a time, periodically checking if we should let the main code do something else.

With python, I think for starters, we'll want to shove the work into a separate process so it's truly concurrent with NEdit (and also won't crash nedit if it crashes). But we'll still need a mechanism to say "stop the script"

@tksoh
Copy link
Contributor Author

tksoh commented Jan 19, 2021

Back in around 2005, I managed to squeeze perl into nedit 5 as a proof of concept hack. That was history.

I feel the python integration is probably something for 7.0 or beyond, and it's definitely going to a great feature. But we should not sideline nedit macro. It has proven itself useful over the years, and maybe just need to upgrade a little to make it more useful.

One other idea is perhaps we can add something like the system() or eval() functions to the macro engine, so we can call external perl/python script to process the data and then feed the result back to nedit via pipe or some files. Might not be as simple as it sounds though ;-)

@eteran
Copy link
Owner

eteran commented Jan 19, 2021

I agree. I actually wouldn't ever remove nedit macro support. Python would just be the new recommend way.

1div0 pushed a commit to 1div0/nedit-ng that referenced this issue Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants