Skip to content
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

[parser] Bug: variables and concat don't get parsed correctly in the name part of a deflayermap definition #1027

Closed
1 task done
wis opened this issue May 11, 2024 · 1 comment · Fixed by #1028
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@wis
Copy link
Contributor

wis commented May 11, 2024

Requirements

Describe the bug

variables and concat don't get parsed correctly in the name part/arg of a deflayermap definition

this doesn't parse correctly (var reference in name arg):

(defvar
name codeLyr
vscTabLyr (concat $name kt)
)

(deflayermap ($name)
$t	(layer-switch $vscTabLyr)
$p	C-p
(t! esc-and-spc)
)

(deflayermap ($vscTabLyr)
$s	C-s
$x	C-w
(t! esc-and-spc) 
)

-- parses without errors but the layer is named in a literal way: $name

and this doesn't also (using concat):

(defvar
name code
vscTabLyr kt
)

(deflayermap ((concat $name Lyr))
$t	(layer-switch $vscTabLyr)
$p	C-p
(t! esc-and-spc)
)

(deflayermap ($vscTabLyr)
$s	C-s
$x	C-w
(t! esc-and-spc) 
)

-- does not parse

Relevant kanata config

deflayermap

To Reproduce

  1. use a $var or (concat what ever) as the name argument in deflayermap

Expected behavior

layer name should be parsed correctly and the layer named correctly

Kanata version

kanata 1.7.0-prerelease ( 13eaddd )

Debug logs

I don't think it might help or is necessary

Operating system

Windows 11

Additional context

I think you're familiar with my modus operandi of using Kanata, I use modes, and the way I enter modes is with key sequences, e.g. in the default mode "normal mode" I press i to enter insert mode (layer) to type text, or I press k to enter an "auto layer" a layer specific to the currently focused window's application, i.e. if explorer.exe is the currently focused window, when I press k, TCP client switches to explorerLyr, if it's VSCode it switches to codeLyr etc., I was trying to refactor my layer names in all of my modes' files for readability and maintainability, using variables and concat.

@wis wis added the bug Something isn't working label May 11, 2024
@jtroo
Copy link
Owner

jtroo commented May 12, 2024

Just for some context, today layer names are intentionally excluded in variable expansion. I believe my rationale at the time was that layer names are in a special enough position that I didn't want them to be var-ified; though this restriction was put in place before concat was usable for doing added variable manipulation. Perhaps it is time to revisit this decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants