Re: [code] Error in markdown lexer

From: Mitchell <>
Date: Wed, 13 Nov 2013 18:56:26 -0500 (EST)


On Wed, 13 Nov 2013, Rena wrote:

> On Wed, Nov 13, 2013 at 10:57 AM, Mitchell <> wrote:
>> Hi Rena,
>> On Wed, 13 Nov 2013, Rena wrote:
>> When I open an empty file with .md extension in 7.0 I get endless errors:
>>> /home/rena/.textadept/modules/textadept/menu.lua:374: attempt to index a
>>> function value
>>> Menu.lua is:
>>> Specifically the problem line is: M.set_contextmenu(_M[lang] and
>>> _M[lang].context_menu or context_menu)
>>> so I suppose _M[lang] is a function in this case? I changed the offending
>>> line to:
>>> if _M[lang] and type(_M[lang]) ~= 'function' then
>>> M.set_contextmenu(_M[lang].context_menu or context_menu)
>>> else M.set_contextmenu(context_menu)
>>> end
>>> and that seems to have fixed it.
>> `_M[lang]` should always be a language module (hence, a table). `lang`
>> would be `markdown` in the case of a `.md` file. You are correct that in
>> your case, `_M.markdown` is a function. Do you have a `~/.textadept/modules/markdown/`
>> module that returns a function or some code that sets `_M.markdown` to a
>> function? I followed your steps on my machine and could not reproduce.
> I don't have ~/.textadept/modules/markdown/ or
> ~/.textadept/modules/markdown.lua. I looked at the lexers/markdown.lua
> (should be the one extracted from 7.0 archive without any changes) and it
> does appear to return a table. The only thing I can think of is something
> in my menu.lua, but I don't see anything there that should be causing
> issues.

Try this:

1. Start ta with no files and no previous session (e.g. `textadept -n`)
2. Open the command entry and type "=_M.markdown" followed by enter (no
3. Verify that nothing happens.
4. Open the command entry again and type
    "=package.searchpath('markdown', package.path)" followed by enter.
5. Verify that again, nothing happens.
6. If you do get something, then you have a 'markdown' module of some sort
    in your package path (not associated with Textadept), and that is what
    is causing the problem.
7. If you don't get anything, then yes, you probably have something that
    is writing to `_M.markdown`. You can start with a clean `~/.textadept/`
    and start importing things to diagnose the problem.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 13 Nov 2013 - 18:56:26 EST

This archive was generated by hypermail 2.2.0 : Thu 14 Nov 2013 - 06:39:50 EST