This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-06
Channels
- # beginners (95)
- # boot (3)
- # cider (13)
- # cljs-dev (9)
- # cljsjs (1)
- # cljsrn (35)
- # clojure (78)
- # clojure-dev (5)
- # clojure-italy (6)
- # clojure-nl (9)
- # clojure-russia (13)
- # clojure-spec (1)
- # clojure-uk (74)
- # clojurescript (59)
- # community-development (6)
- # core-async (41)
- # css (110)
- # data-science (2)
- # datomic (22)
- # defnpodcast (1)
- # devcards (1)
- # docs (1)
- # editors (6)
- # emacs (51)
- # figwheel (1)
- # fulcro (66)
- # jobs (1)
- # jobs-discuss (75)
- # lumo (51)
- # mount (2)
- # off-topic (33)
- # pedestal (24)
- # proton (3)
- # re-frame (29)
- # reagent (92)
- # reitit (16)
- # shadow-cljs (16)
- # spacemacs (4)
- # specter (6)
- # vim (6)
- # yada (7)
@jeff.terrell it is eval-print-last-sexp
standard emacs binding <C-j> in lisp-interaction-mode
Thanks for sharing cider-scratch
. I'm using the elisp scratch buffer all the time, but having a scratch buffer in Clojure around will be so much sweeter!
Is there a way to get emacs to consider the starting colon in a :keyword
to be the start of word when navigating by words?
And I guess it is possible to redefine what "word" is in emacs using syntax-tables as described in https://www.emacswiki.org/emacs/EmacsSyntaxTable
then in the same buffer try to backward/forward word in (hello :world)
expression -- for me it stops exactly at colon when I do backward-word having cursor on the last paren
Next thing, if the behavior suits you, add modify-syntax-entry to your init.el as add-hook
for desired mode (clojure-mode I presume)
@habamax (modify-syntax-entry ?: "w")
works, but my attempt to add-hook it to clojure-mode is the following, which doesn't seem to do anything:
(defun use-colon-as-word-start ()
(modify-syntax-entry ?: "w"))
(add-hook 'clojure-mode 'use-colon-as-word-start)
try this:
(defun use-colon-as-word-start ()
(let ((table (make-syntax-table)))
(modify-syntax-entry ?: "w" table)
(set-syntax-table table)))
(add-hook 'clojure-mode-hook 'use-colon-as-word-start)
or better:
(defun use-colon-as-word-start ()
(let ((table (make-syntax-table clojure-mode-syntax-table)))
(modify-syntax-entry ?: "w" table)
(set-syntax-table table)))
(add-hook 'clojure-mode-hook 'use-colon-as-word-start)
Here you're modifying existing clojure-mode-syntax-table
which is better than barebone default standard-syntax-table
do you need to restart emacs? I'm just evaling my init.el, re-opening the clojure file and using M-f and M-b to navigate words.
I have the following in my init.el:
(use-package clojure-mode
:mode ("\\.\\(clj\\)$" . clojure-mode)
:config
(defun use-colon-as-word-start ()
(let ((table (make-syntax-table clojure-mode-syntax-table)))
(modify-syntax-entry ?: "w" table)
(set-syntax-table table)))
(add-hook 'clojure-mode-hook 'use-colon-as-word-start)
(use-package cider
:config
(setq cider-repl-display-help-banner t)
(setq cider-repl-use-pretty-printing t)))
looks like i am not explicitly referring to clojure mode anywhere in my init.el. must be happening implicitly with (require-package 'cider)
You do have clojure-mode
as major mode for emacs when you open any clj
file, don't you?
(er/add-clojure-mode-expansions clojure--check-wrong-major-mode hl-sexp-mode rainbow-delimiters-mode paredit-mode)
i added the hook to my init.el and evaled that file as I normally do when i'm playing with my config
note above, a few minutes i showed what I'm putting in my init.el which is (add-hook 'clojure-mode 'use-colon-as-word-start)
but it should be clojure-mode-hook
Not sure how many of you use evil mode. But I always thought it was annoying commands like <number> <motion key>
didn't by default register with evil jump, so you couldn't <Ctrl>-O/I
to locations navigated with it.
Well turns out there's a config for that.
(evil-define-command digit-argument :keep-visual t :repeat nil :jump t)
adding :jump t to any of the commands listed in evil-command-properties
var allows them to register with evil-jump
quite a few of them already have the jump command, but this allows you to add more. I use relative line numbering so I use the the number motion more than I use go to line commands