I'm trying to write my own backend for a certain tool language that has no repl. Hence, I thought it would be the best idea to parse the documentation and store it as a hash table (I'm open to other suggestions, I'm fairly new to Emacs). In general this works fine, the problems arise when the documentation is longer than a display. In this case, I would like to use scroll-other-window like anywhere else to scroll the documentation down, but it immediately jumps back to the top.
This is the basic structure of my backend:
(defconst my--constants (list "asdf" "bsdf" "csdf")) (defconst my--doc-buffer #s(hash-table size 3 test equal data("asdf" "Test." "bsdf" "Doing\nfine." "csdf" "T\nh\ni\ns\n \ni\ns\n \nw\nh\ne\nr\ne\n \ni\nt\n \ng\ne\nt\ns\n \nr\ne\na\nl\nl\ny\n \nm\ne\ns\ns\ny\n.\n \nE\nv\ne\nn\n \nw\ni\nt\nh\n \ns\nc\nr\no\nl\nl\n-\no\nt\nh\ne\nr\n-\nw\ni\nn\nd\no\nw\n \ni\nt\n \nj\nu\nm\np\ns\n \nb\na\nc\nk\n."))) (define-derived-mode my-mode prog-mode "My") (defun my-completion-at-point () (let ((bounds (bounds-of-thing-at-point 'word))) (when bounds (list (car bounds) (cdr bounds) my--constants :exclusive 'no :sorted (lambda (cand) t) :company-doc-buffer (lambda (cand) (company-doc-buffer (gethash cand my--doc-buffer))))))) (add-hook 'completion-at-point-functions 'my-completion-at-point)
company-show-doc-buffer is called upon
scroll-other-window won't do it's job properly. Instead it immediately jumps back to the head.
\n linebreaks the wrong approach? Am I missing something else? Unfortunately I couldn't find any other backends that use doc-buffers in an offline table. Is it actually the way to go, to use a company-doc-buffer, or is there a more generic thing available/recommended?