small query: I have the following function composition used in my code in a few places:
(util/hiccup-response
(util/wrap-page ...)) ;; Not always on two lines
I created a single function that does this because I realized these are always used together (at least until now). Let's say : util/hiccup-page
Is there a way to refactor these expressions than searching for all occurrences and replacing manually?If it was on one line then helm-ag could be used to edit the search results and apply changes across the project.
e.g SPC / to search across the project, C-c C-e to edit the list of search results, make changes (optionally using iedit or multiple cursors), save changes to apply them across the project
I vaguely remember an option to show more than one line in search results, but don't remember trying that with helm-ag
Quick q (cursor indicated with |:
In the following:
{:get {:handler | main}
:name ::main}
If I press D now, it becomes this:
{:get {:handler
:name ::main}
But the same action if done in the second line, preserves the curly brackets. Any idea?I didn't find anything obvious from the use of evil-cleverparens in the Spacemacs configuration. These seem edge cases to me anyway as I replace the value in the hash map rather than use line-delete with a value from a key value pair, as logically deleting only the value unbalances the semantics of the hash-maps itself. If I do stumble across something, I'll share.
Sounds like paredit is working for the second D press. but evil-cleverparens is not enabled to prevent the } being deleted from the first D press.
Add the following to the Spacemacs user config in dotspacemacs/user-config section
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)More details at https://practical.li/spacemacs/structural-editing/cleverparens/
Doesn't work. I toggled evil-cleverparens-mode manually and tried with the same result.
@dumrat I maintain evil-cleverparens so would be interested in a repro if you have one. With just what you've shared above and using just evil & evil-cleverparens, no unbalanced parens appear, so I'm guessing it's something to do with spacemacs. But if you find something specific to evil-cleverparens I'd be keen to fix 🙏
Let me try to figure out. I'll update with what I can find
It does seem hash-maps become unbalanced, either a flat hash-map or nested hash-map.
D correctly keeps balance when the hash-map is surrounded by a different type of parens, eg. list or vector. Unbalanced when no other surrounding strucutrure exept for anothe rhash-map
;; D deletes closing paren on first line - unbalanced, although dd does work as expected
{:get {:handler :get-clojure}
:name ::main}
;; deletes closing paren - unbalanced
{:get :clojure}
;; delete anywhere in hash-map keeps balance
[{:get :clojure}]
;; delete anywhere leaves unbalanced
{:get {:closure {:with ::clojure}}}
;; delete within hash-map keeps parens balanced
(clojure.pprint/pprint {:get :clojure})
;; delete within hash-map keeps parens balanced
(def data-analysis
[{:get :clojure}])
;; delete in vector keeps parens balanced
[:get :clojure]
;; delete in hash-map keeps parens balanced
[:get {:clojure :repl}]@jr0cket all of the above work for me with just evil & evil-cleverparens. Sorry for being a non-spacemacs user in #spacemacs - I keep an eye for evil stuff. So if you can repro without spacemacs, or can figure out the spacemacs cause, if there's anything evil-cleverparens can do to help, I'll take a look.