Skip to content

Commit

Permalink
Minor fixes + clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Jan 31, 2024
1 parent a20754e commit c83f9cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
10 changes: 7 additions & 3 deletions lua/obsidian/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ Client.find_tags_async = function(self, term, opts, callback)
local m_start, m_end, _ = unpack(match)
local tag = string.sub(line, m_start + 1, m_end)
if string.match(tag, "^" .. search.Patterns.TagCharsRequired .. "$") then
add_match(tag, path, note, match_data.line_number, line)
add_match(tag, path, note, match_data.line_number, line, m_start, m_end)
end
end

Expand Down Expand Up @@ -953,7 +953,9 @@ Client.new_note = function(self, title, id, dir, aliases)
frontmatter = self.opts.note_frontmatter_func(note)
end
note:save(nil, self:should_save_frontmatter(note), frontmatter)
log.info("Created note " .. tostring(note.id) .. " at " .. tostring(note.path))

local rel_path = self:vault_relative_path(note.path)
log.info("Created note " .. tostring(note.id) .. " at " .. tostring(rel_path and rel_path or note.path))

return note
end
Expand Down Expand Up @@ -1029,7 +1031,9 @@ Client._daily = function(self, datetime)
end
note:save(nil, self:should_save_frontmatter(note), frontmatter)
end
log.info("Created note " .. tostring(note.id) .. " at " .. tostring(note.path))

local rel_path = self:vault_relative_path(note.path)
log.info("Created note " .. tostring(note.id) .. " at " .. tostring(rel_path and rel_path or note.path))
end

return note
Expand Down
20 changes: 11 additions & 9 deletions lua/obsidian/commands/tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,17 @@ return function(client, data)
}

client:list_tags_async(function(all_tags)
pickers
.new(opts, {
prompt_title = "Tags",
finder = finders.new_table {
results = all_tags,
},
sorter = conf.generic_sorter(opts),
})
:find()
vim.schedule(function()
pickers
.new(opts, {
prompt_title = "Tags",
finder = finders.new_table {
results = all_tags,
},
sorter = conf.generic_sorter(opts),
})
:find()
end)
end)

return true
Expand Down

0 comments on commit c83f9cb

Please sign in to comment.