alhassy/org-special-block-extras

default keymap overrides frequently used org-mode shortcuts: `C-n`, `C-p`and `C-h`

benisjammin opened this issue · 2 comments

The default keymap built into o-deflink overrides C-n, C-p and C-h, the former two of which greatly degrade navigation when I'm not trying to skip to the next link type (which is most of the time). I frequently find myself miles away from the desired line in a document when trying to move up or down a single line or a handful of lines with C-n or C-p.

  1. Is there a way to configure this keymap with a few lines (something like the below)?
  2. I'd like to suggest that the defaults be moved to something which does not override C-n, C-p and C-h, given that they get in the way.

The following code is just an example of what it could look like for someone who wanted to use the current key-chords. I would probably change them to C-c C-b and C-c C-p for my own usage. I haven't tried to get this working yet as I don't really know where to start or how to go about doing so.

(define-key org-special-block-extras-mode-map (kbd "C-n") 'o-this-link-next) 
;; where `o-this-link-next` does the same as `(lambda nil (interactive) (re-search-forward "link-value:" nil t))`
(define-key org-special-block-extras-mode-map (kbd "C-p") 'o-this-link-previous) 
;; where `o-this-link-previous` does the same as `(lambda nil (interactive) (re-search-backward "link-value:" nil t))`
(define-key org-special-block-extras-mode-map (kbd "C-h") 'org-special-block-extras-show-docs)
;; or with the `keydef` package
(keydef (org-special-block-extras "C-n") o-this-link-next)
(keydef (org-special-block-extras "C-p") o-this-link-previous)
(keydef (org-special-block-extras "C-h") o-show-docs)

Has anyone else found a better way around this? The functionality could be useful bound diferently, but since I make much more use of C-n, C-p and C-h than the arrow keys or <f1> k it really just gets in the way most of the time.

An additional gripe with the current version of C-h is that it opens in a dedicated, read-writeable buffer, so that a quick C-x o q switches to that buffer and inserts a q rather than calling quit-window:

'C-h `(-let [max-mini-window-height 0] ;; i.e., insist on displaying in a dedicated buffer
                                           (display-message-or-buffer ,msg))

Again, I'm not sure how to fix this and I don't have the time to spend on it just now, but I figured it'd be worth mentioning alongside the above.

This will be fixed by the referenced commit, thanks!

@benisjammin Your issue description really contained useful suggestions, which I merely implemented.

Thank you for doing the hard work 😁