(defun paredit-kill+ ()
"It's annoying that we need re-indent line after we delete blank line with `paredit-kill'.
`paredt-kill+' fixed this problem.
If current mode is `web-mode', use `paredit-web-mode-kill' instead `paredit-kill' for smarter kill operation."
(interactive)
(cond ((eq major-mode 'web-mode)
(paredit-web-mode-kill))
((eq major-mode 'ruby-mode)
(paredit-ruby-mode-kill))
(t
(paredit-common-mode-kill))))
(defun paredit-common-mode-kill ()
(interactive)
(if (paredit-blank-line-p)
(paredit-kill-blank-line-and-reindent)
(paredit-kill)))
(defun paredit-web-mode-kill ()
"It's a smarter kill function for `web-mode'.
If current line is blank line, re-indent line after kill whole line.
If point in string area, kill string content like `paredit-kill' do.
If point in tag area, kill nearest tag attribute around point.
Otherwise, do `paredit-kill'."
(interactive)
(if (paredit-blank-line-p)
(paredit-kill-blank-line-and-reindent)
(cond ((paredit-in-string-p)
(paredit-kill))
(t
(let (char-count-before-kill
char-count-after-kill)
(setq char-count-before-kill (- (point-max) (point-min)))
(web-mode-attribute-kill)
(setq char-count-after-kill (- (point-max) (point-min)))
(when (equal char-count-before-kill char-count-after-kill)
(paredit-kill))
)))))
(defun paredit-ruby-mode-kill ()
"It's a smarter kill function for `ruby-mode'.
If current line is blank line, re-indent line after kill whole line.
If point in string area, kill string content like `paredit-kill' do.
If point at block beginning, kill whole block.
If point at block end, kill rest line after end block.
Otherwise, do `paredit-kill'.
"
(interactive)
(if (paredit-blank-line-p)
(paredit-kill-blank-line-and-reindent)
(let (in-beginning-block-p in-end-block-p block-start-pos block-end-pos)
(save-excursion
(setq current-symbol (buffer-substring-no-properties (beginning-of-thing 'symbol) (end-of-thing 'symbol)))
(setq in-beginning-block-p (member current-symbol '("class" "module" "def" "if" "unless" "case" "while" "until" "for" "begin" "do")))
(setq in-end-block-p (member current-symbol '("end")))
)
(cond ((paredit-in-string-p)
(paredit-kill))
(in-beginning-block-p
(beginning-of-thing 'symbol)
(setq block-start-pos (point))
(forward-sexp 1)
(setq block-end-pos (point))
(kill-region block-start-pos block-end-pos))
(in-end-block-p
(beginning-of-thing 'symbol)
(save-excursion
(kill-line)))
(t
(paredit-kill))))))
(file-missing "Cannot open load file" "No such file or directory" "mwe-log-commands")
require(mwe-log-commands)
eval-buffer(#<buffer *load*-822461> nil "/Users/***/.spacemacs.d/extensions/lazycat-toolkit.el" nil t) ; Reading at buffer position 2367