Skip to content

Commit 7987478

Browse files
feat(version)!: Drop support for Neovim < 0.11.0
1 parent 4da28a0 commit 7987478

File tree

13 files changed

+46
-90
lines changed

13 files changed

+46
-90
lines changed

README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Orgmode clone written in Lua for Neovim
1818

1919
*** Requirements
2020

21-
- Neovim 0.10.3 or later
21+
- Neovim 0.11.0 or later
2222

2323
*** Installation
2424
:PROPERTIES:

docs/index.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#+OPTIONS: H:9 ^:nil
22
* Nvim Orgmode
33

4-
Nvim orgmode is a clone of Emacs Orgmode for Neovim 0.10.3+.
4+
Nvim orgmode is a clone of Emacs Orgmode for Neovim 0.11.0+.
55
It aims to be a feature-complete implementation of Orgmode features in Neovim.
66

77
Online version of this documentation is available at [[https://nvim-orgmode.github.io]].

lua/orgmode/api/init.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
local OrgFile = require('orgmode.api.file')
33
local OrgHeadline = require('orgmode.api.headline')
44
local orgmode = require('orgmode')
5-
local validator = require('orgmode.utils.validator')
65
local Promise = require('orgmode.utils.promise')
76
local utils = require('orgmode.utils')
87

@@ -16,7 +15,7 @@ local OrgApi = {}
1615
---@param name? string|string[] specific file names to return (absolute path). If ommitted, returns all loaded files
1716
---@return OrgApiFile|OrgApiFile[]
1817
function OrgApi.load(name)
19-
validator.validate('name', name, { 'string', 'table' }, true)
18+
vim.validate('name', name, { 'string', 'table' }, true)
2019
if not name then
2120
return vim.tbl_map(function(file)
2221
return OrgFile._build_from_internal_file(file)
@@ -56,8 +55,8 @@ end
5655
---@param opts OrgApiRefileOpts
5756
---@return OrgPromise<boolean>
5857
function OrgApi.refile(opts)
59-
validator.validate('source', opts.source, 'table')
60-
validator.validate('destination', opts.destination, 'table')
58+
vim.validate('source', opts.source, 'table')
59+
vim.validate('destination', opts.destination, 'table')
6160

6261
if getmetatable(opts.source) ~= OrgHeadline then
6362
error('Source must be an OrgApiHeadline', 0)

lua/orgmode/capture/template/init.lua

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
local TemplateProperties = require('orgmode.capture.template.template_properties')
22
local Date = require('orgmode.objects.date')
33
local utils = require('orgmode.utils')
4-
local validator = require('orgmode.utils.validator')
54
local Calendar = require('orgmode.objects.calendar')
65
local Promise = require('orgmode.utils.promise')
76
local Input = require('orgmode.ui.input')
@@ -99,15 +98,15 @@ local Template = {}
9998
function Template:new(opts)
10099
opts = opts or {}
101100

102-
validator.validate('description', opts.description, 'string', true)
103-
validator.validate('template', opts.template, { 'string', 'table' }, true)
104-
validator.validate('target', opts.target, 'string', true)
105-
validator.validate('regexp', opts.regexp, 'string', true)
106-
validator.validate('headline', opts.headline, 'string', true)
107-
validator.validate('properties', opts.properties, 'table', true)
108-
validator.validate('subtemplates', opts.subtemplates, 'table', true)
109-
validator.validate('datetree', opts.datetree, { 'boolean', 'table' }, true)
110-
validator.validate('whole_file', opts.whole_file, 'boolean', true)
101+
vim.validate('description', opts.description, 'string', true)
102+
vim.validate('template', opts.template, { 'string', 'table' }, true)
103+
vim.validate('target', opts.target, 'string', true)
104+
vim.validate('regexp', opts.regexp, 'string', true)
105+
vim.validate('headline', opts.headline, 'string', true)
106+
vim.validate('properties', opts.properties, 'table', true)
107+
vim.validate('subtemplates', opts.subtemplates, 'table', true)
108+
vim.validate('datetree', opts.datetree, { 'boolean', 'table' }, true)
109+
vim.validate('whole_file', opts.whole_file, 'boolean', true)
111110

112111
local this = {}
113112
this.description = opts.description or ''

lua/orgmode/capture/template/template_properties.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
local validator = require('orgmode.utils.validator')
21
---@class OrgCaptureTemplateProperties
32
---@field empty_lines { before: integer, after: integer } | number
43
local TemplateProperties = {}
54

65
function TemplateProperties:new(opts)
76
opts = opts or {}
87

9-
validator.validate('empty_lines', opts.empty_lines, { 'table', 'number' }, true)
8+
vim.validate('empty_lines', opts.empty_lines, { 'table', 'number' }, true)
109

1110
local empty_lines = opts.empty_lines or {}
1211
if type(empty_lines) == 'number' then

lua/orgmode/capture/templates.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
local config = require('orgmode.config')
22
local Template = require('orgmode.capture.template')
3-
local validator = require('orgmode.utils.validator')
43

54
---@see https://orgmode.org/manual/Capture-templates.html
65

@@ -13,7 +12,7 @@ local Templates = {}
1312
function Templates:new(templates)
1413
local opts = {}
1514

16-
validator.validate('templates', templates, 'table', true)
15+
vim.validate('templates', templates, 'table', true)
1716

1817
opts.templates = {}
1918
for key, template in pairs(templates or config.org_capture_templates) do

lua/orgmode/colors/highlighter/markup/link.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---@class OrgLinkHighlighter : OrgMarkupHighlighter
22
---@field private markup OrgMarkupHighlighter
3-
---@field private has_extmark_url_support boolean
43
---@field private last_start_node_id? string
54
local OrgLink = {
65
valid_capture_names = {
@@ -14,7 +13,6 @@ OrgLink.__index = OrgLink
1413
function OrgLink:new(opts)
1514
local this = setmetatable({
1615
markup = opts.markup,
17-
has_extmark_url_support = vim.fn.has('nvim-0.10.2') == 1,
1816
}, OrgLink)
1917
this:_set_directive()
2018
return this
@@ -34,7 +32,7 @@ function OrgLink:_set_directive()
3432
node = node and node[#node]
3533
metadata['image.ignore'] = true
3634

37-
if not node or not self.has_extmark_url_support then
35+
if not node then
3836
return
3937
end
4038

@@ -199,10 +197,6 @@ function OrgLink:is_valid_end_node(entry)
199197
end
200198

201199
function OrgLink:_get_url(bufnr, line, start_col, end_col)
202-
if not self.has_extmark_url_support then
203-
return nil
204-
end
205-
206200
return vim.api.nvim_buf_get_text(bufnr, line, start_col, line, end_col, {})[1]
207201
end
208202

lua/orgmode/config/mappings/map_entry.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
local validator = require('orgmode.utils.validator')
2-
31
---@class OrgMapEntry
42
---@field provided_opts table
53
---@field handler string
@@ -52,11 +50,11 @@ end
5250
---@param opts? table<string, any>
5351
function MapEntry:new(handler, opts)
5452
opts = opts or {}
55-
validator.validate('handler', handler, { 'string', 'function' })
56-
validator.validate('modes', opts.modes, 'table', true)
57-
validator.validate('desc', opts.desc, 'string', true)
58-
validator.validate('help_desc', opts.help_desc, 'string', true)
59-
validator.validate('type', opts.type, 'string', true)
53+
vim.validate('handler', handler, { 'string', 'function' })
54+
vim.validate('modes', opts.modes, 'table', true)
55+
vim.validate('desc', opts.desc, 'string', true)
56+
vim.validate('help_desc', opts.help_desc, 'string', true)
57+
vim.validate('type', opts.type, 'string', true)
6058

6159
local data = {}
6260
data.provided_opts = opts

lua/orgmode/ui/menu.lua

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local validator = require('orgmode.utils.validator')
21
local config = require('orgmode.config')
32

43
---@class OrgMenuOption
@@ -40,14 +39,14 @@ end
4039

4140
---@param option OrgMenuOption
4241
function Menu:_validate_option(option)
43-
validator.validate('label', option.label, 'string')
44-
validator.validate('key', option.key, 'string')
45-
validator.validate('action', option.action, 'function', true)
42+
vim.validate('label', option.label, 'string')
43+
vim.validate('key', option.key, 'string')
44+
vim.validate('action', option.action, 'function', true)
4645
end
4746

4847
---@param items OrgMenuItem[]?
4948
function Menu:_validate_items(items)
50-
validator.validate('items', items, 'table', true)
49+
vim.validate('items', items, 'table', true)
5150
if not items then
5251
return
5352
end
@@ -65,17 +64,17 @@ end
6564

6665
---@param separator OrgMenuSeparator?
6766
function Menu:_validate_separator(separator)
68-
validator.validate('separator', separator, 'table', true)
67+
vim.validate('separator', separator, 'table', true)
6968
if separator then
70-
validator.validate('icon', separator.icon, 'string', true)
71-
validator.validate('length', separator.length, 'number', true)
69+
vim.validate('icon', separator.icon, 'string', true)
70+
vim.validate('length', separator.length, 'number', true)
7271
end
7372
end
7473

7574
---@param data OrgMenuOpts
7675
function Menu:_validate_data(data)
77-
validator.validate('title', data.title, 'string')
78-
validator.validate('prompt', data.prompt, 'string')
76+
vim.validate('title', data.title, 'string')
77+
vim.validate('prompt', data.prompt, 'string')
7978
self:_validate_items(data.items)
8079
self:_validate_separator(data.separator)
8180
end

lua/orgmode/utils/promise.lua

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local validator = require('orgmode.utils.validator')
21
---@diagnostic disable: undefined-field
32
-- Taken from https://github.com/notomo/promise.nvim
43

@@ -46,8 +45,8 @@ local new_empty_userdata = function()
4645
end
4746

4847
local new_pending = function(on_fullfilled, on_rejected)
49-
validator.validate('on_fullfilled', on_fullfilled, 'function', true)
50-
validator.validate('on_rejected', on_rejected, 'function', true)
48+
vim.validate('on_fullfilled', on_fullfilled, 'function', true)
49+
vim.validate('on_rejected', on_rejected, 'function', true)
5150
local tbl = {
5251
_status = PromiseStatus.Pending,
5352
_queued = {},
@@ -84,7 +83,7 @@ end
8483
--- @param executor fun(resolve:fun(...:any),reject:fun(...:any))
8584
--- @return OrgPromise
8685
function Promise.new(executor)
87-
validator.validate('executor', executor, 'function')
86+
vim.validate('executor', executor, 'function')
8887

8988
local self = new_pending()
9089

@@ -224,8 +223,8 @@ end
224223
--- @param on_rejected (fun(...:any):any)?: A callback on rejected.
225224
--- @return OrgPromise
226225
function Promise.next(self, on_fullfilled, on_rejected)
227-
validator.validate('on_fullfilled', on_fullfilled, 'function', true)
228-
validator.validate('on_rejected', on_rejected, 'function', true)
226+
vim.validate('on_fullfilled', on_fullfilled, 'function', true)
227+
vim.validate('on_rejected', on_rejected, 'function', true)
229228
local promise = new_pending(on_fullfilled, on_rejected)
230229
table.insert(self._queued, promise)
231230
vim.schedule(function()
@@ -250,7 +249,7 @@ end
250249
--- @param on_finally fun()
251250
--- @return OrgPromise
252251
function Promise.finally(self, on_finally)
253-
validator.validate('on_finally', on_finally, 'function', true)
252+
vim.validate('on_finally', on_finally, 'function', true)
254253
return self
255254
:next(function(...)
256255
on_finally()
@@ -310,7 +309,7 @@ end
310309
--- @param list any[]: promise or non-promise values
311310
--- @return OrgPromise
312311
function Promise.all(list)
313-
validator.validate('list', list, 'table')
312+
vim.validate('list', list, 'table')
314313
return Promise.new(function(resolve, reject)
315314
local remain = #list
316315
if remain == 0 then
@@ -341,9 +340,9 @@ end
341340
--- @param concurrency? number: limit number of concurrent items processing
342341
--- @return OrgPromise
343342
function Promise.map(callback, list, concurrency)
344-
validator.validate('list', list, 'table')
345-
validator.validate('callback', callback, 'function')
346-
validator.validate('concurrency', concurrency, 'number', true)
343+
vim.validate('list', list, 'table')
344+
vim.validate('callback', callback, 'function')
345+
vim.validate('concurrency', concurrency, 'number', true)
347346

348347
local results = {}
349348
local processing = 0
@@ -392,7 +391,7 @@ end
392391
--- @param list any[]: promise or non-promise values
393392
--- @return OrgPromise
394393
function Promise.race(list)
395-
validator.validate('list', list, 'table')
394+
vim.validate('list', list, 'table')
396395
return Promise.new(function(resolve, reject)
397396
for _, e in ipairs(list) do
398397
Promise.resolve(e)
@@ -411,7 +410,7 @@ end
411410
--- @param list any[]: promise or non-promise values
412411
--- @return OrgPromise
413412
function Promise.any(list)
414-
validator.validate('list', list, 'table')
413+
vim.validate('list', list, 'table')
415414
return Promise.new(function(resolve, reject)
416415
local remain = #list
417416
if remain == 0 then
@@ -441,7 +440,7 @@ end
441440
--- @param list any[]: promise or non-promise values
442441
--- @return OrgPromise
443442
function Promise.all_settled(list)
444-
validator.validate('list', list, 'table')
443+
vim.validate('list', list, 'table')
445444
return Promise.new(function(resolve)
446445
local remain = #list
447446
if remain == 0 then

0 commit comments

Comments
 (0)