tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 103 forks source link

Request: scroll to top of alchemist-refcard by default #279

Open jmitchell opened 7 years ago

jmitchell commented 7 years ago

When I open the refcard now using C-c a h r the point is at the bottom, and it's not immediately obvious there's more content toward the top. It would be nice if the refcard opened scrolled to the top by default, at least when the buffer is first created.

This elisp expression does it when *alchemist-refcard* is already open.

(set-window-point (get-buffer-window alchemist-refcard--buffer-name) (point-min))
jmitchell commented 7 years ago

In case anyone else wants the same thing now, this works:

(define-key alchemist-mode-keymap (kbd "?")
  (lambda ()
    (interactive)
    (ignore-errors (alchemist-refcard))
    (set-window-point (get-buffer-window alchemist-refcard--buffer-name)
                      (point-min))))

The ignore-errors bit is necessary to overcome #278.

tonini commented 7 years ago

Hi Jacob

Thanks for the report, I'll have a look at it as soon I have some time.

Thanks

Jacob Mitchell notifications@github.com schrieb am Mo., 9. Jan. 2017, 01:09:

In case anyone else wants the same thing now, this works:

(define-key alchemist-mode-keymap (kbd "?") (lambda () (interactive) (ignore-errors (alchemist-refcard)) (set-window-point (get-buffer-window alchemist-refcard--buffer-name) (point-min))))

The ignore-errors bit is necessary to overcome #278 https://github.com/tonini/alchemist.el/issues/278.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tonini/alchemist.el/issues/279#issuecomment-271191469, or mute the thread https://github.com/notifications/unsubscribe-auth/AADYI5HfXEf4Z-8wY9hnZ4QuDUyrw2nrks5rQXqugaJpZM4Ld2A4 .