Refactor defuns-evil

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

View file

@ -203,10 +203,10 @@ monkey patch it to use pop-to-buffer."
;;;###autoload
(defun doom*evil-ex-replace-special-filenames (file-name)
"Replace special symbols in FILE-NAME."
(let ((case-fold-search nil)
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
(let ((regexp (concat "\\(?:^\\|[^\\\\]\\)"
"\\([#%@]\\)"
"\\(\\(?::\\(?:[phtreS~.]\\|g?s[^: $]+\\)\\)*\\)")))
"\\(\\(?::\\(?:[phtreS~.]\\|g?s[^: $]+\\)\\)*\\)"))
case-fold-search)
(dolist (match (s-match-strings-all regexp file-name))
(let ((flags (split-string (caddr match) ":" t))
(path (file-relative-name
@ -222,7 +222,8 @@ monkey patch it to use pop-to-buffer."
(when (string-suffix-p "\\" flag)
(setq flag (concat flag (pop flags))))
(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
(or (pcase (substring flag 0 1)
("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
(unless global 1))))
("S" (shell-quote-argument path))
(t path))
(_ path))
"")))
(setq file-name
(replace-regexp-in-string (format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"