| 1 |
jet |
1.1 |
;;; kogiku.el - reading file and directory names with migemo service |
| 2 |
|
|
|
| 3 |
|
|
;; Copyright (C) 2004 Masatake YAMATO |
| 4 |
|
|
|
| 5 |
|
|
;; Author: Masatake YAMATO <jet@gyve.org> |
| 6 |
|
|
|
| 7 |
|
|
;; This file is free software; you can redistribute it and/or modify |
| 8 |
|
|
;; it under the terms of the GNU General Public License as published by |
| 9 |
|
|
;; the Free Software Foundation; either version 2, or (at your option) |
| 10 |
|
|
;; any later version. |
| 11 |
|
|
|
| 12 |
|
|
;; This file is distributed in the hope that it will be useful, |
| 13 |
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
|
;; GNU General Public License for more details. |
| 16 |
|
|
|
| 17 |
|
|
;; You should have received a copy of the GNU General Public License |
| 18 |
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to |
| 19 |
|
|
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 20 |
|
|
;; Boston, MA 02111-1307, USA. |
| 21 |
|
|
|
| 22 |
|
|
;;; Commentary: |
| 23 |
|
|
;; 日本語ファイル名の入力をmigemoを使って簡単にするプログラムです。 |
| 24 |
|
|
|
| 25 |
|
|
;; (今は使っていないのですが、)以前windowsでmeadowを使っていたときに、 |
| 26 |
|
|
;; 「デスクトップ(実際には半角)」にぶちまけてあるファイルをfind-fileし |
| 27 |
|
|
;; ようとすると(仮名漢字変換が必要なため)ファイル名の指定が非常に面倒で |
| 28 |
|
|
;; あると感じました。"desukutoxtupu"と打鍵してそれを「デスクトップ」へ変換 |
| 29 |
|
|
;; して[return]でやっと指定することができました。 |
| 30 |
|
|
|
| 31 |
|
|
;; 「デスクトップ」の指定をたとえば、"desktop"とか "de"[tab]とかで済めば |
| 32 |
|
|
;; すばらしいと思いませんか?migemoを使えばこれを実現することができそう |
| 33 |
|
|
;; です。"desktop"や"de"をmigemoで日本語に展開し、展開済みのパターンを |
| 34 |
|
|
;; 現在のディレクトリにある全てのファイルの名前と照合すれば、ファイル名 |
| 35 |
|
|
;; を指定("desktop"と「デスクトップ」の一致)したり、補完候補を生成 |
| 36 |
|
|
;; ("de"と「デスクトップ」の一致)したりすることができます。 |
| 37 |
|
|
|
| 38 |
|
|
;; kogiku.elはmigemo.el及びGNU Emacs 21に依存しています。migemo.elの |
| 39 |
|
|
;; 動作をまず確認して下さい。kogiku.elをロードパスが通って通っている |
| 40 |
|
|
;; ディレクトリに置き.emacsに (require 'kogiku)と書き加えてemacsを再 |
| 41 |
|
|
;; 起動します。migemoは http://migemo.namazu.rog から入手できます。 |
| 42 |
|
|
|
| 43 |
|
|
;;; Acknowledgments: |
| 44 |
|
|
|
| 45 |
shirai |
1.13 |
;; Some code used in `kogiku-file-name-completion' |
| 46 |
|
|
;; and `kogiku-try-completion-regexp' are copied from |
| 47 |
jet |
1.1 |
;; http://www.bookshelf.jp/cgi-bin/goto.cgi?file=meadow&node=kogiku |
| 48 |
|
|
;; (MeadowMemo maintained by Akihisa Matsushita <akihisa@mail.ne.jp>). |
| 49 |
|
|
|
| 50 |
|
|
;; `kogiku-read-file-name-internal' are |
| 51 |
shirai |
1.13 |
;; translated from emacs/src/fileio.c::read-file-name-internal |
| 52 |
jet |
1.1 |
;; in elisp. |
| 53 |
|
|
|
| 54 |
|
|
;;; Version: |
| 55 |
|
|
;; 2.0.2. |
| 56 |
|
|
|
| 57 |
|
|
;;; History: |
| 58 |
|
|
;; 2.0.2 |
| 59 |
|
|
;; -- inlucde shirai's patch |
| 60 |
|
|
;; -- introduce custom |
| 61 |
|
|
;; |
| 62 |
|
|
;; 2.0.1 -- update `Acknowledgments'. |
| 63 |
|
|
;; |
| 64 |
|
|
;; 2.0 -- rewrite. |
| 65 |
|
|
|
| 66 |
|
|
;;; Code: |
| 67 |
|
|
|
| 68 |
shirai |
1.13 |
(eval-when-compile |
| 69 |
jet |
1.1 |
(require 'cl) |
| 70 |
|
|
(require 'migemo)) |
| 71 |
|
|
|
| 72 |
|
|
(defgroup kogiku nil |
| 73 |
|
|
"reading file and directory name with migemo service" |
| 74 |
|
|
:group 'convenience) |
| 75 |
|
|
|
| 76 |
shirai |
1.11 |
(defcustom kogiku-minibuffer-prompt-string "kogiku" |
| 77 |
|
|
"*Kogiku indicator in minibuffer." |
| 78 |
|
|
:group 'kogiku |
| 79 |
|
|
:type 'string) |
| 80 |
|
|
|
| 81 |
jet |
1.12 |
(defcustom kogiku-enable-once nil |
| 82 |
|
|
"*If non-nil, kogiku effects a one time when call with a prefix argument. |
| 83 |
|
|
If nil, kogiku toggle with a prefix argument." |
| 84 |
|
|
:group 'kogiku |
| 85 |
|
|
:type 'boolean) |
| 86 |
jet |
1.1 |
|
| 87 |
shirai |
1.15 |
(defcustom kogiku-mode-change-key "\M-k" |
| 88 |
|
|
"*Key of change `kogiku-enable-once'." |
| 89 |
|
|
:group 'kogiku |
| 90 |
|
|
:type 'sexp) |
| 91 |
|
|
|
| 92 |
|
|
(defface kogiku-indicator-face |
| 93 |
|
|
'((((class color) (type tty)) (:foreground "blue" :bold t)) |
| 94 |
|
|
(((class color) (background light)) (:foreground "dark blue" :bold t)) |
| 95 |
|
|
(((class color) (background dark)) (:foreground "cyan" :bold t)) |
| 96 |
|
|
(t (:bold t))) |
| 97 |
|
|
"*Face of kogiku indicator." |
| 98 |
|
|
:group 'kogiku) |
| 99 |
|
|
|
| 100 |
|
|
(defface kogiku-change-face |
| 101 |
|
|
'((((class color) (type tty)) (:foreground "blue")) |
| 102 |
|
|
(((class color) (background light)) (:foreground "dark blue")) |
| 103 |
|
|
(((class color) (background dark)) (:foreground "cyan")) |
| 104 |
|
|
(t (:underline t))) |
| 105 |
|
|
"*Face of kogiku indicator." |
| 106 |
|
|
:group 'kogiku) |
| 107 |
|
|
|
| 108 |
|
|
(defvar kogiku-take-over-targets |
| 109 |
jet |
1.14 |
'(read-file-name-internal |
| 110 |
|
|
ffap-read-file-or-url-internal)) |
| 111 |
|
|
|
| 112 |
|
|
(defvar kogiku-original-functions nil) |
| 113 |
|
|
(defvar kogiku-original-completion-table nil) |
| 114 |
|
|
|
| 115 |
jet |
1.12 |
(defvar kogiku-completion-key "\t") |
| 116 |
shirai |
1.13 |
(defvar kogiku-minibuffer-prompt-overlay nil) |
| 117 |
shirai |
1.15 |
(defvar kogiku-mode-change-original-functions nil) |
| 118 |
jet |
1.1 |
|
| 119 |
jet |
1.12 |
(defun kogiku-complete (&optional arg) |
| 120 |
jet |
1.5 |
(interactive "P") |
| 121 |
jet |
1.12 |
(if kogiku-enable-once |
| 122 |
|
|
(kogiku-oneshot-complete arg) |
| 123 |
|
|
(kogiku-complete-with-toggle arg))) |
| 124 |
|
|
|
| 125 |
|
|
(defun kogiku-oneshot-complete (fire) |
| 126 |
|
|
(let ((minibuffer-completion-table minibuffer-completion-table)) |
| 127 |
|
|
(when fire |
| 128 |
|
|
(setq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
| 129 |
jet |
1.14 |
(funcall (car kogiku-original-functions)))) |
| 130 |
jet |
1.12 |
|
| 131 |
|
|
(defun kogiku-complete-with-toggle (switch) |
| 132 |
shirai |
1.17 |
(cond |
| 133 |
|
|
((and switch |
| 134 |
|
|
(eq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
| 135 |
|
|
(setq minibuffer-completion-table kogiku-original-completion-table)) |
| 136 |
|
|
(switch |
| 137 |
|
|
(setq minibuffer-completion-table 'kogiku-read-file-name-internal))) |
| 138 |
jet |
1.14 |
(funcall (car kogiku-original-functions)) |
| 139 |
shirai |
1.17 |
(kogiku-minibuffer-prompt)) |
| 140 |
shirai |
1.10 |
|
| 141 |
shirai |
1.17 |
(defun kogiku-minibuffer-prompt () |
| 142 |
|
|
(if (fboundp 'field-beginning) |
| 143 |
|
|
;; Emacs 21 |
| 144 |
|
|
(let ((prompt (buffer-substring (point-min) (field-beginning))) |
| 145 |
|
|
(props (text-properties-at (point-min))) |
| 146 |
shirai |
1.18 |
(indicator (format " [%s]" kogiku-minibuffer-prompt-string)) |
| 147 |
shirai |
1.17 |
(buffer-read-only nil) |
| 148 |
|
|
(inhibit-read-only t) |
| 149 |
|
|
replace) |
| 150 |
|
|
(save-excursion |
| 151 |
shirai |
1.16 |
(when (string-match (regexp-quote indicator) prompt) |
| 152 |
shirai |
1.17 |
(setq replace t) |
| 153 |
shirai |
1.13 |
(setq prompt (replace-match "" nil nil prompt)) |
| 154 |
shirai |
1.17 |
(set-text-properties 0 (length prompt) props prompt)) |
| 155 |
|
|
(when (and (eq minibuffer-completion-table |
| 156 |
|
|
'kogiku-read-file-name-internal) |
| 157 |
|
|
(string-match ":[^:]*" prompt)) |
| 158 |
|
|
(setq replace t) |
| 159 |
|
|
(set-text-properties 0 (length indicator) props indicator) |
| 160 |
|
|
(add-text-properties 0 (length indicator) |
| 161 |
|
|
'(face kogiku-indicator-face) indicator) |
| 162 |
|
|
(setq prompt (concat (substring prompt 0 (match-beginning 0)) |
| 163 |
|
|
indicator |
| 164 |
|
|
(substring prompt (match-beginning 0))))) |
| 165 |
|
|
(when replace |
| 166 |
shirai |
1.13 |
(delete-region (point-min) (field-beginning)) |
| 167 |
|
|
(goto-char (point-min)) |
| 168 |
shirai |
1.17 |
(insert prompt)))) |
| 169 |
|
|
;; Others |
| 170 |
shirai |
1.13 |
(if (eq minibuffer-completion-table 'kogiku-read-file-name-internal) |
| 171 |
|
|
(let ((max (min (point-max) (1+ (point-min))))) |
| 172 |
|
|
(if kogiku-minibuffer-prompt-overlay |
| 173 |
|
|
(move-overlay kogiku-minibuffer-prompt-overlay |
| 174 |
|
|
(point-min) max) |
| 175 |
|
|
(setq kogiku-minibuffer-prompt-overlay |
| 176 |
|
|
(make-overlay (point-min) max))) |
| 177 |
|
|
(overlay-put kogiku-minibuffer-prompt-overlay |
| 178 |
|
|
'before-string |
| 179 |
|
|
(format "%s: " kogiku-minibuffer-prompt-string)) |
| 180 |
|
|
(overlay-put kogiku-minibuffer-prompt-overlay 'evaporate t)) |
| 181 |
|
|
(when kogiku-minibuffer-prompt-overlay |
| 182 |
|
|
(delete-overlay kogiku-minibuffer-prompt-overlay))))) |
| 183 |
|
|
|
| 184 |
jet |
1.1 |
(if (fboundp 'compare-strings) |
| 185 |
|
|
(defalias 'kogiku-compare-strings 'compare-strings) |
| 186 |
|
|
(defun kogiku-compare-strings (string1 start1 end1 string2 start2 end2) |
| 187 |
|
|
"Convenience `compare-strings' for XEmacs." |
| 188 |
|
|
(let* ((str1 (substring string1 start1 end1)) |
| 189 |
|
|
(str2 (substring string2 start2 end2)) |
| 190 |
|
|
(len (min (length str1) (length str2))) |
| 191 |
|
|
(i 0)) |
| 192 |
|
|
(if (string= str1 str2) |
| 193 |
|
|
t |
| 194 |
|
|
(setq i (catch 'ignore |
| 195 |
|
|
(while (< i len) |
| 196 |
|
|
(when (not (eq (aref str1 i) (aref str2 i))) |
| 197 |
|
|
(throw 'ignore i)) |
| 198 |
|
|
(setq i (1+ i))) |
| 199 |
|
|
i)) |
| 200 |
|
|
(1+ i))))) |
| 201 |
|
|
|
| 202 |
|
|
(defun kogiku-try-completion-regexp (regexp all-list) |
| 203 |
shirai |
1.13 |
(if (= (length regexp) 0) |
| 204 |
jet |
1.1 |
"" |
| 205 |
|
|
(let (common) |
| 206 |
|
|
(setq common |
| 207 |
|
|
(substring |
| 208 |
shirai |
1.13 |
(car all-list) |
| 209 |
jet |
1.1 |
0 |
| 210 |
shirai |
1.13 |
(apply 'min |
| 211 |
jet |
1.1 |
(mapcar |
| 212 |
|
|
(lambda (a) |
| 213 |
shirai |
1.13 |
(apply 'min |
| 214 |
|
|
(mapcar |
| 215 |
jet |
1.1 |
(lambda (b) |
| 216 |
shirai |
1.13 |
(- (abs |
| 217 |
jet |
1.1 |
(kogiku-compare-strings a 0 nil |
| 218 |
|
|
b 0 nil)) |
| 219 |
|
|
1)) |
| 220 |
|
|
(delete a all-list)))) |
| 221 |
|
|
all-list)))) |
| 222 |
|
|
common))) |
| 223 |
|
|
|
| 224 |
|
|
(defun kogiku-migemo-get-pattern (string) |
| 225 |
shirai |
1.2 |
(let ((migemo-pattern-alist migemo-pattern-alist) |
| 226 |
|
|
(migemo-white-space-regexp " *")) |
| 227 |
jet |
1.1 |
(let ((case-fold-search nil)) |
| 228 |
|
|
(while (string-match "[^a-zA-Z]\\([a-z]+\\)" string) |
| 229 |
|
|
(setq string |
| 230 |
shirai |
1.7 |
(replace-match (capitalize (match-string 1 string)) nil nil string 1)))) |
| 231 |
jet |
1.1 |
(migemo-get-pattern string))) |
| 232 |
|
|
|
| 233 |
|
|
(defun kogiku-file-name-completion (string dir &optional all) |
| 234 |
|
|
(let* ((expanded-string (expand-file-name string dir)) |
| 235 |
|
|
(files (directory-files dir)) |
| 236 |
|
|
(pattern |
| 237 |
|
|
(if (string-match "/$" expanded-string) |
| 238 |
|
|
"" |
| 239 |
|
|
(concat "^\\(" |
| 240 |
|
|
(cond |
| 241 |
|
|
((string-match "\\cj$" string) |
| 242 |
|
|
string) |
| 243 |
shirai |
1.6 |
((string-match "^\\(\\(\\Cj*\\)?\\cj+\\)\\(\\Cj+\\)$" string) |
| 244 |
jet |
1.1 |
(concat (match-string 1 string) |
| 245 |
|
|
"\\(" |
| 246 |
shirai |
1.6 |
(kogiku-migemo-get-pattern (match-string 3 string)) |
| 247 |
jet |
1.1 |
"\\)")) |
| 248 |
|
|
(t |
| 249 |
|
|
(kogiku-migemo-get-pattern (file-name-nondirectory string)))) |
| 250 |
|
|
"\\)"))) |
| 251 |
jet |
1.3 |
(candidates (delete nil |
| 252 |
jet |
1.1 |
(mapcar |
| 253 |
|
|
(lambda (f) |
| 254 |
|
|
(if (string-match pattern f) |
| 255 |
|
|
(if (file-directory-p (expand-file-name f dir)) |
| 256 |
|
|
;; ディレクトリは / で終わるように |
| 257 |
|
|
(file-name-as-directory f) |
| 258 |
|
|
f))) |
| 259 |
|
|
files))) |
| 260 |
jet |
1.3 |
(count (length candidates)) |
| 261 |
jet |
1.1 |
common) |
| 262 |
|
|
(if all |
| 263 |
jet |
1.3 |
candidates |
| 264 |
jet |
1.1 |
(cond |
| 265 |
|
|
((eq count 0) nil) |
| 266 |
jet |
1.3 |
((eq count 1) (let ((candidate (car candidates))) |
| 267 |
jet |
1.1 |
(if (file-directory-p candidate) |
| 268 |
|
|
(file-name-as-directory candidate) |
| 269 |
|
|
candidate))) |
| 270 |
|
|
(t |
| 271 |
jet |
1.3 |
(if (null (delete nil (mapcar (lambda (candidate) |
| 272 |
|
|
(string-match "\\cj" candidate)) |
| 273 |
|
|
candidates))) |
| 274 |
|
|
;; 全ての候補が日本語を含んでいない場合、通常通り |
| 275 |
|
|
;; `try-completion' を呼んでまかせる。 |
| 276 |
shirai |
1.4 |
(try-completion string (mapcar 'list candidates)) |
| 277 |
jet |
1.3 |
(setq common (kogiku-try-completion-regexp pattern candidates)) |
| 278 |
|
|
(if (eq (length common) 0) string common))))))) |
| 279 |
jet |
1.1 |
|
| 280 |
|
|
(defun kogiku-file-name-all-completions (string dir) |
| 281 |
|
|
(kogiku-file-name-completion string dir t)) |
| 282 |
|
|
|
| 283 |
jet |
1.3 |
(defun kogiku-double-dollars (input) |
| 284 |
shirai |
1.8 |
(let ((ret "")) |
| 285 |
|
|
(while (string-match "\\$" input) |
| 286 |
|
|
(setq ret (concat ret |
| 287 |
|
|
(substring input 0 (match-beginning 0)) |
| 288 |
|
|
"$$")) |
| 289 |
|
|
(setq input (substring input (match-end 0)))) |
| 290 |
|
|
(concat ret input))) |
| 291 |
jet |
1.3 |
|
| 292 |
jet |
1.1 |
(defun kogiku-read-file-name-internal (string dir action) |
| 293 |
|
|
(block nil |
| 294 |
|
|
(unless (boundp 'read-file-name-predicate) |
| 295 |
|
|
(setq read-file-name-predicate nil)) |
| 296 |
|
|
(let ((realdir dir) |
| 297 |
|
|
(name string) |
| 298 |
|
|
(orig-string) |
| 299 |
|
|
(changed 0) |
| 300 |
|
|
(val) |
| 301 |
|
|
(specdir)) |
| 302 |
|
|
(if (eq 0 (length string)) |
| 303 |
|
|
(if (eq action 'lambda) |
| 304 |
|
|
(return nil)) |
| 305 |
|
|
(setq orig-string string) |
| 306 |
|
|
(setq string (substitute-in-file-name string)) |
| 307 |
|
|
(setq changed (null (string-equal string orig-string))) |
| 308 |
|
|
(setq name (file-name-nondirectory string)) |
| 309 |
|
|
(setq val (file-name-directory string)) |
| 310 |
|
|
(if (not (null val)) |
| 311 |
|
|
(setq realdir (expand-file-name val realdir)))) |
| 312 |
|
|
(cond |
| 313 |
|
|
((null action) |
| 314 |
|
|
(setq specdir (file-name-directory string)) |
| 315 |
|
|
(setq val (kogiku-file-name-completion name realdir)) |
| 316 |
|
|
(return (if (not (stringp val)) |
| 317 |
shirai |
1.13 |
(if changed |
| 318 |
jet |
1.3 |
(kogiku-double-dollars string) |
| 319 |
jet |
1.1 |
val) |
| 320 |
shirai |
1.13 |
(if (not (null specdir)) |
| 321 |
|
|
(setq val (concat specdir val))) |
| 322 |
|
|
(kogiku-double-dollars val)))) |
| 323 |
jet |
1.1 |
((eq action t) |
| 324 |
|
|
(let ((all (kogiku-file-name-all-completions name realdir))) |
| 325 |
|
|
(unless (or (null read-file-name-predicate) |
| 326 |
|
|
(eq read-file-name-predicate 'file-exists-p)) |
| 327 |
shirai |
1.13 |
(delete-if (lambda (x) |
| 328 |
jet |
1.1 |
(not (funcall read-file-name-predicate x)) |
| 329 |
|
|
all))) |
| 330 |
|
|
(return all))) |
| 331 |
|
|
((eq action 'lambda) |
| 332 |
|
|
(return (if read-file-name-predicate |
| 333 |
|
|
(funcall read-file-name-predicate string) |
| 334 |
|
|
(file-exists-p string)))))))) |
| 335 |
jet |
1.12 |
|
| 336 |
shirai |
1.15 |
(defun kogiku-mode-change () |
| 337 |
|
|
(interactive) |
| 338 |
|
|
(setq kogiku-enable-once (not kogiku-enable-once)) |
| 339 |
|
|
(when (and kogiku-enable-once |
| 340 |
|
|
(eq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
| 341 |
|
|
(setq minibuffer-completion-table 'read-file-name-internal)) |
| 342 |
|
|
(when (and (not kogiku-enable-once) |
| 343 |
|
|
(eq minibuffer-completion-table 'read-file-name-internal)) |
| 344 |
|
|
(setq minibuffer-completion-table 'kogiku-read-file-name-internal)) |
| 345 |
shirai |
1.17 |
(kogiku-minibuffer-prompt) |
| 346 |
shirai |
1.15 |
(let ((msg (format "[%s%s-mode]" |
| 347 |
|
|
(if kogiku-enable-once |
| 348 |
|
|
(concat kogiku-minibuffer-prompt-string " ") "") |
| 349 |
|
|
(if kogiku-enable-once "ONESHOT" "TOGGLE"))) |
| 350 |
|
|
(max (point-max)) |
| 351 |
|
|
(inhibit-quit t)) |
| 352 |
|
|
(put-text-property 0 (length msg) 'face 'kogiku-change-face msg) |
| 353 |
|
|
(save-excursion |
| 354 |
|
|
(goto-char max) |
| 355 |
|
|
(insert " " msg)) |
| 356 |
|
|
(sit-for 5) |
| 357 |
|
|
(save-excursion |
| 358 |
|
|
(delete-region max (point-max))))) |
| 359 |
|
|
|
| 360 |
jet |
1.12 |
(defun kogiku-install-key () |
| 361 |
shirai |
1.15 |
(when (memq minibuffer-completion-table kogiku-take-over-targets) |
| 362 |
jet |
1.14 |
(setq kogiku-original-completion-table minibuffer-completion-table) |
| 363 |
|
|
(push (lookup-key (current-local-map) kogiku-completion-key) |
| 364 |
|
|
kogiku-original-functions) |
| 365 |
shirai |
1.15 |
(define-key (current-local-map) kogiku-completion-key 'kogiku-complete) |
| 366 |
|
|
(push (lookup-key (current-local-map) kogiku-mode-change-key) |
| 367 |
|
|
kogiku-mode-change-original-functions) |
| 368 |
|
|
(define-key (current-local-map) kogiku-mode-change-key 'kogiku-mode-change))) |
| 369 |
shirai |
1.13 |
|
| 370 |
jet |
1.12 |
(add-hook 'minibuffer-setup-hook 'kogiku-install-key) |
| 371 |
|
|
|
| 372 |
|
|
(defun kogiku-uninstall-key () |
| 373 |
jet |
1.14 |
(when (and (or (eq minibuffer-completion-table 'kogiku-read-file-name-internal) |
| 374 |
|
|
(memq minibuffer-completion-table kogiku-take-over-targets)) |
| 375 |
jet |
1.12 |
(eq (lookup-key (current-local-map) kogiku-completion-key) |
| 376 |
shirai |
1.13 |
'kogiku-complete)) |
| 377 |
shirai |
1.15 |
(define-key (current-local-map) kogiku-completion-key (pop kogiku-original-functions)) |
| 378 |
|
|
(when (eq (lookup-key (current-local-map) kogiku-mode-change-key) |
| 379 |
|
|
'kogiku-mode-change) |
| 380 |
|
|
(define-key (current-local-map) kogiku-mode-change-key |
| 381 |
|
|
(pop kogiku-mode-change-original-functions))))) |
| 382 |
|
|
|
| 383 |
|
|
(add-hook 'minibuffer-exit-hook 'kogiku-uninstall-key) |
| 384 |
jet |
1.1 |
|
| 385 |
|
|
(provide 'kogiku) |
| 386 |
|
|
;; kogiku.el ends here |