orbitalquark / textadept-open-file-mode

A Textadept module that extends the editor's Command Entry with a mode that can open files relative to the current file or directory. Tab-completion is available.
MIT License
3 stars 0 forks source link

Error on ui.lua when enabling this module #1

Closed richerve closed 3 years ago

richerve commented 3 years ago

Hi, just starting to use textadept and its modules

Steps

Error

As soon as I restart textadept, it will throw an error that the one shown below and it will keep repeating that error in a Messages Buffer/View taking focus and making impossible to use the editor.

/home/rich/Apps/textadept_11.1.linux/core/ui.lua:341: attempt to call a nil value (method 'get_lexer')...ps/textadept_11.1.linux/modules/textadept/file_types.lua:90: attempt to call a nil value (method 'set_lexer')

orbitalquark commented 3 years ago

So you have a modules/open_file_mode/init.lua file in your Textadept release directory, correct?

Where are you calling require('open_file_mode')? In your ~/.textadept/init.lua? Keep in mind the module returns a function, so you want to bind it to a key, e.g.

keys['alt+o'] = require('open_file_mode')

I need to update the documentation.

richerve commented 3 years ago

yes, was calling require on init.lua.

Was wondering how the command was going to be called. I thought for a minute that it was overriding the original ui.command_entry function directly so the same binding for command_entry would work.

orbitalquark commented 3 years ago

Okay, and if you remove the call to require() you don't get these errors? Unfortunately it's working for me, so I'm not sure what's going wrong.

richerve commented 3 years ago

correct, maybe is related to how I "installed" the app, I have symlinks that point to the original directory. But even executing ./textadept directly from that dir shows the same error 🤷

richerve commented 3 years ago

I downloaded the package again and execute it from the terminal and same error. Even tried with the new beta version.

orbitalquark commented 3 years ago

Try simply copying the contents of the module's init.lua into your ~/.textadept/init.lua, and change the last line "return ..." to "keys[...] = ..." (choose a key binding). Then run Textadept. Let's see if it's a module error or a Lua "require" error.

richerve commented 3 years ago

Sorry @orbitalquark ended up not using Textadept anymore. Thank you for your help