Fork me on GitHub
#cider
<
2022-04-14
>
Jim Newton13:04:03

Can I keep cider from hijacking my C-u and C-p keys? as I’m typing I want C-f, C-u, C-p, and C-n to always move the cursor forward, up, back and down. However, sometimes it annoyingly popups completion menus which hijack normal cursor operation. If I’m not looking at the screen, or if I’m typing very fast the navigation keys start moving around in the popup rather than in the text. This is bad.

Benjamin14:04:21

You can check out the configuration for company . You could for instance get rid of it auto popping and bind company-manual-begin to a key

Jim Newton06:04:14

how can I configure company?

Jim Newton06:04:06

I see the following in company.el

(defvar company-active-map
  (let ((keymap (make-sparse-keymap)))
    (define-key keymap "\e\e\e" 'company-abort)
    (define-key keymap "\C-g" 'company-abort)
    (define-key keymap (kbd "M-n") 'company--select-next-and-warn)
    (define-key keymap (kbd "M-p") 'company--select-previous-and-warn)
    (define-key keymap (kbd "C-n") 'company-select-next-or-abort)
    (define-key keymap (kbd "C-p") 'company-select-previous-or-abort)
    (define-key keymap (kbd "<down>") 'company-select-next-or-abort)
    (define-key keymap (kbd "<up>") 'company-select-previous-or-abort)
    (define-key keymap [remap scroll-up-command] 'company-next-page)
    (define-key keymap [remap scroll-down-command] 'company-previous-page)
    (define-key keymap [down-mouse-1] 'ignore)
    (define-key keymap [down-mouse-3] 'ignore)
    (define-key keymap [mouse-1] 'company-complete-mouse)
    (define-key keymap [mouse-3] 'company-select-mouse)
    (define-key keymap [up-mouse-1] 'ignore)
    (define-key keymap [up-mouse-3] 'ignore)
    (define-key keymap [return] 'company-complete-selection)
    (define-key keymap (kbd "RET") 'company-complete-selection)
    (define-key keymap [tab] 'company-complete-common)
    (define-key keymap (kbd "TAB") 'company-complete-common)
    (define-key keymap (kbd "<f1>") 'company-show-doc-buffer)
    (define-key keymap (kbd "C-h") 'company-show-doc-buffer)
    (define-key keymap "\C-w" 'company-show-location)
    (define-key keymap "\C-s" 'company-search-candidates)
    (define-key keymap "\C-\M-s" 'company-filter-candidates)
    (company-keymap--bind-quick-access keymap)
     keymap)
  "Keymap that is enabled during an active completion.")

Jim Newton06:04:29

it looks like C-n and C-p are explicitly hijacked.

Jim Newton06:04:38

I’m not really up on emacs scoping rules. Is there a way for me to remove something from this keymap after it has been loaded?

Benjamin07:04:50

(define-key the-map (kbd "C-n") nil) yea like this

Benjamin07:04:51

check the other custom variables in company. There is a few like 'auto-delay' etc.

Jim Newton13:04:46

BTW what is cider trying to tell me with this popup anyway? it does not look like useful information. is it a cider bug?

Jim Newton13:04:04

I have to press ESC 3 times to make it go away.

genmeblog13:04:08

Question about sayid. > If you use CIDER's jack-in commands, then Sayid automatically adds the Maven dependency when starting a REPL. This means you don't need to manually add the dependency to your project.clj or deps.edn file. Above is true for project.clj but not for deps.edn

genmeblog13:04:32

[nREPL] Starting server via /usr/local/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0"} cider/cider-nrepl {:mvn/version "0.28.3"} com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.3.0"} refactor-nrepl/refactor-nrepl {:mvn/version "3.5.2"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,com.billpiel.sayid.nrepl-middleware/wrap-sayid,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Execution error (FileNotFoundException) at nrepl.cmdline/require-and-resolve (cmdline.clj:201).
Could not locate com/billpiel/sayid/nrepl_middleware__init.class, com/billpiel/sayid/nrepl_middleware.clj or com/billpiel/sayid/nrepl_middleware.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

dpsutton13:04:19

good catch. seems like its not injecting the actual dep, just the middleware it expects to be present

bozhidar05:04:22

Yeah, that's the problem. Adding the dependency manually in your CIDER settings should fix this.

bozhidar05:04:06

I'll fix this at some point, but I won't mind if someone beats me to it.