| 84 |
:group 'kogiku |
:group 'kogiku |
| 85 |
:type 'boolean) |
:type 'boolean) |
| 86 |
|
|
| 87 |
(defvar kogiku-original-function nil) |
(defvar kogiku-take-over-targets |
| 88 |
|
'(read-file-name-internal |
| 89 |
|
ffap-read-file-or-url-internal)) |
| 90 |
|
|
| 91 |
|
(defvar kogiku-original-functions nil) |
| 92 |
|
(defvar kogiku-original-completion-table nil) |
| 93 |
|
|
| 94 |
(defvar kogiku-completion-key "\t") |
(defvar kogiku-completion-key "\t") |
| 95 |
(defvar kogiku-minibuffer-prompt-overlay nil) |
(defvar kogiku-minibuffer-prompt-overlay nil) |
| 96 |
|
|
| 104 |
(let ((minibuffer-completion-table minibuffer-completion-table)) |
(let ((minibuffer-completion-table minibuffer-completion-table)) |
| 105 |
(when fire |
(when fire |
| 106 |
(setq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
(setq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
| 107 |
(funcall kogiku-original-function))) |
(funcall (car kogiku-original-functions)))) |
| 108 |
|
|
| 109 |
(defun kogiku-complete-with-toggle (switch) |
(defun kogiku-complete-with-toggle (switch) |
| 110 |
(cond |
(when switch |
| 111 |
((and switch |
(cond |
| 112 |
(eq minibuffer-completion-table 'read-file-name-internal)) |
((eq minibuffer-completion-table 'kogiku-read-file-name-internal) |
| 113 |
(setq minibuffer-completion-table 'kogiku-read-file-name-internal) |
(setq minibuffer-completion-table kogiku-original-completion-table)) |
| 114 |
|
(t |
| 115 |
|
(setq minibuffer-completion-table 'kogiku-read-file-name-internal))) |
| 116 |
(kogiku-minibuffer-prompt-e21)) |
(kogiku-minibuffer-prompt-e21)) |
| 117 |
((and switch |
(funcall (car kogiku-original-functions)) |
|
(eq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
|
|
(setq minibuffer-completion-table 'read-file-name-internal) |
|
|
(kogiku-minibuffer-prompt-e21))) |
|
|
(funcall kogiku-original-function) |
|
| 118 |
(kogiku-minibuffer-prompt-not-e21)) |
(kogiku-minibuffer-prompt-not-e21)) |
| 119 |
|
|
| 120 |
(defun kogiku-minibuffer-prompt-e21 () |
(defun kogiku-minibuffer-prompt-e21 () |
| 310 |
(file-exists-p string)))))))) |
(file-exists-p string)))))))) |
| 311 |
|
|
| 312 |
(defun kogiku-install-key () |
(defun kogiku-install-key () |
| 313 |
(when (eq minibuffer-completion-table 'read-file-name-internal) |
(when (member minibuffer-completion-table kogiku-take-over-targets) |
| 314 |
(setq kogiku-original-function |
(setq kogiku-original-completion-table minibuffer-completion-table) |
| 315 |
(let ((tmp (lookup-key (current-local-map) kogiku-completion-key))) |
(push (lookup-key (current-local-map) kogiku-completion-key) |
| 316 |
(cond |
kogiku-original-functions) |
|
((null tmp) |
|
|
'minibuffer-complete) |
|
|
((eq tmp 'kogiku-complete) |
|
|
(and kogiku-original-function 'minibuffer-complete)) |
|
|
(t |
|
|
tmp)))) |
|
| 317 |
(define-key (current-local-map) kogiku-completion-key 'kogiku-complete))) |
(define-key (current-local-map) kogiku-completion-key 'kogiku-complete))) |
| 318 |
|
|
| 319 |
(add-hook 'minibuffer-setup-hook 'kogiku-install-key) |
(add-hook 'minibuffer-setup-hook 'kogiku-install-key) |
| 320 |
|
|
| 321 |
(defun kogiku-uninstall-key () |
(defun kogiku-uninstall-key () |
| 322 |
(when (and (memq minibuffer-completion-table |
(when (and (or (eq minibuffer-completion-table 'kogiku-read-file-name-internal) |
| 323 |
'(read-file-name-internal kogiku-read-file-name-internal)) |
(memq minibuffer-completion-table kogiku-take-over-targets)) |
| 324 |
(eq (lookup-key (current-local-map) kogiku-completion-key) |
(eq (lookup-key (current-local-map) kogiku-completion-key) |
| 325 |
'kogiku-complete)) |
'kogiku-complete)) |
| 326 |
(define-key (current-local-map) kogiku-completion-key kogiku-original-function))) |
(define-key (current-local-map) kogiku-completion-key (pop kogiku-original-functions)))) |
| 327 |
|
(add-hook 'minibuffer-exit-hook 'kogiku-uninstall-key) |
|
(add-hook 'minibuffer-exit-hook 'kogiku-uninstall-key) |
|
| 328 |
|
|
| 329 |
(provide 'kogiku) |
(provide 'kogiku) |
| 330 |
;; kogiku.el ends here |
;; kogiku.el ends here |