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

Add experimental support for MS-Windows with occasional bugs #71

Closed
wants to merge 3 commits into from
Closed

Add experimental support for MS-Windows with occasional bugs #71

wants to merge 3 commits into from

Conversation

hanwenguo
Copy link
Contributor

I've tried to add MS-Windows support to emacs-everywhere and here is the outcome. It doesn't work as a charm: it works most of the time, however bugs take place randomly (there are possible solutions). But something is better than nothing.

The support is mainly introduced by defining paste/focus/copy/app-info commands, considering missing MS-Windows cases and making some modifications to emacs-everywhere, emacs-everywhere-insert-selection in order to handle some MS-Windows specific problems without affecting their original functions.

Some drawbacks:

  1. Heavy usage of calls to Win32 API through P/Invoke by PowerShell commands. The reason is that, as there lacks utilities like xdotool and AppleScript on MS-Windows, this is the only way to manipulate windows/frames without dependence on external tools. One who can withstand external tools or files can create wrapper for the commands with PowerShell script files or some simple C# programs by their own.
  2. Not universal. The commands simulate C-c and C-v to copy and paste selections between target window and Emacs, so whether it get the right selection depends on how the target window handles these keystrokes. For example, it cannot be used with TeXmacs, which uses Emacs-style keymap so C-c doesn't copy and C-v doesn't paste. There might be other approaches, such as sending WM_COPY message.
  3. Instability. It cannot yank or do paste (though clipboard is actually changed) sometimes, this happens randomly. Possible solutions include telling the user to copy/paste manually before/after emacs-everywhere, which needs only two more keystrokes and will work like a charm.
  4. Slow speed. I don't know whether it is only my PC or generally the MS-Windows system that makes creating frames and calling processes very slow, yet acceptable.

@tecosaur
Copy link
Owner

Thanks! I'm open to merging this, but I've got a few comments on your coding style.

emacs-everywhere.el Outdated Show resolved Hide resolved
emacs-everywhere.el Outdated Show resolved Hide resolved
emacs-everywhere.el Outdated Show resolved Hide resolved
emacs-everywhere.el Outdated Show resolved Hide resolved
emacs-everywhere.el Outdated Show resolved Hide resolved
emacs-everywhere.el Outdated Show resolved Hide resolved
emacs-everywhere.el Outdated Show resolved Hide resolved
@hanwenguo
Copy link
Contributor Author

I just pushed a new commit to improve the coding style, please give it a review. 😄

@tecosaur
Copy link
Owner

Looking much better :) I'll give this a better look this evening

@tecosaur
Copy link
Owner

tecosaur commented Apr 6, 2023

Apparently that evening is now 😅, looks good — all that's missing is some docstrings 🙂

@tecosaur tecosaur mentioned this pull request Apr 6, 2023
@hanwenguo
Copy link
Contributor Author

Done! Please review it. 😄

@tecosaur
Copy link
Owner

tecosaur commented Jul 6, 2023

Sorry for the delay, and thanks. Merged (via Magit not GitHub)!

@tecosaur tecosaur closed this Jul 6, 2023
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

Successfully merging this pull request may close these issues.

2 participants