Skip to content

Commit 717bb80

Browse files
committed
fix(tangle-mode): refactor if statement with no duplicate test
1 parent f7cbb22 commit 717bb80

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

lua/orgmode/babel/tangle.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ function Tangle:tangle()
155155
local mode_str = block['mode']
156156
local mode = nil
157157

158-
if mode_str and mode_str:sub(1, 1) == 'o' then
159-
mode = tonumber(mode_str:sub(2), 8)
160-
elseif mode_str then
161-
mode = chmod_style_to_octal(mode_str)
162-
if mode == nil then
163-
mode = ls_style_to_octal(mode_str)
158+
if mode_str then
159+
if mode_str:sub(1, 1) == 'o' then
160+
mode = tonumber(mode_str:sub(2), 8)
161+
else
162+
mode = chmod_style_to_octal(mode_str)
163+
if mode == nil then
164+
mode = ls_style_to_octal(mode_str)
165+
end
164166
end
165167
end
166168

0 commit comments

Comments
 (0)