This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-14
Channels
- # beginners (33)
- # cider (17)
- # clara (13)
- # cljs-dev (7)
- # clojars (1)
- # clojure (47)
- # clojure-brasil (1)
- # clojure-dev (4)
- # clojure-italy (3)
- # clojure-russia (4)
- # clojure-uk (1)
- # clojurescript (4)
- # core-async (4)
- # core-logic (6)
- # cursive (7)
- # datomic (1)
- # emacs (35)
- # fulcro (56)
- # hoplon (7)
- # jobs-discuss (89)
- # lumo (6)
- # numerical-computing (1)
- # onyx (86)
- # parinfer (3)
- # reagent (2)
- # rum (2)
- # specter (5)
- # sql (13)
- # unrepl (2)
Given the following Clojure code:
(defn foo []
(let [...]
;; <---- Cursor is here, column 3
)
...if I press <down>, cursor would go from column 3 to column 0. I hate that, since current indentation level is at column 3. i.e I'm editing a let
; I don't expect to be removed from that level
so I tried hacked a next-line
replacement that executes indent-for-tab-command
right after native next-line
.
- modifies the buffer (by inserting whitespace), so the buffer will become 'unsaved' easily
I don't generally have those empty lines there, but normally I just keep on typing whatever I'm doing and once in a while press C-tab to indent whole buffer. I don't bother with individual line problems
I don't think we're talking about the same thing. I'm not talking about removing white lines. I'm talking about cursor column being moved to 0, even though its current 'semantic' level is nonzero
yes, I just told you that I have no such problem because I do not care about the indentation of incomplete code
ah gotchu, you just type misaligned code, given that it'll be reformatted. it's an approach 🙂 I wouldn't like that myself though
I used to have tab bound to indenting the whole buffer all the time but that was rather slow with big files
trying to achieve: simply coding in a way that is aligned at almost-all times, and that doesn't require me to constantly hit <tab>
enter indents the next line correctly, it is only the cursor movement down that moves to a blank line that moves the cursor to the last possible position
I don't leave that many, but 1 or 2 on certain cases. for example dense fns benefit from blank lines for delimiting logical chunks
I do that too but since emacs remembers the cursor position you can just keep scrolling up or down and it returns to the correct position after the blank line
You can press return
which is usually configured to create a properly indented new line. And in my setup if I were to press )
at the place you’ve indicated, it would close the let and eliminate all the unnecessary blank lines. I never bothered to check, but I would guess paredit
is taking care of that for me.
return
does that, but when you 'come back' with up
/`down`, trailing whitespace will have disappeared
note that I want, at the same time, to respect the convention of not leaving trailing whitespace (not that I like that convention; but gotta respect it)
surely there's a tension between both goals. I reckon that what I want is a 'virtual whitespace grid', by which having the cursor at column N does not necessarily mean that there are N space characters in that line
my understanding is that this is a limitation of emacs. it does not work on a grid system but on a list of characters that forms the buffer.