Fork me on GitHub
#emacs
<
2017-02-21
>
qqq00:02:58

In emacs, I want to autocomplete

:new-vec2 ==> (q :vec2 :x :y)
:new-bbox ==> (q :bbox :x1 :x2 :y1 :y2)
:new-student ==> (q :student :name :age :gender)
this is a bit problematic because the thing I type ":new-vec2" is NOT a prefix of the completion string "(q :vec2 :x :y)" Thus, what package can I use to make this work?

benedek08:02:04

yasnippet?

benedek08:02:42

you are talking about custom templates I suppose

qqq08:02:58

does emacs itself provide a filter cmd? I did C-h filter, but the result at top is -filter // from dash.el -- is there no emacs builtin 'filter' ?

qqq10:02:24

in elisp, how do I convert vector to list?

thegeez11:02:03

I have (global-set-key (kbd "C-c r") 'cider-repl-reset) in my init.el, but everytime I start up emacs the keycombo "C-c r" is bound to revert file instead. After I eval the global-set-key everything is fine again. Is there a way to make this work on startup?

qqq11:02:08

@thegeez: easier solution may be to bind C-c r in clojure mode, since I believe local mode has precedence over global mode

thegeez11:02:50

@qqq does that require a different set-key command or put the line in a clojure-mode.el or something like that?

qqq12:02:10

@thegeez: I have something like the following:

(defun my-clojure-setup ()
...
(define-key clojure-mode-map (kbd "C-x C-e") 'lisp-eval-last-sexp))

(add-hook 'clojure-mode-hook #'my-clojure-setup))

thegeez12:02:40

@qqq great thanks, that works!

qqq12:02:58

(eq :tuple (read-from-string ":tuple"))
> nil
^^ wtf -- how do I fix this?

mgrbyte12:02:32

@qqq (eq :tuple (first (read-from-string ":tuple"))) works here

qqq12:02:15

@mgrbyte: yeah, my mistake was failing to realize read-from-string returns a cons cell of ( actual content . offset ), thus the need for the first/car, which I missed; thanks!

cmack13:02:04

@qqq re: emacs built-in filter, there is cl-remove-if and cl-remove-if-not

eggsyntax20:02:57

Warning for CIDER users who use cider-jack-in-clojurescript and define cider-cljs-lein-repl in a .dir-locals.el file: I just spent way too long beating my head against this bug: https://github.com/clojure-emacs/cider/issues/1938 For now, you can move cider-cljs-lein-repl into your personal config, or call it at runtime, or manually apply the patch.

eggsyntax20:02:59

(or wait until the fix is merged before updating CIDER)