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

Error when trying to write in apps #3

Open
innerout opened this issue Feb 8, 2021 · 20 comments
Open

Error when trying to write in apps #3

innerout opened this issue Feb 8, 2021 · 20 comments
Labels
!?!? What on earth is happening here? I have no clue. Send help. Cannot reproduce Why everyone should use determanistic environments Linux The right choice

Comments

@innerout
Copy link

innerout commented Feb 8, 2021

When invoking emacs-everywhere in any app and trying to paste the written text from Emacs in the apps the following error is thrown.

call-process: Wrong type argument: numberp, nil

I have all the tools in the README installed.
I am using doom-emacs with Emacs 27.1 in Archlinux with the latest doom commit.

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

Hello :)

Thanks for the info on your system, that's quite helpful. call-process is used in a few places though so if you could get your hands on a backtrace (setq debug-on-error t) that would be most helpful.

@innerout
Copy link
Author

innerout commented Feb 8, 2021

Hi, the error thrown when setting debug-on-error:

Debugger entered--Lisp error: (wrong-type-argument numberp nil)
  number-to-string(nil)
  (call-process "xdotool" nil nil nil "windowactivate" "--sync" (number-to-string emacs-everywhere-window-id))
  (if (eq system-type 'darwin) (call-process "osascript" nil nil nil "-e" (format "tell application \"%s\" to activate" emacs-everywhere-app-name)) (call-process "xdotool" nil nil nil "windowactivate" "--sync" (number-to-string emacs-everywhere-window-id)))
  emacs-everywhere-finish()
  (if (and (eq major-mode 'org-mode) (org-in-src-block-p)) (org-ctrl-c-ctrl-c) (emacs-everywhere-finish))
  (closure (t) nil (interactive) (if (and (eq major-mode 'org-mode) (org-in-src-block-p)) (org-ctrl-c-ctrl-c) (emacs-everywhere-finish)))()
  funcall-interactively((closure (t) nil (interactive) (if (and (eq major-mode 'org-mode) (org-in-src-block-p)) (org-ctrl-c-ctrl-c) (emacs-everywhere-finish))))
  call-interactively((closure (t) nil (interactive) (if (and (eq major-mode 'org-mode) (org-in-src-block-p)) (org-ctrl-c-ctrl-c) (emacs-everywhere-finish))) nil nil)
  command-execute((closure (t) nil (interactive) (if (and (eq major-mode 'org-mode) (org-in-src-block-p)) (org-ctrl-c-ctrl-c) (emacs-everywhere-finish))))

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

Ah! Interesting. Could you check the value of emacs-everywhere-window-id for me? (while in an Emacs Everywhere generated buffer).

@innerout
Copy link
Author

innerout commented Feb 8, 2021

The value of emacs-everywhere-window-id is nil .

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

As I suspected from your backtrace 🤔. Some more requests:

  • Could you give me the output of (emacs-everywhere-window-info-linux)
  • Then get any old window ID and run xdotool getactivewindow, if that works please try (emacs-everywhere-call "xdotool" "getactivewindow") in Emacs and let me know how that turns out.

@innerout
Copy link
Author

innerout commented Feb 8, 2021

(emacs-everywhere-window-info-linux) output
("Emacs" 75497646 "Emacs Everywhere :: Google-chrome — Error when trying to write in apps - Issue #…" 2 58 1916 1020)
xdotool getactivewindow output 88080394
(emacs-everywhere-call "xdotool" "getactivewindow") output "75497646"

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

Interesting. It seems like emacs-everywhere-window-id should be set then. If you call (emacs-everywhere) within your current Emacs does it work? From the info you just gave me it looks like it should.

@innerout
Copy link
Author

innerout commented Feb 8, 2021

No, it does not work it throws call-process: Wrong type argument: numberp, nil .

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

Hmmmmmmm. This is beginning to confound me.
Could you try re-defining the emacs-everywhere function as

(defun emacs-everywhere ()
  "Lanuch the emacs-everywhere frame from emacsclient."
  (let ((win-info (emacs-everywhere-window-info)))
    (pp win-info)
    (message "cmd: emacsclient -c -F %s --eval %s"
             (prin1-to-string emacs-everywhere-frame-parameters)
             (prin1-to-string
              `(emacs-everywhere-initialise ,@win-info)))
    (call-process "emacsclient" nil 0 nil
                  "-c" "-F" (prin1-to-string emacs-everywhere-frame-parameters)
                  "--eval" (prin1-to-string
                            `(emacs-everywhere-initialise ,@win-info)))))

Then, re-testing this by executing (emacs-everywhere), looking in *Messages* and let me know what you find.
I'm looking for something like:

("Emacs" 75509290 " *Minibuf-1* \342\227\211 emacs-everywhere" 2723 128 1996 792)

cmd: emacsclient -c -F ((name . "emacs-everywhere") (width . 80) (height . 12)) --eval (emacs-everywhere-initialise "Emacs" 75509290 " *Minibuf-1* \342\227\211 emacs-everywhere" 2723 128 1996 792)

@innerout
Copy link
Author

innerout commented Feb 8, 2021

When trying to execute emacs-everywhere the following error is thrown

Debugger entered--Lisp error: (void-function emacs-everywhere-window-info)
  (emacs-everywhere-window-info)
  (let ((win-info (emacs-everywhere-window-info))) (pp win-info) (message "cmd: emacsclient -c -F %s --eval %s" (prin1-to-string emacs-everywhere-frame-parameters) (prin1-to-string (cons 'emacs-everywhere-initialise win-info))) (call-process "emacsclient" nil 0 nil "-c" "-F" (prin1-to-string emacs-everywhere-frame-parameters) "--eval" (prin1-to-string (cons 'emacs-everywhere-initialise win-info))))
  emacs-everywhere()
  eval((emacs-everywhere) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

Ah, when it's redefined it won't be autoloader, so try (require 'emacs-everywhere) first.

@innerout
Copy link
Author

innerout commented Feb 8, 2021

OK the error is not thrown anymore but nothing is printed in Messages.

@tecosaur
Copy link
Owner

tecosaur commented Feb 8, 2021

Erm, this should be functionally identical just with some logging.
For a particular Emacs instance, you're running (emacs-everywhere) and checking *Messages* in that same instance (not the popup), yes?

@tecosaur tecosaur added the !?!? What on earth is happening here? I have no clue. Send help. label Feb 8, 2021
@innerout
Copy link
Author

innerout commented Feb 8, 2021

Yes, I am checking the same Emacs instance, only a nil is printed but I don't know if it is from your code.

@tecosaur tecosaur added Linux The right choice Cannot reproduce Why everyone should use determanistic environments labels Feb 8, 2021
hlissner added a commit to hlissner/emacs-everywhere that referenced this issue Feb 16, 2021
tecosaur pushed a commit that referenced this issue Feb 16, 2021
@tecosaur
Copy link
Owner

@innerout can you check to see if you still have this issue?

@innerout
Copy link
Author

innerout commented Feb 16, 2021

It does not throw call-process: Wrong type argument: numberp, nil anymore but when I close the frame it does not paste the text back. When I press C-c C-c or C-x 5 0 the same error is thrown. By mistake, I pressed C-x C-c previously when I wrote the initial message.

@tecosaur tecosaur reopened this Feb 16, 2021
@tecosaur
Copy link
Owner

Thanks for the update @innerout. I wish I knew how to proceed, but I've never seen that behaviour and am at a bit of a loss 😅.

@innerout
Copy link
Author

What information could I provide that may help you solve this?

@innerout
Copy link
Author

@tecosaur The only thing that may impact the plugin is that I am using i3+Gnome as my DE, which I never had a problem with. Could something not be registered as it should from the DE that you expect to be initialized, which messes the whole process? The weird thing is that emacs-anywhere works as it should without any problem occurring.

@tecosaur
Copy link
Owner

The best way to proceed is probably going back to #3 (comment). Given that there are (message ...) lines, there should either be content printed to *Messages* or an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!?!? What on earth is happening here? I have no clue. Send help. Cannot reproduce Why everyone should use determanistic environments Linux The right choice
Projects
None yet
Development

No branches or pull requests

2 participants