This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-24
Channels
- # admin-announcements (1)
- # aleph (3)
- # announcements (4)
- # beginners (30)
- # boot (296)
- # cider (21)
- # cljsjs (2)
- # cljsrn (18)
- # clojure (124)
- # clojure-poland (23)
- # clojure-russia (4)
- # clojurescript (73)
- # core-async (58)
- # css (3)
- # datomic (31)
- # editors (4)
- # emacs (35)
- # euroclojure (3)
- # hoplon (104)
- # immutant (8)
- # jobs (3)
- # jobs-discuss (1)
- # keechma (1)
- # ldnclj (33)
- # leiningen (5)
- # liberator (1)
- # mount (20)
- # off-topic (2)
- # om (104)
- # onyx (54)
- # parinfer (80)
- # proton (1)
- # re-frame (59)
- # remote-jobs (1)
- # ring-swagger (9)
- # slack-help (15)
- # spacemacs (7)
- # yada (12)
When searching files with projectile, I get some results several times. https://infinit.io/_/uHRFe6P Has anyone the same problem as me ?
@lowl4tency: you shouldn’t use defconst
to change variables
bozhidar: hm, it's working better than default
dynamically tweaking indentation doesn’t seem reasonable to me, but as I said - I have no idea what you’re trying to do
Okay, let me describe, I'd like to change indentation level from default 4 to 2 spaces. In docs author suggests to change it via json-reformat, but when I change it, it doesn't work at all.
json-reformat:indent-width (integer)
Change indentation level (default 4)
if I set up next:
(defcustom json-reformat:indent-width 2
"How much indentation `json-reformat-region' should do at each level."
:type 'integer
:safe #'integerp
:group 'json-reformat)
I stil get 4 spaces of indentIf I set defconst it's working
bozhidar: thanks!
Actually, I've started read elisp reference, and now it's more clear for me
bozhidar: one more stupid q, when is appropriated to use defconst?
;;;###autoload
(setq js-indent-level 2)
(defun json-mode-beautify ()
"Beautify / pretty-print the active region (or the entire buffer if no active region)."
(interactive)
(let ((json-reformat:indent-width js-indent-level ))
(if (use-region-p)
(json-reformat-region (region-beginning) (region-end))
(json-reformat-region (buffer-end -1) (buffer-end 1)))))
(define-key json-mode-map (kbd "C-c C-f") 'json-mode-beautify)
Works!
@lowl4tency: when you have to define a constant, of course
js-indent-level is not const?
ah, okay
see https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Variables.html
bozhidar: thanks a lot, I guess I must read specs of elisp before asking )
I love emacs, it inspires me
totally agreed!