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

Cursor jumps around in Emacs #20

Open
lgastako opened this issue May 30, 2017 · 2 comments
Open

Cursor jumps around in Emacs #20

lgastako opened this issue May 30, 2017 · 2 comments
Labels

Comments

@lgastako
Copy link
Member

This is because with the current snippet from the README, the entire buffer gets replaced then the cursor gets moved back to the offset it was at within the file. When this operation takes place, the line that offset is on is centered in middle of the screen, so if your cursor was on any line but the one in the center of the screen you'll see things jump.

This could be mitigated by capturing the offset of the line from center and restoring that or perhaps there's some other value/idiom in Emacs/elisp for accomplishing the same goal.

Alternatively we could rig up a better, more general map-external-cmd-over-buffer type of functionality

@lgastako lgastako added the bug label May 31, 2017
@lgastako
Copy link
Member Author

This can be solved via something like:

  (defun longboyeee-off ())
  (defun longboyeee-on ()
    (interactive "r")
    (haskell-mode-buffer-apply-command "longboye-all.sh"))

  (defun longboyeee () (longboyeee-on))
  ;; (defun longboyeee () (longboyeee-off))

  (add-hook 'before-save-hook #'longboyeee)

where right now longboye-all.sh is just:

#!/bin/sh
longboye imports - | longboye pragmas -

but once longboye is fixed can be replaced with longboye all -.

We could make this easier by making longboye automatically behave as if you had specified longboye all - if the name of it is invoked as is longboye-all then you could just create the appropriate symlink to reference from emacs. (This is necessary because haskell-mode-buffer-apply-command seems to take an executable name only with no arguments).

@lgastako
Copy link
Member Author

I'm guessing the interactive "r" part is no longer necessary either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant