Fix evil ex fname modifiers consuming char just before #/%
':e test-%:t.el' in filename.el should open test-filename.el, but instead opened testfilename.el.
This commit is contained in:
parent
5d15521440
commit
1b779bf716
1 changed files with 5 additions and 5 deletions
|
@ -17,8 +17,8 @@ See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers for
|
||||||
more information on modifiers."
|
more information on modifiers."
|
||||||
(let* (case-fold-search
|
(let* (case-fold-search
|
||||||
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
|
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
|
||||||
"\\([#%]\\)"
|
"\\(\\([#%]\\)"
|
||||||
"\\(\\(?::\\(?:[PphtreS~.]\\|g?s[^:\t\n ]+\\)\\)*\\)"))
|
"\\(\\(?::\\(?:[PphtreS~.]\\|g?s[^:\t\n ]+\\)\\)*\\)\\)"))
|
||||||
(matches
|
(matches
|
||||||
(cl-loop with i = 0
|
(cl-loop with i = 0
|
||||||
while (and (< i (length file-name))
|
while (and (< i (length file-name))
|
||||||
|
@ -28,9 +28,9 @@ more information on modifiers."
|
||||||
(cl-loop for j to (/ (length (match-data)) 2)
|
(cl-loop for j to (/ (length (match-data)) 2)
|
||||||
collect (match-string j file-name)))))
|
collect (match-string j file-name)))))
|
||||||
(dolist (match matches)
|
(dolist (match matches)
|
||||||
(let ((flags (split-string (car (cdr (cdr match))) ":" t))
|
(let ((flags (split-string (cadddr match) ":" t))
|
||||||
(path (and buffer-file-name
|
(path (and buffer-file-name
|
||||||
(pcase (car (cdr match))
|
(pcase (caddr match)
|
||||||
("%" (file-relative-name buffer-file-name))
|
("%" (file-relative-name buffer-file-name))
|
||||||
("#" (save-excursion (other-window 1) (file-relative-name buffer-file-name))))))
|
("#" (save-excursion (other-window 1) (file-relative-name buffer-file-name))))))
|
||||||
flag global)
|
flag global)
|
||||||
|
@ -82,7 +82,7 @@ more information on modifiers."
|
||||||
(setq file-name
|
(setq file-name
|
||||||
(replace-regexp-in-string
|
(replace-regexp-in-string
|
||||||
(format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"
|
(format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"
|
||||||
(regexp-quote (string-trim-left (car match))))
|
(regexp-quote (cadr match)))
|
||||||
path file-name t t 1))))
|
path file-name t t 1))))
|
||||||
(replace-regexp-in-string regexp "\\1" file-name t)))
|
(replace-regexp-in-string regexp "\\1" file-name t)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue