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

How do I get the edit with emacs to work with doom? #76

Closed
atanasj opened this issue Dec 16, 2020 · 7 comments · Fixed by #79
Closed

How do I get the edit with emacs to work with doom? #76

atanasj opened this issue Dec 16, 2020 · 7 comments · Fixed by #79
Assignees

Comments

@atanasj
Copy link

atanasj commented Dec 16, 2020

First of all, great work!

I'm keen to get this working with doom. I have the below in my config:

(defun on-spacehammer-edit-with-emacs (buffer-name pid title)
  (with-current-buffer (get-buffer buffer-name)
    ;; (spacemacs/evil-search-clear-highlight)
    ;; (spacemacs/toggle-visual-line-navigation-on)
    (markdown-mode)
    (evil-insert 1)))

(use-package! spacehammer
  :demand t
  :load-path "~/git/dotfiles/keyboard/spacehammer" ; this is the spacehammer.el file is
  :config
  (add-hook 'edit-with-emacs-hook 'on-spacehammer-edit-with-emacs))

I'm not sure what to do about the spacemacs related functions.

So far the ctrl+cmd+O works to open in an emacs session, however it opens in Funamental-mode and the C-c C-c binding gives and error: Symbol's function definition is void: spacemacs/copy-whole-buffer-to-clipboard.

Any help would be greatly appreciated.

@agzam agzam self-assigned this Jan 11, 2021
@agzam
Copy link
Owner

agzam commented Jan 11, 2021

Sorry, I just saw this. I keep forgetting to make it compatible with non-spacemacs configs, it requires tiny changes in spacehammer.el. I'll push something out maybe later today.

@paultopia
Copy link

I just ran into this on my naked emacs---it looks like the only thing that explicitly requires spacemacs is a call to spacemacs-copy-whole-buffer-to-clipboard on line 118 of spacehammer.el. If that's literally just trying to copy the buffer to the system clipboard, then for every major emacs build for mac (i.e., integrated with system clipboard) it's as simple as

(defun copy-buffer-to-clipboard ()
  (interactive)
  (save-excursion
    (copy-region-as-kill (point-min) (point-max))))

(and actually, I don't even know if the save-excursion call is necessary)

I just tried swapping that in for the spacemacs call on my own machine, and it... kinda works? The temporary buffer and frame do end up closing, and the contents of the edited buffer do end up on the clipboard, when that is done---but it doesn't seem to paste it back into the other application (I tried with a google search field in chrome, plus in drafts). But hitting old-fashioned cmd-v to paste works just fine with the edited text.

@agzam
Copy link
Owner

agzam commented Feb 20, 2021

This should fix it: #79 I'll merge it soon. Sorry for the delay guys.

@paultopia
Copy link

Good news: I just successfully edited this in emacs using the changes in your commit!

@paultopia
Copy link

(Though it did generate one slightly odd consequence, namely, the size of the chrome window changed when focus went back to it. And even when I manually resized the chrome window, a weird yellow outline still floated over what the window was resized to. That outline actually persisted until I quit and restarted hammerspoon, even across other windows too.

Screen Shot 2021-02-20 at 3 13 58 PM

@agzam agzam closed this as completed in #79 Feb 20, 2021
@agzam
Copy link
Owner

agzam commented Feb 20, 2021

That yellow border is driven by this function: https://github.com/agzam/spacehammer/blob/master/windows.fnl#L77

Why it did not clear after Emacs frame got killed, I have no idea. Next time something like that happens, you can try pressing <Cmd+Ctrl+`> and see if there are any errors in the console.

@paultopia
Copy link

Thank you!

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 a pull request may close this issue.

3 participants