Skip to content

Commit 225eba8

Browse files
fix(injection): Default to lower filetype if not detected
1 parent d7d0fc5 commit 225eba8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lua/orgmode/config/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ function Config:setup_ts_predicates()
397397
if not text or vim.trim(text) == '' then
398398
return
399399
end
400-
metadata['injection.language'] = utils.detect_filetype(text) or text:lower()
400+
metadata['injection.language'] = utils.detect_filetype(text)
401401
end, { force = true })
402402
end
403403

lua/orgmode/objects/edit_special/types/src.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function EditSpecialSrc:init()
7474
-- so base the range off of the name of the block
7575
local ft = self.src_block.children.parameters.text
7676
if ft then
77-
ft = utils.detect_filetype(ft) or ft:lower()
77+
ft = utils.detect_filetype(ft)
7878
end
7979

8080
local bufnr = es_utils.make_temp_buf()

lua/orgmode/utils/init.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,8 @@ function utils.find(entries, check_fn)
567567
return nil
568568
end
569569

570+
---@param name string
571+
---@return string
570572
function utils.detect_filetype(name)
571573
local map = {
572574
['emacs-lisp'] = 'lisp',
@@ -586,7 +588,7 @@ function utils.detect_filetype(name)
586588
if map[name] then
587589
return map[name]
588590
end
589-
return nil
591+
return name:lower()
590592
end
591593

592594
return utils

0 commit comments

Comments
 (0)