| 198 |
(t |
(t |
| 199 |
(kogiku-migemo-get-pattern (file-name-nondirectory string)))) |
(kogiku-migemo-get-pattern (file-name-nondirectory string)))) |
| 200 |
"\\)"))) |
"\\)"))) |
| 201 |
(candidate (delete nil |
(candidates (delete nil |
| 202 |
(mapcar |
(mapcar |
| 203 |
(lambda (f) |
(lambda (f) |
| 204 |
(if (string-match pattern f) |
(if (string-match pattern f) |
| 207 |
(file-name-as-directory f) |
(file-name-as-directory f) |
| 208 |
f))) |
f))) |
| 209 |
files))) |
files))) |
| 210 |
(count (length candidate)) |
(count (length candidates)) |
| 211 |
common) |
common) |
| 212 |
(if all |
(if all |
| 213 |
candidate |
candidates |
| 214 |
(cond |
(cond |
| 215 |
((eq count 0) nil) |
((eq count 0) nil) |
| 216 |
((eq count 1) (let ((candidate (car candidate))) |
((eq count 1) (let ((candidate (car candidates))) |
| 217 |
(if (file-directory-p candidate) |
(if (file-directory-p candidate) |
| 218 |
(file-name-as-directory candidate) |
(file-name-as-directory candidate) |
| 219 |
candidate))) |
candidate))) |
| 220 |
(t |
(t |
| 221 |
(setq common (kogiku-try-completion-regexp pattern candidate)) |
(if (null (delete nil (mapcar (lambda (candidate) |
| 222 |
(if (eq (length common) 0) string common)))))) |
(string-match "\\cj" candidate)) |
| 223 |
|
candidates))) |
| 224 |
|
;; 全ての候補が日本語を含んでいない場合、通常通り |
| 225 |
|
;; `try-completion' を呼んでまかせる。 |
| 226 |
|
(try-completion string candidates) |
| 227 |
|
(setq common (kogiku-try-completion-regexp pattern candidates)) |
| 228 |
|
(if (eq (length common) 0) string common))))))) |
| 229 |
|
|
| 230 |
(defun kogiku-file-name-all-completions (string dir) |
(defun kogiku-file-name-all-completions (string dir) |
| 231 |
(kogiku-file-name-completion string dir t)) |
(kogiku-file-name-completion string dir t)) |
| 232 |
|
|
| 233 |
|
(defun kogiku-double-dollars (input) |
| 234 |
|
(replace-regexp-in-string "\\$" "$$" input)) |
| 235 |
|
|
| 236 |
(defun kogiku-read-file-name-internal (string dir action) |
(defun kogiku-read-file-name-internal (string dir action) |
| 237 |
(block nil |
(block nil |
| 238 |
(unless (boundp 'read-file-name-predicate) |
(unless (boundp 'read-file-name-predicate) |
| 259 |
(setq val (kogiku-file-name-completion name realdir)) |
(setq val (kogiku-file-name-completion name realdir)) |
| 260 |
(return (if (not (stringp val)) |
(return (if (not (stringp val)) |
| 261 |
(if changed |
(if changed |
| 262 |
string ; TODO: double_dollars |
(kogiku-double-dollars string) |
| 263 |
val) |
val) |
| 264 |
(if (not (null specdir)) |
(if (not (null specdir)) |
| 265 |
(concat specdir val) |
(concat specdir val) |
| 266 |
val ; TODO: double_dollars |
(kogiku-double-dollars val) |
| 267 |
)))) |
)))) |
| 268 |
((eq action t) |
((eq action t) |
| 269 |
(let ((all (kogiku-file-name-all-completions name realdir))) |
(let ((all (kogiku-file-name-all-completions name realdir))) |