Emacs: setting doc-view-continuous doesn't work with modified key-bindings

549 views Asked by At

I work in Emacs with ergoemacs minor mode turned on. This minor mode changes C-n and C-p to M-k and M-i correspondingly.

In doc-view mode I can move up and down inside one page with M-i and M-k but when the end (beginning) of the page is reached the scrolling stops.

I have set doc-view-continuous variable to t. Here is the result:

  • continuous scrolling with M-k and M-i doesn't work if ergoemacs minor mode is turned on
  • continuous scrolling with C-n and C-p works if ergoemacs minor mode is turned off
  • next page C-x,] and previous page C-x,[ always work
  • continuous scrolling with mouse wheel always works

PS:
While writing this post I've found out the following:

  • in doc-view mode C-p is bound to doc-view-previous-line-or-previous-page function which behaves in different ways depending on doc-view-continuous
  • in doc-view mode + ergoemacs minor mode M-i is bound to image-previous-line function

This difference is the reason of the problem. I will try to use doc-view-mode-hook.

Edited:
Here is the startup code that works for ergoemacs mode:

;; adjust docview mode
(setq doc-view-continuous t)
(defun adjust-doc-view ()
  (ergoemacs-local-set-key (kbd "M-i")
    'doc-view-previous-line-or-previous-page)
  (ergoemacs-local-set-key (kbd "M-k")
    'doc-view-next-line-or-next-page)
)
(add-hook 'doc-view-mode-hook 'adjust-doc-view)

The thing I don't understand is why doc-view functions are bound to standard keys but are not bound to ergoemacs keys.

1

There are 1 answers

0
Drew On BEST ANSWER

Apparently doc view binds its commands explicitly to C-n and C-p. My guess would be that ergoemacs remaps the usual commands that are bound to those keys, to the keys M-k and M-i instead. Ergoemacs probably does not know about the doc-view commands in question.

Consider filing an enhancement request for ergoemacs, so that it provides a user option whose value is the list of commands to remap this way. That way, instead of doing what you do above, you can just customize the option.

For an example of code that defines such an option, you can refer Xah Lee (author of ergoemacs) to file icicles-opt.el, option icicle-top-level-key-bindings.