-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update oldschoolkeys, tabmenu, yanksel plugins #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, just a bunch of formatting changes really.
Make sure all tests pass when using these modules as well.
oldschoolkeys/init.lua
Outdated
} | ||
local add_binds = modes.add_binds | ||
|
||
module("plugins.oldschoolkeys") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of module()
in plugins is now forbidden. This is because it unavoidably sets a global variable. Instead, declare a local table named _M
and return it at the end of the file. All subsequent top-level variables should either be local
or should be fields of _M
.
oldschoolkeys/init.lua
Outdated
@@ -4,24 +4,16 @@ | |||
|
|||
local pairs = pairs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
oldschoolkeys/init.lua
Outdated
|
||
module("plugins.oldschoolkeys") | ||
|
||
add_binds("normal", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening brace should go on the same line as add_binds
, and closing brace+paren should go on a new line:
add_binds("normal", {
...
})
tabmenu/init.lua
Outdated
@@ -7,80 +7,71 @@ local ipairs = ipairs | |||
local table = table | |||
|
|||
local lousy = require "lousy" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space here
tabmenu/init.lua
Outdated
@@ -7,80 +7,71 @@ local ipairs = ipairs | |||
local table = table | |||
|
|||
local lousy = require "lousy" | |||
|
|||
local modes = require "modes" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
yanksel/init.lua
Outdated
local add_binds, add_cmds = add_binds, add_cmds | ||
|
||
local modes = require "modes" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
yanksel/init.lua
Outdated
local modes = require "modes" | ||
|
||
local add_binds = modes.add_binds | ||
local add_cmds = modes.add_cmds | ||
|
||
module("plugins.yanksel") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto re module
yanksel/init.lua
Outdated
luakit.selection.primary = "" | ||
end), | ||
}) | ||
function yank_select(w) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say make this an action table, which is just a table with func
(function) and desc
(description) keys. See lib/binds.lua
for examples (scrolling actions).
tabmenu/init.lua
Outdated
local add_binds = modes.add_binds | ||
local add_cmds = modes.add_cmds | ||
local new_mode = modes.new_mode | ||
|
||
local add_binds, add_cmds = add_binds, add_cmds | ||
local new_mode, menu_binds = new_mode, menu_binds | ||
|
||
module("plugins.tabmenu") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto re module
tabmenu/init.lua
Outdated
local add_binds = modes.add_binds | ||
local add_cmds = modes.add_cmds | ||
local new_mode = modes.new_mode | ||
|
||
local add_binds, add_cmds = add_binds, add_cmds | ||
local new_mode, menu_binds = new_mode, menu_binds | ||
|
||
module("plugins.tabmenu") | ||
|
||
hide_box = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this _M.hide_box
Okay, here it goes. Check this one. Maybe in few time i'll fix user agent changer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly fixed now
Separately, I'd prefer it if you split this fixes commit and squashed the changes for each file into the earlier file-specific commits, as this keeps the git history clean.
Finally, make sure the tests pass; to do this:
- copy the modules into the luakit repo under
config/
- require these modules (
require "oldschoolkeys"
, etc.) inconfig/rc.lua
- run
make run-tests
oldschoolkeys/init.lua
Outdated
@@ -1,19 +1,17 @@ | |||
------------------------------------------------------------------------ | |||
-- Add some convenient keybindings back. -- | |||
------------------------------------------------------------------------ | |||
|
|||
local pairs = pairs | |||
local lousy = require("lousy") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blank lines between require lines
oldschoolkeys/init.lua
Outdated
add_binds("normal",{ | ||
{ "b", "Back", function (w, m) w:back(m.count) end, {count=1}}, | ||
{ "<Mod1-Page_Up>", "Reorder tabs", function (w, m) w.tabs:reorder(w.view, w.tabs:current() - m.count) end, {count=1}}, | ||
{ "<Mod1-Page_Down>", "Reorder tabs", function (w, m) w.tabs:reorder(w.view, (w.tabs:current() + m.count) % w.tabs:count()) end, {count=1}}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final })
should go on a new line
oldschoolkeys/init.lua
Outdated
|
||
add_binds("normal",{ | ||
{ "b", "Back", function (w, m) w:back(m.count) end, {count=1}}, | ||
{ "<Mod1-Page_Up>", "Reorder tabs", function (w, m) w.tabs:reorder(w.view, w.tabs:current() - m.count) end, {count=1}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are long enough that they should be multi-line
yanksel/init.lua
Outdated
module("plugins.yanksel") | ||
local _M = {} | ||
|
||
local funcs = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table should be called actions
It's passing tests |
I'm getting the following test failures:
The trailing whitespace / tabs are easy to fix. Just remove the lines with unused variables. -- vim: et:sw=4:ts=8:sts=4:tw=80 |
On tabmenu.lua lines 28 and 42, |
I'm not using vim, i'm using emacs. I just replaced tabs with spaces(4 tabs = 4 spaces) and run it through lua beautifier. Hide box is already _M.hide_box(really it is). And 28 and 42 is intended with 4 spaces |
Ok, wait for a second i fixed those references |
Even so, the project's coding standard is to use vim modelines (and I thought emacs could read vim modelines?) |
Ok, I see your fixes, let me try again |
ok, i pushed, some more fixes. should be ok with this variables. And i know shit about these "cool" vim aliases. My emacs display these lines pretty nicely. Maybe in vim the're broken somehow |
Ok, references are fixed, it's just whitespace errors and the extra |
Nice desktop btw; which wm? |
I think it would be ok to merge all this fixes commits into three comits or not? I3wm, polybar with bunch of scripts, rofi, Fedora(but most likely i would migrate to Void), fish shell and Emacs |
If they can be divided into three logically solid changesets — yes.
…On August 21, 2017 7:35:29 PM GMT+03:00, Ivan ***@***.***> wrote:
I think it would be ok to merge all this fixes commits into three
comits or not?
I3wm, polybar with bunch of scripts, rofi, Fedora(but most likely i
would migrate to Void), fish shell and Emacs
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#14 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
I don't understand about which extra require "lousy" you're talking about. Projectile with grep gives me 4 require lousy(each for 1 plugin) |
|
Fixed that one lousy |
Just whitespace issues now; by the way once this is finished it'd be good to modify the README as well to say which plugins are updated and which aren't. |
Can you point me on those whitespaces? |
Have you ran the tests? That'll show you where the errors are, but they should be basically the same as in the test paste above. I'd just run Separately, the files are still missing modelines |
I've run this sed command but it hasn't changed anything(diff is null). |
Okay i've added modelines and i still don't know what whitespaces you're talking about |
Sorry, I wasn't very clear when explaining before. There are two whitespace issues:
Let me know if that's not clear! |
Guess it was my bad on tab indents. :<
…On August 23, 2017 2:56:40 PM GMT+03:00, Aidan Holm ***@***.***> wrote:
Sorry, I wasn't very clear when explaining before. There are two
whitespace issues:
- The lua files have tabs at the beginning of the line, as part of the
indentation. This goes against the luakit code style standard, which is
that all files must be indented with spaces only.
To find these files, run `grep -rPn '\t' tabmenu oldschoolkeys yanksel`
from the `luakit-plugins` root folder. The easiest way to fix these
problems is to do a find and replace in emacs, but you can also use the
sed command I posted before.
Here is the output I get, that shows where the problems are:
```
tabmenu/init.lua:20: { ":tabmenu", [[Open tab menu]], function (w)
w:set_mode("tabmenu") end },
oldschoolkeys/init.lua:13: function (w, m)
oldschoolkeys/init.lua:14: w.tabs:reorder(w.view, w.tabs:current() -
m.count)
oldschoolkeys/init.lua:15: end, {count=1}},
oldschoolkeys/init.lua:17: function (w, m)
oldschoolkeys/init.lua:18: w.tabs:reorder(w.view, (w.tabs:current() +
m.count) % w.tabs:count())
oldschoolkeys/init.lua:19: end, {count=1}}
yanksel/init.lua:13: desc = "Yank selection.",
yanksel/init.lua:14: func = function (w)
yanksel/init.lua:15: local text = luakit.selection.primary
yanksel/init.lua:16: if not text then w:error("Empty selection.")
return end
yanksel/init.lua:17: luakit.selection.clipboard = text
yanksel/init.lua:18: w:notify("Yanked selection: " .. text)
yanksel/init.lua:19: luakit.selection.primary = ""
yanksel/init.lua:20: end,
```
- Trailing whitespace; there's a space at the end of a line in the
`yanksel/init.lua` file. This is also not allowed by the current code
standards, as it makes diffs larger than necessary, which makes it more
difficult to read them and can cause issues with `git blame`.
The problem is at line 11 of `yanksel/init.lua` (`local actions = {`).
Let me know if that's not clear!
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#14 (comment)
--
J.K.
|
@Plaque-fcc no worries, there weren't any tests for that kind of thing with the old luakit, and most things had a mix of tabs and spaces :) |
No, it was my first meet of Lua-driven software. And I still thank @mason-larobina for this.
…On August 23, 2017 3:00:48 PM GMT+03:00, Aidan Holm ***@***.***> wrote:
@Plaque-fcc no worries, there weren't any tests for that kind of thing
with the old luakit, and most things had a mix of tabs and spaces :)
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#14 (comment)
--
J.K.
|
Hey @schvabodka-man, any progress on this one? I'm happy to help if you have any questions |
No, progress. I'm busy now |
No problem |
Maybe in 2-3 days i will actually start to work on these whitespaces |
I've merged this one manually; thanks @schvabodka-man for updating these :) |
Thx, i really appreciate your cleanup on whitespaces cause i don't have much time now |
No problem |
Hello there! Due to changes in API plugin tabmenu was broken and unusable on newer versions of luakit. I fixed it to work with new api and it works nice. I've also removed standart hotkey for it(because anyway you can set it in you luakit config and not everyone wants to have this hotkey). I also fixed yankselect and old school keybindings plugins. Would be sweat if you'll merge this