Refactor defuns-evil

This commit is contained in:
Henrik Lissner 2016-06-06 23:50:10 -04:00
parent 68430d944b
commit 7bcc3df3ca

View file

@ -193,20 +193,20 @@ monkey patch it to use pop-to-buffer."
(defun doom*evil-esc-quit () (defun doom*evil-esc-quit ()
"Close popups, disable search highlights and quit the minibuffer if open." "Close popups, disable search highlights and quit the minibuffer if open."
(let ((minib-p (minibuffer-window-active-p (minibuffer-window))) (let ((minib-p (minibuffer-window-active-p (minibuffer-window)))
(evil-hl-p (evil-ex-hl-active-p 'evil-ex-search))) (evil-hl-p (evil-ex-hl-active-p 'evil-ex-search)))
(when minib-p (abort-recursive-edit)) (when minib-p (abort-recursive-edit))
(when evil-hl-p (evil-ex-nohighlight)) (when evil-hl-p (evil-ex-nohighlight))
;; Close non-repl popups and clean up `doom-popup-windows' ;; Close non-repl popups and clean up `doom-popup-windows'
(unless (or minib-p evil-hl-p (bound-and-true-p doom-popup-mode)) (unless (or minib-p evil-hl-p (bound-and-true-p doom-popup-mode))
(doom/popup-close-all)))) (doom/popup-close-all))))
;;;###autoload ;;;###autoload
(defun doom*evil-ex-replace-special-filenames (file-name) (defun doom*evil-ex-replace-special-filenames (file-name)
"Replace special symbols in FILE-NAME." "Replace special symbols in FILE-NAME."
(let ((case-fold-search nil) (let ((regexp (concat "\\(?:^\\|[^\\\\]\\)"
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
"\\([#%@]\\)" "\\([#%@]\\)"
"\\(\\(?::\\(?:[phtreS~.]\\|g?s[^: $]+\\)\\)*\\)"))) "\\(\\(?::\\(?:[phtreS~.]\\|g?s[^: $]+\\)\\)*\\)"))
case-fold-search)
(dolist (match (s-match-strings-all regexp file-name)) (dolist (match (s-match-strings-all regexp file-name))
(let ((flags (split-string (caddr match) ":" t)) (let ((flags (split-string (caddr match) ":" t))
(path (file-relative-name (path (file-relative-name
@ -222,7 +222,8 @@ monkey patch it to use pop-to-buffer."
(when (string-suffix-p "\\" flag) (when (string-suffix-p "\\" flag)
(setq flag (concat flag (pop flags)))) (setq flag (concat flag (pop flags))))
(when (string-prefix-p "gs" flag) (when (string-prefix-p "gs" flag)
(setq global t flag (string-remove-prefix "g" flag))) (setq global t
flag (string-remove-prefix "g" flag)))
(setq path (setq path
(or (pcase (substring flag 0 1) (or (pcase (substring flag 0 1)
("p" (expand-file-name path)) ("p" (expand-file-name path))
@ -240,7 +241,7 @@ monkey patch it to use pop-to-buffer."
(evil-transform-vim-style-regexp replace) path t t (evil-transform-vim-style-regexp replace) path t t
(unless global 1)))) (unless global 1))))
("S" (shell-quote-argument path)) ("S" (shell-quote-argument path))
(t path)) (_ path))
""))) "")))
(setq file-name (setq file-name
(replace-regexp-in-string (format "\\(?:^\\|[^\\\\]\\)\\(%s\\)" (replace-regexp-in-string (format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"