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

Cfg does not work with next master. #1

Closed
tviti opened this issue Sep 30, 2019 · 9 comments
Closed

Cfg does not work with next master. #1

tviti opened this issue Sep 30, 2019 · 9 comments

Comments

@tviti
Copy link
Owner

tviti commented Sep 30, 2019

This config works with latest next-browser release v1.3.2, but seems to be broken when run with the latest dev version (i.e. the master branch of the next-browser repo). From what I can tell, this is due to the switch to functional style configurations (see this issue ticket), but I honestly haven't spent a whole lot of time debugging so far.

So far the problems are:

  • Method of setting keybindings seems to have changed.
  • My hack for setting command aliases no longer works.
@vindarel
Copy link

Hey,

The configuration should still work, even if functions are marked duplicated. ping @Ambrevar

For aliases, ideas: define a command that calls another command (dumb), see alexandria:define-alias, see serapeum:defalias.

I used your open-home-dir with a simpler set-url:

(define-command open-home-dir ()
  "Open my home directory in a browser window (useful for viewing html exports
e.g. from org-mode or an Rmarkdown doc)."
  (let ((url (concatenate 'string "file://"
			  (directory-namestring (truename "~/")))))
    (set-url url)))

@Ambrevar
Copy link

Indeed, define-key does not take modes / schemes anymore, only keymaps.

The :mode argument was broken so I remove it.
The :scheme could be restored (it's an oversight on my end) with a "deprecated" warning. Shall we do it?

@tviti
Copy link
Owner Author

tviti commented Oct 1, 2019

Hey, thanks for taking the time to comment on this!

So it looks like I was incorrect earlier to say that release 1.3.2 works with
this cfg (it doesn't :P). I think the source of confusion was that I had
multiple versions of next floating around my ~/common-lisp dir. Since
cleaning that out, I have ascertained that at least
df99518
works, so I can at least "pin" that for day-to-day use.

Unfortunately, it looks like the issue may run deeper than just my init file,
since it looks like my custom port also is broken with the latest version. If I
remove init.lisp (i.e. run from NO user init file), I can start the browser,
and I am able to spin up a minibuffer (using M-x), but cannot actually enter
any text into the minibuffer. Based on the repl output, it looks like the core
is receiving the keypresses:

INFO:root:send code: 108 string: l modifiers: [''] low_level_data: 108
INFO:root:send code: 111 string: o modifiers: [''] low_level_data: 111
INFO:root:send code: 108 string: l modifiers: [''] low_level_data: 108

so I'm guessing there's been a change to the way that events are forwarded back
to the port (which now that I actually type it out, doesn't sound like it'll be
so bad to fix).

The configuration should still work, even if functions are marked duplicated.

Unfortunately this doesn't look to be the case. Here's an excerpt from the repl
after trying to start next:

; compilation unit finished
;   caught 1 WARNING condition
 <WARN> [02:06:55] next utility.lisp (setf get-default) -
  The (setf (get-default ...)) and (add-to-default-list ...) forms are deprecated.
WARNING: Command B doesn't have a documentation string
While evaluating the form starting at line 99, column 0
  of #P"/Users/taylor/.config/next/init.lisp":
While evaluating the form starting at line 9, column 0
  of #P"/Users/taylor/common-lisp/run_next_core.lisp":

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {10004F04C3}>:
  Error: could not load the init file:
EXPORT B causes name-conflicts in #<PACKAGE "NEXT/WEB-MODE"> between the
following symbols:
  NEXT::B, NEXT/WEB-MODE::B
See also:
  The ANSI Standard, Section 11.1.1.2.5

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

which confuses me a bit, since when I try to to inspect or call
next/web-mode::b, sbcl just tells me that it's unbound/undefined.

In any case, since exporting the symbol seems to be the root of the collision,
I'm guessing I can get around this by simply doing something like the following:

(push (make-instance 'command :sym 'b :pkg *package*) %%command-list)
(setf (fdefinition 'b) #'switch-buffer)

Although I'll have to sort out the port before I can test it :P

Indeed, define-key does not take modes / schemes anymore, only keymaps.

The :mode argument was broken so I remove it.
The :scheme could be restored (it's an oversight on my end) with a
"deprecated" warning. Shall we do it?

Cool, I think I have to take another look at your cfg then to figure out the new
way of doing keybindings. My C-[ mapping is the only one that is "mode
specific", but I think I can avoid that by just having it add push an ESCAPE
onto the key-chord stack (in effect making it an actual alias for ESCAPE).

@vindarel
Copy link

vindarel commented Oct 1, 2019

cannot actually enter any text into the minibuffer.

I experienced this. Did you rebuild next-gtk ?

@tviti
Copy link
Owner Author

tviti commented Oct 1, 2019

cannot actually enter any text into the minibuffer.

I experienced this. Did you rebuild next-gtk ?

Nope, this is using a lightly modified version of the PyQtWebEngine port (https://github.com/tviti/next), although I should probably build next-gtk on my CentOS machine one of these days so I can compare the dbus events to make sure the ones sent from my port are the same.

@Ambrevar
Copy link

Ambrevar commented Oct 1, 2019

b is the argument of a couple of functions. We might have a leaking macro somewhere... Maybe define-command, need to look into it.

Anyways, the easy fix is to rename your command :)

I've just reverted the define-key function, so now your define-key should work as they used to.

Regarding strange RPC behaviour you are witnessing: I can't tell for sure for the PyQt port, but maybe you could try cleaning the fasls in ~/.cache/common-lisp and recompiling the whole thing.

@tviti
Copy link
Owner Author

tviti commented Oct 2, 2019

b is the argument of a couple of functions. We might have a leaking macro somewhere... Maybe define-command, need to look into it.

When trying this with atlas-engineer/nyxt@09a66d0 the conflict seems to be with buffer-history-tree. With the command def for buffer-history-tree commented out, the def-cmd-aliascalls go just fine.

Anyways, the easy fix is to rename your command :)

Although this would totally defeat the purpose of being able to use vim ex style abbrevs from the minibuffer (e.g. like doing :b for switch-buffer) :p

I think you are right though, that dedicating an entire command def to the abbreviations (let alone using a single alpha-numeric character as a command name) is a really really bad idea, but sans an actual evil-ex command, its the path of least resistance to implement them.

One thought is I could get the same behavior by overriding the completion filter so that ex commands like b and e bring up their associated next command as the first suggestion. That or try to actually implement an evil-ex command entry prompt that is can filters commands to execute-command.

@Ambrevar
Copy link

Ambrevar commented Oct 2, 2019 via email

@Ambrevar
Copy link

Ambrevar commented Oct 2, 2019 via email

@tviti tviti closed this as completed in 8f24a1f Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants