From e4e6fca76599b8583f30bdfe752ec6d72c2eae13 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 30 Apr 2021 13:28:00 +0200 Subject: [PATCH] Fix unused variables and useless pending test --- lua/zettelkasten/init.lua | 2 +- lua/zettelkasten/link.lua | 3 ++- lua/zettelkasten/list.lua | 1 - lua/zettelkasten/list_spec.lua | 3 --- lua/zettelkasten/options.lua | 2 +- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lua/zettelkasten/init.lua b/lua/zettelkasten/init.lua index 8659909..ef74c11 100644 --- a/lua/zettelkasten/init.lua +++ b/lua/zettelkasten/init.lua @@ -10,7 +10,7 @@ local action = require 'zettelkasten.action' -- table. -- Recurses into subdirectories if recursive argument is true. function ZK.get_zettel_list(path, recursive) - return ls.get_anchors_and_paths(path, recursive or false, ZK.options) + return ls.get_anchors_and_paths(path, recursive or false) end -- Return a valid zettelkasten anchor for the current time, diff --git a/lua/zettelkasten/link.lua b/lua/zettelkasten/link.lua index 5172a5e..8eff6a7 100644 --- a/lua/zettelkasten/link.lua +++ b/lua/zettelkasten/link.lua @@ -53,7 +53,8 @@ function L.create(anchor, text, style) return parsers[style].style_func(anchor, text, o.zettel().extension) end --- Returns a correctly formatted link to a new zettel (without anchor). +-- Returns a correctly formatted link to a new zettel (a zettel which does not +-- possess an anchor yet). -- Takes an optional link text which will be added to the link. -- Takes an optional style according to which the link will be transformed. function L.new(text, style) diff --git a/lua/zettelkasten/list.lua b/lua/zettelkasten/list.lua index a6bae7a..d7d3aa0 100644 --- a/lua/zettelkasten/list.lua +++ b/lua/zettelkasten/list.lua @@ -13,7 +13,6 @@ local function cleanPath(path) end -- TODO transform paths: --- * to absolute value (e.g. ~ to home, scandir needs absolute) -- * to ensure / at the end (or no /) gets taken into account function ls.get_anchors_and_paths(path, recursive) -- TODO check for duplicates and warn user diff --git a/lua/zettelkasten/list_spec.lua b/lua/zettelkasten/list_spec.lua index 07e3299..6289d28 100644 --- a/lua/zettelkasten/list_spec.lua +++ b/lua/zettelkasten/list_spec.lua @@ -136,9 +136,6 @@ describe("get_anchors_and_paths", function() ls.get_anchors_and_paths('mydirectory', false, vim.g)) end) - - it("should default to the zettel root dir", - function() pending("not implemented") end) end) describe("get_zettel", function() diff --git a/lua/zettelkasten/options.lua b/lua/zettelkasten/options.lua index 799cfa5..3569f45 100644 --- a/lua/zettelkasten/options.lua +++ b/lua/zettelkasten/options.lua @@ -42,7 +42,7 @@ end local function get_options(defaults) local options = {} local def = defaults - for opt, v in pairs(def) do + for opt, _ in pairs(def) do -- check for vim options set (globally or buffer), otherwise use default value options[opt] = vim.g[def[opt].vimname] or vim.b[def[opt].vimname] or