@@ -225,6 +225,8 @@ Out-of-the box clojure-mode understands lein, boot and gradle."
225
225
(define-key map (kbd " i" ) #'clojure-cycle-if )
226
226
(define-key map (kbd " C-w" ) #'clojure-cycle-when )
227
227
(define-key map (kbd " w" ) #'clojure-cycle-when )
228
+ (define-key map (kbd " C-o" ) #'clojure-cycle-not )
229
+ (define-key map (kbd " o" ) #'clojure-cycle-not )
228
230
(define-key map (kbd " n i" ) #'clojure-insert-ns-form )
229
231
(define-key map (kbd " n h" ) #'clojure-insert-ns-form-at-point )
230
232
(define-key map (kbd " n u" ) #'clojure-update-ns )
@@ -249,6 +251,7 @@ Out-of-the box clojure-mode understands lein, boot and gradle."
249
251
[" Cycle privacy" clojure-cycle-privacy]
250
252
[" Cycle if, if-not" clojure-cycle-if]
251
253
[" Cycle when, when-not" clojure-cycle-when]
254
+ [" Cycle not" clojure-cycle-not]
252
255
(" ns forms"
253
256
[" Insert ns form at the top" clojure-insert-ns-form]
254
257
[" Insert ns form here" clojure-insert-ns-form-at-point]
@@ -2097,6 +2100,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-cycle-if"
2097
2100
(forward-sexp 2 )
2098
2101
(transpose-sexps 1 )))))
2099
2102
2103
+ ; ; TODO: Remove code duplication with `clojure--goto-if' .
2100
2104
(defun clojure--goto-when ()
2101
2105
" Find the first surrounding when or when-not expression."
2102
2106
(when (in-string-p )
@@ -2122,6 +2126,22 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-cycle-if"
2122
2126
(forward-char 5 )
2123
2127
(insert " -not" )))))
2124
2128
2129
+ (defun clojure-cycle-not ()
2130
+ " Add or remove a not form around the current form."
2131
+ (interactive )
2132
+ (save-excursion
2133
+ (condition-case nil
2134
+ (backward-up-list )
2135
+ (scan-error (user-error " `clojure-cycle-not' must be invoked inside a list" )))
2136
+ (if (looking-back " (not " )
2137
+ (progn
2138
+ (delete-char -5 )
2139
+ (forward-sexp )
2140
+ (delete-char 1 ))
2141
+ (insert " (not " )
2142
+ (forward-sexp )
2143
+ (insert " )" ))))
2144
+
2125
2145
; ;; let related stuff
2126
2146
2127
2147
(defvar clojure--let-regexp
0 commit comments