Skip to content

Commit

Permalink
fix(attach): unset_directory couldn't switch from DIR to ID directory
Browse files Browse the repository at this point in the history
  • Loading branch information
troiganto committed Jan 30, 2025
1 parent 05846bb commit 79fa58e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/orgmode/attach/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,13 @@ end
function AttachCore:unset_directory(node, opts)
local old_dir = self:get_dir(node, true)
node:set_dir()
local new_dir = self:get_dir(node, true) -- new dir potentially via parent nodes
-- After removal, there might be a new DIR directory via inheritance.
local new_dir = self:get_dir_or_nil(node, true)
if not new_dir then
-- There is no parent node with a DIR property. Switch back to ID-based
-- directory.
new_dir = node:id_dir_get_or_create()
end
-- Ordering matters here: both `opts` should be evaluated before the
-- operations (copy if desired, delete if desired) start.
---@param do_copy? boolean
Expand Down

0 comments on commit 79fa58e

Please sign in to comment.