Develop and Download Open Source Software

Browse CVS Repository

Diff of /kogiku/kogiku/kogiku.el

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13 by shirai, Tue Feb 10 05:26:29 2004 UTC revision 1.14 by jet, Tue Feb 10 07:30:55 2004 UTC
# Line 84  If nil, kogiku toggle with a prefix argu Line 84  If nil, kogiku toggle with a prefix argu
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    
# Line 98  If nil, kogiku toggle with a prefix argu Line 104  If nil, kogiku toggle with a prefix argu
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 ()
# Line 306  If nil, kogiku toggle with a prefix argu Line 310  If nil, kogiku toggle with a prefix argu
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

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26