Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 42a4ccf

Browse files
fix(tags): Do not sort tags in tags change prompt
Fixes #866
1 parent c889000 commit 42a4ccf

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lua/orgmode/org/mappings.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ end
4343
---@param tags? string|string[]
4444
function OrgMappings:set_tags(tags)
4545
local headline = self.files:get_closest_headline()
46-
local current_tags = utils.tags_to_string(headline:get_own_tags())
46+
local headline_tags = headline:get_own_tags()
47+
local current_tags = utils.tags_to_string(headline_tags)
4748

4849
if not tags then
4950
tags = utils.input('Tags: ', current_tags, function(arg_lead)

lua/orgmode/utils/init.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,13 @@ end
254254

255255
function utils.tags_to_string(taglist, sorted)
256256
local tags = ''
257+
local tags_list = taglist
257258
if #taglist > 0 then
258259
if sorted then
259-
table.sort(taglist)
260+
tags_list = vim.deepcopy(taglist)
261+
table.sort(tags_list)
260262
end
261-
tags = ':' .. table.concat(taglist, ':') .. ':'
263+
tags = ':' .. table.concat(tags_list, ':') .. ':'
262264
end
263265
return tags
264266
end

0 commit comments

Comments
 (0)