Skip to content

Commit 60a1016

Browse files
Resolve symlinks when getting agenda files
1 parent 7fc6ea3 commit 60a1016

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

DOCS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ require('orgmode').setup({
216216
f = {
217217
label = 'Export to RTF format',
218218
action = function(exporter)
219-
local current_file = vim.fn.bufname()
219+
local current_file = vim.api.nvim_buf_get_name(0)
220220
local target = vim.fn.fnamemodify(current_file, ':p:r')..'.rtf'
221221
local command = {'pandoc', current_file, '-o', target}
222222
local on_success = function(output)

lua/orgmode/config/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ function Config:get_all_files()
8080
end
8181

8282
local all_files = vim.tbl_map(function(file)
83-
return vim.fn.glob(vim.fn.fnamemodify(file, ':p'), 0, 1)
83+
return vim.tbl_map(function(path)
84+
return vim.fn.resolve(path)
85+
end, vim.fn.glob(vim.fn.fnamemodify(file, ':p'), 0, 1))
8486
end, files)
8587

8688
all_files = utils.concat(vim.tbl_flatten(all_files), all_filenames, true)

lua/orgmode/utils/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ function utils.get_nearest_block_node(file, cursor, accept_at_cursor)
496496
end
497497

498498
function utils.current_file_path()
499-
return vim.fn.fnamemodify(vim.fn.bufname(), ':p')
499+
return vim.api.nvim_buf_get_name(0)
500500
end
501501

502502
return utils

tests/plenary/ui/clock_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ describe('Clock', function()
103103

104104
it('should jump to the clocked out headline from anywhere', function()
105105
helpers.load_file(files[1])
106-
assert.are.same(files[1], vim.fn.bufname())
106+
assert.are.same(files[1], vim.api.nvim_buf_get_name(0))
107107
vim.cmd([[norm ,oxj]])
108-
assert.are.same(files[3], vim.fn.bufname())
108+
assert.are.same(files[3], vim.api.nvim_buf_get_name(0))
109109
assert.are.same(3, vim.fn.line('.'))
110110
end)
111111

0 commit comments

Comments
 (0)