changes
[emacs.git] / .emacs.d / elisp / icicle / icicles-mode.el
1 ;;; icicles-mode.el --- Icicle Mode definition for Icicles
2 ;;
3 ;; Filename: icicles-mode.el
4 ;; Description: Icicle Mode definition for Icicles
5 ;; Author: Drew Adams
6 ;; Maintainer: Drew Adams
7 ;; Copyright (C) 1996-2013, Drew Adams, all rights reserved.
8 ;; Created: Mon Feb 27 10:21:10 2006
9 ;; Version: 22.0
10 ;; Last-Updated: Thu Feb 28 10:39:15 2013 (-0800)
11 ;; By: dradams
12 ;; Update #: 9486
13 ;; URL: http://www.emacswiki.org/icicles-mode.el
14 ;; Doc URL: http://www.emacswiki.org/Icicles
15 ;; Keywords: internal, extensions, help, abbrev, local, minibuffer,
16 ;; keys, apropos, completion, matching, regexp, command
17 ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x
18 ;;
19 ;; Features that might be required by this library:
20 ;;
21 ;; `advice', `advice-preload', `apropos', `apropos+',
22 ;; `apropos-fn+var', `avoid', `bookmark', `bookmark+',
23 ;; `bookmark+-1', `bookmark+-bmu', `bookmark+-key',
24 ;; `bookmark+-lit', `cl', `cus-edit', `cus-face', `cus-load',
25 ;; `cus-start', `dired', `dired+', `dired-aux', `dired-x',
26 ;; `doremi', `easymenu', `el-swank-fuzzy', `ffap', `ffap-',
27 ;; `fit-frame', `frame-cmds', `frame-fns', `fuzzy', `fuzzy-match',
28 ;; `help+20', `hexrgb', `icicles-cmd1', `icicles-cmd2',
29 ;; `icicles-fn', `icicles-mcmd', `icicles-opt', `icicles-var',
30 ;; `image-dired', `info', `info+', `kmacro', `levenshtein',
31 ;; `menu-bar', `menu-bar+', `misc-cmds', `misc-fns', `mouse3',
32 ;; `mwheel', `naked', `pp', `pp+', `regexp-opt', `ring', `ring+',
33 ;; `second-sel', `strings', `subr-21', `thingatpt', `thingatpt+',
34 ;; `unaccent', `w32-browser', `w32browser-dlgopen', `wid-edit',
35 ;; `wid-edit+', `widget'.
36 ;;
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 ;;
39 ;;; Commentary:
40 ;;
41 ;; This is a helper library for library `icicles.el'. It defines the
42 ;; command `icicle-mode'. For Icicles documentation, see
43 ;; `icicles-doc1.el' and `icicles-doc2.el'.
44 ;;
45 ;; Commands defined here:
46 ;;
47 ;; `icicle-handle-switch-frame', `icicle-mode', `icy-mode',
48 ;; `icicle-ORIG-bbdb-complete-mail',
49 ;; `icicle-ORIG-bbdb-complete-name',
50 ;; `icicle-ORIG-comint-dynamic-complete',
51 ;; `icicle-ORIG-comint-dynamic-complete-filename',
52 ;; `icicle-ORIG-comint-replace-by-expanded-filename',
53 ;; `icicle-ORIG-dired-read-shell-command',
54 ;; `icicle-ORIG-ess-complete-object-name',
55 ;; `icicle-ORIG-gud-gdb-complete-command',
56 ;; `icicle-ORIG-read-file-name', `icicle-ORIG-read-shell-command',
57 ;; `icicle-skip-this-command'.
58 ;;
59 ;; Non-interactive functions defined here:
60 ;;
61 ;; `icicle-activate-mark', `icicle-add-menu-item-to-cmd-history',
62 ;; `icicle-bind-completion-keys',
63 ;; `icicle-bind-custom-minibuffer-keys',
64 ;; `icicle-bind-isearch-keys',
65 ;; `icicle-bind-key-completion-keys-for-map-var',
66 ;; `icicle-bind-key-completion-keys-in-keymaps-from',
67 ;; `icicle-bind-other-keymap-keys',
68 ;; `icicle-cancel-Help-redirection', `icicle-define-cycling-keys',
69 ;; `icicle-define-icicle-maps', `icicle-define-minibuffer-maps',
70 ;; `icicle-minibuffer-setup', `icicle-rebind-global',
71 ;; `icicle-redefine-standard-functions',
72 ;; `icicle-redefine-standard-options',
73 ;; `icicle-redefine-std-completion-fns',
74 ;; `icicle-restore-completion-keys',
75 ;; `icicle-restore-custom-minibuffer-keys',
76 ;; `icicle-restore-other-keymap-keys',
77 ;; `icicle-restore-region-face',
78 ;; `icicle-restore-standard-functions',
79 ;; `icicle-restore-standard-options',
80 ;; `icicle-restore-std-completion-fns',
81 ;; `icicle-run-icicle-post-command-hook',
82 ;; `icicle-run-icicle-pre-command-hook',
83 ;; `icicle-select-minibuffer-contents', `icicle-set-calling-cmd',
84 ;; `icicle-show-current-help-in-mode-line',
85 ;; `icicle-S-iso-lefttab-to-S-TAB', `icicle-top-level-prep',
86 ;; `icicle-unbind-isearch-keys',
87 ;; `icicle-unbind-key-completion-keys-for-map-var',
88 ;; `icicle-unbind-key-completion-keys-in-keymaps-from',
89 ;; `icicle-undo-std-completion-faces', `icicle-unmap',
90 ;; `icicle-update-ignored-extensions-regexp'.
91 ;;
92 ;; User options defined here (in Custom group `Icicles'):
93 ;;
94 ;; `icicle-mode', `icicle-mode-hook'.
95 ;;
96 ;; Internal variables defined here:
97 ;;
98 ;; `icicle-bookmark-menu-map', `icicle-custom-menu-map',
99 ;; `icicle-describe-menu-map', `icicle-dired-multiple-menu-map',
100 ;; `icicle-dired-recursive-marked-menu-map',
101 ;; `icicle-edit-menu-map', `icicle-file-menu-map',
102 ;; `icicle-frames-menu-map', `icicle-info-menu-map',
103 ;; `icicle-mode-map', `icicle-options-menu-map',
104 ;; `icicle-search-menu-map', `icicle-search-tags-menu-map'.
105 ;;
106 ;; For descriptions of changes to this file, see `icicles-chg.el'.
107
108 ;;(@> "Index")
109 ;;
110 ;; If you have library `linkd.el' and Emacs 22 or later, load
111 ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily
112 ;; navigate around the sections of this doc. Linkd mode will
113 ;; highlight this Index, as well as the cross-references and section
114 ;; headings throughout this file. You can get `linkd.el' here:
115 ;; http://dto.freeshell.org/notebook/Linkd.html.
116 ;;
117 ;; (@> "User Options (alphabetical)")
118 ;; (@> "Internal variables (alphabetical)")
119 ;; (@> "Icicle mode command")
120 ;; (@> "Other Icicles functions that define Icicle mode")
121
122 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
123 ;;
124 ;; This program is free software; you can redistribute it and/or modify
125 ;; it under the terms of the GNU General Public License as published by
126 ;; the Free Software Foundation; either version 2, or (at your option)
127 ;; any later version.
128 ;;
129 ;; This program is distributed in the hope that it will be useful,
130 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
131 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132 ;; GNU General Public License for more details.
133 ;;
134 ;; You should have received a copy of the GNU General Public License
135 ;; along with this program; see the file COPYING. If not, write to the
136 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth
137 ;; ;; Floor, Boston, MA 02110-1301, USA.
138 ;;
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
140 ;;
141 ;;; Code:
142
143 (eval-when-compile (require 'cl)) ;; pushnew, case
144 ;; plus, for Emacs < 21: push, dolist
145
146 (require 'advice)
147 ;; ad-activate, ad-copy-advice-info, ad-deactivate, ad-disable-advice, ad-enable-advice,
148 ;; ad-find-some-advice, ad-get-arg, ad-is-active, ad-set-advice-info
149
150 (require 'icicles-opt) ; (This is required anyway by `icicles-var.el'.)
151 ;; icicle-buffer-configs, icicle-buffer-extras, icicle-change-region-background-flag,
152 ;; icicle-default-cycling-mode, icicle-incremental-completion, icicle-default-value, icicle-kbd,
153 ;; icicle-kmacro-ring-max, icicle-minibuffer-setup-hook, icicle-modal-cycle-down-keys,
154 ;; icicle-modal-cycle-up-keys, icicle-functions-to-redefine, icicle-regexp-search-ring-max,
155 ;; icicle-region-background, icicle-search-ring-max, icicle-show-Completions-initially-flag,
156 ;; icicle-top-level-key-bindings, icicle-touche-pas-aux-menus-flag, icicle-word-completion-keys
157 (require 'icicles-fn) ; (This is required anyway by `icicles-cmd1.el'.)
158 ;; icicle-completing-p, icicle-toggle-icicle-mode-twice, icicle-unhighlight-lighter
159 (require 'icicles-var) ; (This is required anyway by `icicles-fn.el'.)
160 ;; icicle-candidate-action-fn, icicle-candidate-nb, icicle-cmd-calling-for-completion,
161 ;; icicle-completing-p, icicle-completion-candidates, icicle-current-completion-mode,
162 ;; icicle-ignored-extensions, icicle-ignored-extensions-regexp, icicle-incremental-completion-p,
163 ;; icicle-initial-value, icicle-last-completion-candidate, icicle-last-completion-command,
164 ;; icicle-last-input, icicle-menu-map, icicle-pre-minibuffer-buffer, icicle-minor-mode-map-entry,
165 ;; icicle-saved-completion-candidates, icicle-saved-kmacro-ring-max,
166 ;; icicle-saved-regexp-search-ring-max, icicle-saved-region-background, icicle-saved-search-ring-max,
167 ;; icicle-search-current-overlay, icicle-search-overlays, icicle-search-refined-overlays
168 (require 'icicles-cmd1) ; (This is required anyway by `icicles-cmd2.el'.)
169 ;; icicle-add-buffer-candidate, icicle-add-buffer-config, icicle-customize-face-other-window,
170 ;; icicle-select-bookmarked-region
171 (require 'icicles-cmd2)
172 ;; icicle-imenu, icicle-imenu-command, icicle-imenu-command-full, icicle-imenu-face,
173 ;; icicle-imenu-face-full, icicle-imenu-full, icicle-imenu-key-explicit-map,
174 ;; icicle-imenu-key-explicit-map-full, icicle-imenu-key-implicit-map,
175 ;; icicle-imenu-key-implicit-map-full, icicle-imenu-macro, icicle-imenu-macro-full,
176 ;; icicle-imenu-non-interactive-function, icicle-imenu-non-interactive-function-full,
177 ;; icicle-imenu-user-option, icicle-imenu-user-option-full, icicle-imenu-variable,
178 ;; icicle-imenu-variable-full, icicle-occur, icicle-search, icicle-search-all-tags-bookmark,
179 ;; icicle-search-all-tags-regexp-bookmark, icicle-search-autofile-bookmark,
180 ;; icicle-search-autonamed-bookmark, icicle-search-bookmark, icicle-search-bookmark-list-bookmark,
181 ;; icicle-search-bookmark-list-marked, icicle-search-bookmarks-together, icicle-search-buffer,
182 ;; icicle-search-buff-menu-marked, icicle-search-char-property, icicle-search-dired-bookmark,
183 ;; icicle-search-dired-marked-recursive, icicle-search-file, icicle-search-file-bookmark,
184 ;; icicle-search-gnus-bookmark, icicle-search-highlight-cleanup, icicle-search-ibuffer-marked,
185 ;; icicle-search-info-bookmark, icicle-search-keywords, icicle-search-local-file-bookmark,
186 ;; icicle-search-man-bookmark, icicle-search-non-file-bookmark, icicle-search-overlay-property,
187 ;; icicle-search-pages, icicle-search-paragraphs, icicle-search-region-bookmark,
188 ;; icicle-search-remote-file-bookmark, icicle-search-sentences, icicle-search-some-tags-bookmark,
189 ;; icicle-search-some-tags-regexp-bookmark, icicle-search-specific-buffers-bookmark,
190 ;; icicle-search-specific-files-bookmark, icicle-search-temporary-bookmark,
191 ;; icicle-search-text-property, icicle-search-thing, icicle-search-this-buffer-bookmark,
192 ;; icicle-search-url-bookmark, icicle-search-w3m-bookmark, icicle-search-w-isearch-string,
193 ;; icicle-search-word, icicle-search-xml-element, icicle-search-xml-element-text-node
194
195 ;; Use `condition-case' because if `mb-depth.el' can't be found, `mb-depth+.el' is not provided.
196 (when (>= emacs-major-version 22) (condition-case nil (require 'mb-depth+ nil t) (error nil)))
197 ;; (no error if not found): minibuffer-depth-indicate-mode
198
199 (require 'dired+ nil t) ;; (no error if not found):
200 ;; diredp-menu-bar-operate-menu, diredp-menu-bar-recursive-marked-menu,
201 ;; diredp-menu-bar-subdir-menu
202 (require 'dired) ;; dired-mode-map
203 (require 'menu-bar+ nil t) ;; (no error if not found):
204 ;; menu-bar-apropos-menu, menu-bar-describe-menu, menu-bar-edit-menu, menu-bar-file-menu,
205 ;; menu-bar-frames-menu, menu-bar-options-menu, menu-bar-search-tags-menu
206
207 ;; `icicle-apropos-complete' is used here. It is defined in `icicles-mcmd.el'.
208 ;; `icicle-file-name-input-p' is used here. It is defined in `icicles-fn.el'.
209
210 ;;; Defvars to quiet byte-compiler:
211 (when (< emacs-major-version 22)
212 (defvar kmacro-ring-max)
213 (defvar minibuffer-local-filename-completion-map)
214 (defvar minibuffer-local-must-match-filename-map)
215 (defvar minibuffer-local-filename-must-match-map)
216 (defvar mouse-wheel-down-event)
217 (defvar mouse-wheel-up-event)
218 (defvar read-file-name-function))
219
220 (defvar Buffer-menu-mode-map) ; In `buff-menu.el'.
221 (defvar comint-mode-map) ; In `comint.el'.
222 (defvar crm-local-completion-map) ; In `crm.el'.
223 (defvar crm-local-must-match-map) ; In `crm.el'.
224 (defvar dired-mode-map) ; In `dired.el'.
225 (defvar gud-minibuffer-local-map) ; In `gud.el'.
226 (defvar ibuffer-mode-map) ; In `ibuffer.el'.
227 (defvar ibuffer-mode-operate-map) ; In `ibuffer.el'.
228 (defvar icicle-crm-local-completion-map) ; In `icicles-fn.el' after load `crm.el'.
229 (defvar icicle-crm-local-must-match-map) ; In `icicles-fn.el' after load `crm.el'.
230 (defvar icicle-kmacro-ring-max) ; In `icicles-opt.el' for Emacs 22+.
231 (defvar icicle-ORIG-crm-local-completion-map) ; In `icicles-fn.el' after load `crm.el'.
232 (defvar icicle-ORIG-crm-local-must-match-map) ; In `icicles-fn.el' after load `crm.el'.
233 (defvar icicle-saved-kmacro-ring-max) ; In `icicles-var.el' for Emacs 22+.
234 (defvar ielm-map) ; In `ielm.el'.
235 (defvar inferior-tcl-mode-map) ; In `tcl.el'.
236 (defvar Info-mode-map) ; In `info.el'.
237 (defvar isearch-mode-map) ; In `isearch.el'.
238 (defvar menu-bar-goto-menu) ; In `menu-bar.el'.
239 (defvar savehist-minibuffer-history-variables) ; In `savehist.el'
240 (defvar shell-mode-map) ; In `shell.el'.
241 (defvar sh-mode-map) ; In `sh-script.el'.
242
243 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
244
245 ;;(@* "User Options (alphabetical)")
246
247 ;;; User Options (alphabetical) --------------------------------------
248
249 ;; Emacs 20 only
250 (unless (fboundp 'define-minor-mode)
251 (defcustom icicle-mode nil
252 "*Non-nil means use Icicles minibuffer input completion and cycling.
253 Setting this variable directly does not take effect;
254 use either \\[customize] or command `icy-mode' (aka `icicle-mode')."
255 :set (lambda (symbol value) (icicle-mode (if value 1 -1)))
256 :initialize 'custom-initialize-default
257 :type 'boolean :group 'Icicles-Miscellaneous :require 'icicles))
258
259 (defcustom icicle-mode-hook nil
260 "*Functions run after entering and exiting Icicle mode."
261 :type 'hook :group 'Icicles-Miscellaneous)
262
263 ;;(@* "Internal variables (alphabetical)")
264
265 ;;; Internal variables (alphabetical) --------------------------------
266
267 (defvar icicle-mode-map nil
268 "Keymap for Icicle mode. These are top-level key bindings.
269 See also `icicle-define-minibuffer-maps' for minibuffer bindings and
270 bindings in `*Completions*'.")
271
272 ;;(@* "Icicle mode command")
273
274 ;;; Icicle mode command ----------------------------------------------
275
276 ;; Main command. Inspired from `icomplete-mode'.
277 (defalias 'icy-mode 'icicle-mode)
278 (when (fboundp 'define-minor-mode) ; Emacs 21+ ------------
279 (when (> emacs-major-version 22)
280 (defadvice call-interactively (after icicle-save-to-history disable activate)
281 "Save command to `icicle-interactive-history'."
282 ;; If command's input is not a parameterized (e.g. mouse) event, record it.
283 (let* ((fn (ad-get-arg 0))
284 (int (interactive-form fn)))
285 (when (and (symbolp fn) (consp int) (or (not (stringp (cadr int)))
286 (string= (cadr int) "")
287 (not (eq ?e (aref (cadr int) 0)))))
288 (pushnew (symbol-name fn) icicle-interactive-history))))
289 (when (boundp 'savehist-save-hook) ; Do not save `icicle-interactive-history' (too large).
290 (add-hook 'savehist-save-hook
291 (lambda () (setq savehist-minibuffer-history-variables
292 (delq 'icicle-interactive-history
293 savehist-minibuffer-history-variables))))))
294 (when (> emacs-major-version 21)
295 (defadvice describe-face (before icicle-respect-WYSIWYG activate)
296 "`read-face-name' respects `icicle-WYSIWYG-Completions-flag'.
297 If non-nil, then it does not use `completing-read-multiple' (which
298 cannot take advantage of WYSIWYG)."
299 (interactive (list (read-face-name "Describe face" "= `default' face"
300 (not icicle-WYSIWYG-Completions-flag))))))
301
302 ;; Eval this so that even if the library is byte-compiled with Emacs 20,
303 ;; loading it into Emacs 21+ will define variable `icicle-mode'.
304 (eval '(define-minor-mode icicle-mode
305 "Icicle mode: Toggle minibuffer input completion and cycling.
306 Non-nil prefix ARG turns mode on if ARG > 0, else turns it off.
307 Icicle mode is a global minor mode. It binds keys in the minibuffer.
308
309 You can use `customize-group Icicles' or `C-u customize-mode
310 icicle-mode' to customize Icicles options and faces.
311
312 For more information, use `\\<minibuffer-local-completion-map>\\[icicle-minibuffer-help]' \
313 when the minibuffer is active.
314
315 Depending on your platform, if you use Icicles in a text terminal
316 \(that is, without a window system/manager), you might need to change
317 some of the key bindings if some of the default bindings are not
318 available to you.
319
320 Icicle mode defines many top-level commands. For a list, see the
321 Commentary headers of files `icicles-cmd1.el' and `icicles-cmd2.el'."
322 :global t :group 'Icicles :lighter " Icy" :init-value nil
323 (cond (icicle-mode
324 ;; (when (interactive-p)
325 ;; (unless (or window-system (and (fboundp 'daemonp) (daemonp)))
326 ;; (with-output-to-temp-buffer "*Attention*"
327 ;; (princ "You are using Icicles in a text terminal (no window ")
328 ;; (princ "system/manager).\n\nIcicles makes use of many keys that are ")
329 ;; (princ "unavailable when running\nEmacs in a text terminal. You will ")
330 ;; (princ "want to rebind those keys.\n")
331 ;; (princ "See the Icicles doc, section Key Bindings.\n"))
332 ;; (message "Icicles uses keys that might not be suitable for a text terminal")
333 ;; (sit-for 5)))
334 (icicle-define-icicle-maps)
335 (icicle-bind-other-keymap-keys)
336 (add-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup)
337 (add-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection)
338 (add-hook 'minibuffer-exit-hook 'icicle-restore-region-face)
339 (add-hook 'minibuffer-exit-hook 'icicle-unhighlight-lighter)
340 (add-hook 'icicle-post-command-hook 'icicle-activate-mark 'append)
341 (add-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line 'append)
342 (add-hook 'completion-setup-hook 'icicle-set-calling-cmd 'append)
343 (when icicle-customize-save-flag
344 (add-hook 'kill-emacs-hook 'icicle-command-abbrev-save))
345 (add-hook 'comint-mode-hook 'icicle-comint-hook-fn)
346 (add-hook 'compilation-mode-hook 'icicle-compilation-hook-fn)
347 (add-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn)
348 ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now.
349 ;; $$$$$$ (add-hook 'temp-buffer-show-hook 'icicle-fit-completions-window)
350 (icicle-undo-std-completion-faces)
351 (icicle-redefine-std-completion-fns)
352 (icicle-redefine-standard-functions)
353 (icicle-redefine-standard-options)
354 (icicle-redefine-standard-widgets)
355 (when (ad-find-some-advice 'describe-face 'before 'icicle-respect-WYSIWYG)
356 (ad-enable-advice 'describe-face 'before 'icicle-respect-WYSIWYG))
357 (when (fboundp 'minibuffer-depth-indicate-mode) ; In `mb-depth(+).el'
358 (minibuffer-depth-indicate-mode 99))
359 (if icicle-menu-items-to-history-flag
360 (add-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history)
361 (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history))
362 (when (> emacs-major-version 22)
363 (when icicle-populate-interactive-history-flag
364 (ad-enable-advice 'call-interactively 'after 'icicle-save-to-history))
365 (ad-activate 'call-interactively))
366 (dolist (fn icicle-inhibit-advice-functions)
367 (when (and (fboundp fn) (ad-is-active fn))
368 (push (cons fn (ad-copy-advice-info fn)) icicle-advice-info-list)
369 (ad-deactivate fn))))
370 (t
371 (makunbound 'icicle-mode-map)
372 (icicle-restore-other-keymap-keys)
373 (remove-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup)
374 (remove-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection)
375 (remove-hook 'minibuffer-exit-hook 'icicle-restore-region-face)
376 (remove-hook 'icicle-post-command-hook 'icicle-activate-mark)
377 (remove-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line)
378 ;; The pre- and post-command hooks are local to the minibuffer,
379 ;; So they are added in `icicle-minibuffer-setup', not here.
380 ;; Nevertheless, they are removed here when Icicle mode is exited.
381 (remove-hook 'pre-command-hook 'icicle-top-level-prep)
382 (remove-hook 'pre-command-hook 'icicle-run-icicle-pre-command-hook t)
383 (remove-hook 'post-command-hook 'icicle-run-icicle-post-command-hook t)
384 (remove-hook 'completion-setup-hook 'icicle-set-calling-cmd)
385 (remove-hook 'kill-emacs-hook 'icicle-command-abbrev-save)
386 (remove-hook 'comint-mode-hook 'icicle-comint-hook-fn)
387 (remove-hook 'compilation-mode-hook 'icicle-compilation-hook-fn)
388 (remove-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn)
389 ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now.
390 ;; $$$$$$ (remove-hook 'temp-buffer-show-hook 'icicle-fit-completions-window)
391
392 ;; $$ Should restore standard completion faces here.
393 (icicle-restore-std-completion-fns)
394 (icicle-restore-standard-functions)
395 (icicle-restore-standard-options)
396 (icicle-restore-standard-widgets)
397 (when (ad-find-some-advice 'describe-face 'before 'icicle-respect-WYSIWYG)
398 (ad-disable-advice 'describe-face 'before 'icicle-respect-WYSIWYG))
399 (when (fboundp 'minibuffer-depth-indicate-mode)
400 (minibuffer-depth-indicate-mode -99))
401 (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history)
402 (when (> emacs-major-version 22)
403 (ad-disable-advice 'call-interactively 'after 'icicle-save-to-history)
404 (ad-activate 'call-interactively))
405 (dolist (fn icicle-inhibit-advice-functions)
406 (let ((info (memq fn icicle-advice-info-list)))
407 (when (and (fboundp fn) info)
408 (ad-set-advice-info fn info)
409 (when (ad-is-active fn) (ad-activate fn)))))))
410 (unless (eq icicle-guess-commands-in-path 'load)
411 (setq icicle-shell-command-candidates-cache ())) ; Reset - toggle Icy to update.
412 (message "Turning %s Icicle mode..."
413 (icicle-propertize (if icicle-mode "ON" "OFF") 'face 'icicle-msg-emphasis))
414 (icicle-define-minibuffer-maps icicle-mode)
415 (run-hooks 'icicle-mode-hook)
416 (message "Turning %s Icicle mode...done"
417 (icicle-propertize (if icicle-mode "ON" "OFF") 'face 'icicle-msg-emphasis))))
418
419 ;; Do this so users can do `C-u customize-mode icicle-mode'. See Emacs bugs #11299 and #11301.
420 (put 'icicle-mode 'custom-mode-group 'Icicles))
421
422 (unless (fboundp 'define-minor-mode) ; Emacs 20 ------------
423 (defun icicle-mode (&optional arg)
424 "Icicle mode: Toggle minibuffer input completion and cycling.
425 Non-nil prefix ARG turns mode on if ARG > 0, else turns it off.
426 Icicle mode is a global minor mode. It binds keys in the minibuffer.
427
428 For more information, use `\\<minibuffer-local-completion-map>\\[icicle-minibuffer-help]' \
429 when the minibuffer is active.
430
431 Depending on your platform, if you use Icicles in a text terminal
432 \(that is, without a window system/manager), you might need to change
433 some of the key bindings if some of the default bindings are not
434 available to you.
435
436 Icicle mode defines many top-level commands. For a list, see the
437 Commentary headers of files `icicles-cmd1.el' and `icicles-cmd2.el'."
438 (interactive "P")
439 (setq icicle-mode (if arg (> (prefix-numeric-value arg) 0) (not icicle-mode)))
440 (icicle-define-minibuffer-maps icicle-mode)
441 (cond (icicle-mode
442 ;; (when (interactive-p)
443 ;; (unless (or window-system (and (fboundp 'daemonp) (daemonp)))
444 ;; (with-output-to-temp-buffer "*Attention*"
445 ;; (princ "You are using Icicles in a text terminal (no window ")
446 ;; (princ "system/manager).\n\nIcicles makes use of many keys that are ")
447 ;; (princ "unavailable when running\nEmacs in a text terminal. You will ")
448 ;; (princ "want to rebind those keys.\n")
449 ;; (princ "See the Icicles doc, section Key Bindings.\n"))
450 ;; (message "Icicles uses keys that might not be suitable for a text terminal")
451 ;; (sit-for 5)))
452 (icicle-define-icicle-maps)
453 (icicle-bind-other-keymap-keys)
454 ;; This is not really necessary after the first time - no great loss.
455 (add-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup)
456 (add-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection)
457 (add-hook 'minibuffer-exit-hook 'icicle-restore-region-face)
458 (add-hook 'minibuffer-exit-hook 'icicle-unhighlight-lighter)
459 (add-hook 'icicle-post-command-hook 'icicle-activate-mark 'append)
460 (add-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line 'append)
461 (add-hook 'completion-setup-hook 'icicle-set-calling-cmd 'append)
462 (when icicle-customize-save-flag
463 (add-hook 'kill-emacs-hook 'icicle-command-abbrev-save))
464 (add-hook 'comint-mode-hook 'icicle-comint-hook-fn)
465 (add-hook 'compilation-mode-hook 'icicle-compilation-hook-fn)
466 (add-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn)
467 ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now.
468 ;; $$$$$$ (add-hook 'temp-buffer-show-hook 'icicle-fit-completions-window)
469 (icicle-redefine-std-completion-fns)
470 (icicle-redefine-standard-functions)
471 (icicle-redefine-standard-options)
472 (icicle-redefine-standard-widgets)
473 (if icicle-menu-items-to-history-flag
474 (add-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history)
475 (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history))
476 (dolist (fn icicle-inhibit-advice-functions)
477 (when (and (fboundp fn) (ad-is-active fn))
478 (push (cons fn (ad-copy-advice-info fn)) icicle-advice-info-list)
479 (ad-deactivate fn)))
480 (run-hooks 'icicle-mode-hook)
481 (message "Icicle mode is now ON"))
482 (t
483 (makunbound 'icicle-mode-map)
484 (icicle-restore-other-keymap-keys)
485 (remove-hook 'minibuffer-setup-hook 'icicle-minibuffer-setup)
486 (remove-hook 'minibuffer-exit-hook 'icicle-cancel-Help-redirection)
487 (remove-hook 'minibuffer-exit-hook 'icicle-restore-region-face)
488 (remove-hook 'icicle-post-command-hook 'icicle-activate-mark)
489 (remove-hook 'icicle-post-command-hook 'icicle-show-current-help-in-mode-line)
490 ;; The pre- and post-command hooks are local to the minibuffer,
491 ;; So they are added in `icicle-minibuffer-setup', not here.
492 ;; Nevertheless, they are removed here when Icicle mode is exited.
493 (remove-hook 'pre-command-hook 'icicle-top-level-prep)
494 (remove-hook 'pre-command-hook 'icicle-run-icicle-pre-command-hook t)
495 (remove-hook 'post-command-hook 'icicle-run-icicle-post-command-hook t)
496 (remove-hook 'completion-setup-hook 'icicle-set-calling-cmd)
497 (remove-hook 'kill-emacs-hook 'icicle-command-abbrev-save)
498 (remove-hook 'comint-mode-hook 'icicle-comint-hook-fn)
499 (remove-hook 'compilation-mode-hook 'icicle-compilation-hook-fn)
500 (remove-hook 'compilation-minor-mode-hook 'icicle-compilation-hook-fn)
501 ;; $$$$$$ Do this only in `icicle-display-candidates-in-Completions' now.
502 ;; $$$$$$ (remove-hook 'temp-buffer-show-hook 'icicle-fit-completions-window)
503 (icicle-restore-std-completion-fns)
504 (icicle-restore-standard-functions)
505 (icicle-restore-standard-options)
506 (icicle-restore-standard-widgets)
507 (unless (eq icicle-guess-commands-in-path 'load)
508 (setq icicle-shell-command-candidates-cache ())) ; Reset - toggle Icy to update.
509 (remove-hook 'pre-command-hook 'icicle-add-menu-item-to-cmd-history)
510 (dolist (fn icicle-inhibit-advice-functions)
511 (let ((info (memq fn icicle-advice-info-list)))
512 (when (and (fboundp fn) info)
513 (ad-set-advice-info fn info)
514 (when (ad-is-active fn) (ad-activate fn)))))
515 (run-hooks 'icicle-mode-hook)
516 (message "Icicle mode is now OFF")))
517
518 (add-to-list 'minor-mode-alist '(icicle-mode " Icy"))))
519
520 (defun icicle-add-menu-item-to-cmd-history ()
521 "Add `this-command' to command history, if it is a menu item.
522 Menu items that are not associated with a command symbol are ignored.
523 Used on `pre-command-hook'."
524 (condition-case nil ; Just in case, since this is on `pre-command-hook'.
525 (when (and (> (length (this-command-keys-vector)) 0)
526 (equal '(menu-bar) (elt (this-command-keys-vector) 0))
527 ;; Exclude uninterned symbols such as `menu-function-356'.
528 (symbolp this-command) (or (< emacs-major-version 21) (intern-soft this-command)))
529 (pushnew (symbol-name this-command) extended-command-history))
530 (error nil)))
531
532 (defun icicle-top-level-prep ()
533 "Do top-level stuff. Used in `pre-command-hook'."
534 ;; Reset `icicle-current-TAB-method' and `icicle-apropos-complete-match-fn' if temporary.
535 ;; Save this top-level command as `icicle-last-top-level-command'
536 ;; Reset `icicle-candidates-alist' to ().
537 (when (= 0 (recursion-depth))
538 (let ((TAB-method (get 'icicle-last-top-level-command 'icicle-current-TAB-method))
539 (apropos-fn (get 'icicle-last-top-level-command 'icicle-apropos-complete-match-fn)))
540 (when TAB-method (setq icicle-current-TAB-method TAB-method))
541 (when apropos-fn (setq icicle-apropos-complete-match-fn apropos-fn)))
542 (setq icicle-last-top-level-command this-command
543 icicle-candidates-alist ())))
544
545 (defun icicle-define-icicle-maps ()
546 "Define `icicle-mode-map' and `icicle-menu-map'."
547 (setq icicle-mode-map (make-sparse-keymap)) ; Recreate it each time, to capture latest bindings.
548
549 ;; Define `Icicles' menu-bar menu. Create it only once: sacrifice any new bindings for speed.
550 (unless icicle-menu-map
551 (setq icicle-menu-map (make-sparse-keymap "Icicles"))
552 (define-key icicle-menu-map [icicle-mode] '(menu-item "Turn Off Icicle Mode" icicle-mode))
553
554 ;; End of `Icicles' menu -----------------------------------------
555 (define-key icicle-menu-map [icicle-report-bug]
556 '(menu-item "Send Icicles Bug Report" icicle-send-bug-report))
557 (define-key icicle-menu-map [icicle-customize-icicles-group]
558 '(menu-item "Customize Icicles" icicle-customize-icicles-group))
559
560
561 ;; `Options' -----------------------------------------------------
562 (cond ((not icicle-touche-pas-aux-menus-flag)
563 (defvar icicle-options-menu-map (make-sparse-keymap)
564 "`Options' > `Icicles' submenu.")
565 (define-key menu-bar-options-menu [icicles]
566 (list 'menu-item "Icicles" icicle-options-menu-map :visible 'icicle-mode)))
567 (t
568 (defvar icicle-options-menu-map (make-sparse-keymap)
569 "`Icicles' > `Icicles Options' submenu.")
570 (define-key icicle-menu-map [options]
571 (list 'menu-item "Icicles Options" icicle-options-menu-map))))
572
573 (define-key icicle-options-menu-map [icicle-set-option-to-t]
574 '(menu-item "+ Turn On Any Option..." icicle-set-option-to-t
575 :help "Set boolean option to `t' (C-u: any user option, C--: any var)"))
576 (define-key icicle-options-menu-map [icicle-reset-option-to-nil]
577 '(menu-item "+ Turn Off Any Option..." icicle-reset-option-to-nil
578 :help "Reset an option to `nil' (C-u: reset any variable)"))
579 (define-key icicle-options-menu-map [icicle-toggle-option]
580 '(menu-item "+ Toggle Any Option..." icicle-toggle-option
581 :help "Toggle boolean option (C-u: any user option, C--: any var)"))
582 (define-key icicle-options-menu-map [icicle-toggle-C-for-actions]
583 '(menu-item "Toggle Using `C-' for Actions" icicle-toggle-C-for-actions :keys "M-g"
584 :help "Toggle option `icicle-use-C-for-actions-flag'"))
585 (define-key icicle-options-menu-map [icicle-toggle-~-for-home-dir]
586 '(menu-item "Toggle Using `~' for $HOME" icicle-toggle-~-for-home-dir :keys "M-~"
587 :help "Toggle option `icicle-use-~-for-home-dir-flag'"))
588 (define-key icicle-options-menu-map [icicle-toggle-WYSIWYG-Completions]
589 '(menu-item "Toggle WYSIWYG For `*Completions*'" icicle-toggle-WYSIWYG-Completions
590 :help "Toggle option `icicle-WYSIWYG-Completions-flag'"))
591 (define-key icicle-options-menu-map [icicle-next-TAB-completion-method]
592 '(menu-item "Next `TAB' Completion Method" icicle-next-TAB-completion-method
593 :keys "C-(" :help "Cycle to the next `TAB' completion method (C-u: ONE-OFF)"))
594 (define-key icicle-options-menu-map [icicle-next-S-TAB-completion-method]
595 '(menu-item "Next `S-TAB' Completion Method" icicle-next-S-TAB-completion-method
596 :keys "M-(" :help "Cycle to the next `S-TAB' completion method (C-u: ONE-OFF)"))
597 (when (fboundp 'icicle-cycle-image-file-thumbnail)
598 (define-key icicle-options-menu-map [icicle-cycle-image-file-thumbnail]
599 '(menu-item "Next Image-File Thumbnail Setting" icicle-cycle-image-file-thumbnail
600 :keys "C-x t" :help "Cycle Thumbnail Image File Setting")))
601 (define-key icicle-options-menu-map [icicle-toggle-search-cleanup]
602 '(menu-item "Toggle Icicle-Search Highlighting Cleanup" icicle-toggle-search-cleanup
603 :keys "C-." :help "Toggle option `icicle-search-cleanup-flag'"))
604 (define-key icicle-options-menu-map [icicle-toggle-search-replace-common-match]
605 '(menu-item "Toggle Replacing Longest Common Match"
606 icicle-toggle-search-replace-common-match :enable icicle-searching-p :keys "M-;"
607 :help "Toggle option `icicle-search-replace-common-match-flag'"))
608 (define-key icicle-options-menu-map [icicle-toggle-search-replace-whole]
609 '(menu-item "Toggle Replacing Whole Search Hit" icicle-toggle-search-replace-whole
610 :enable icicle-searching-p :keys "M-_"
611 :help "Toggle option `icicle-search-replace-whole-candidate-flag'"))
612 (define-key icicle-options-menu-map [icicle-toggle-search-whole-word]
613 '(menu-item "Toggle Whole-Word Searching (Icicles Search)"
614 icicle-toggle-search-whole-word
615 :enable icicle-searching-p :keys "M-q"
616 :help "Toggle `icicle-search-whole-word-flag'"))
617 (define-key icicle-options-menu-map [icicle-toggle-regexp-quote]
618 '(menu-item "Toggle Escaping Special Chars" icicle-toggle-regexp-quote :keys "C-`"
619 :help "Toggle option `icicle-regexp-quote-flag'"))
620 (define-key icicle-options-menu-map [icicle-toggle-dot]
621 '(menu-item "Toggle `.' Matching Newlines Too" icicle-toggle-dot :keys "C-M-."
622 :help "Toggle `icicle-dot-string' between `.' and `icicle-anychar-regexp'"))
623 (define-key icicle-options-menu-map [icicle-cycle-incremental-completion]
624 '(menu-item "Cycle Incremental Completion" icicle-cycle-incremental-completion
625 :keys "C-#" :help "Cycle option `icicle-incremental-completion'"))
626 (define-key icicle-options-menu-map [icicle-toggle-show-multi-completion]
627 '(menu-item "Toggle Showing Multi-Completions" icicle-toggle-show-multi-completion
628 :help "Toggle option `icicle-show-multi-completion-flag'"))
629 (define-key icicle-options-menu-map [icicle-toggle-completions-format]
630 '(menu-item "Toggle Horizontal/Vertical Layout" icicle-toggle-completions-format
631 :help "Toggle option `icicle-hide-non-matching-lines-flag'"))
632 (define-key icicle-options-menu-map [icicle-toggle-hiding-non-matching-lines]
633 '(menu-item "Toggle Hiding Non-Matching Lines"
634 icicle-toggle-hiding-non-matching-lines
635 :keys "C-u C-x ." :help "Toggle option `icicle-hide-non-matching-lines-flag'"))
636 (define-key icicle-options-menu-map [icicle-toggle-hiding-common-match]
637 '(menu-item "Toggle Hiding Common Match" icicle-toggle-hiding-common-match
638 :keys "C-x ." :help "Toggle option `icicle-hide-common-match-in-Completions-flag'"))
639 (define-key icicle-options-menu-map [icicle-toggle-expand-to-common-match]
640 '(menu-item "Toggle Expansion to Common Match" icicle-toggle-expand-to-common-match
641 :keys "C-\"" :help "Toggle option `icicle-expand-input-to-common-match'"))
642 (define-key icicle-options-menu-map [icicle-toggle-ignoring-comments]
643 '(menu-item "Toggle Ignoring Comments" icicle-toggle-ignoring-comments
644 :keys "C-M-;" :help "Toggle option `icicle-ignore-comments-flag'"))
645 (define-key icicle-options-menu-map [icicle-toggle-ignored-space-prefix]
646 '(menu-item "Toggle Ignoring Space Prefix" icicle-toggle-ignored-space-prefix
647 :keys "M-_" :help "Toggle option `icicle-buffer-ignore-space-prefix-flag'"))
648 (define-key icicle-options-menu-map [icicle-toggle-ignored-extensions]
649 '(menu-item "Toggle Ignored File Extensions" icicle-toggle-ignored-extensions
650 :keys "C-." :help "Toggle respect of `completion-ignored-extensions'"))
651 (define-key icicle-options-menu-map [icicle-toggle-remote-file-testing]
652 '(menu-item "Toggle Remote File Handling" icicle-toggle-remote-file-testing
653 :enable (not icicle-searching-p) :keys "C-^"
654 :help "Toggle option `icicle-test-for-remote-files-flag'"))
655 (when (> emacs-major-version 20)
656 (define-key icicle-options-menu-map [icicle-toggle-angle-brackets]
657 '(menu-item "Toggle Angle Brackets" icicle-toggle-angle-brackets
658 :help "Toggle option `icicle-key-descriptions-use-<>-flag'")))
659 (define-key icicle-options-menu-map [icicle-toggle-annotation]
660 '(menu-item "Toggle Candidate Annotation"
661 icicle-toggle-annotation :keys "C-x C-a"
662 :help "Toggle option `icicle-show-annotations-flag': hide/show annotations"))
663 (define-key icicle-options-menu-map [icicle-toggle-highlight-saved-candidates]
664 '(menu-item "Toggle Highlighting Saved Candidates"
665 icicle-toggle-highlight-saved-candidates :keys "S-pause"
666 :help "Toggle option `icicle-highlight-saved-candidates-flag'"))
667 (define-key icicle-options-menu-map [icicle-toggle-highlight-historical-candidates]
668 '(menu-item "Toggle Highlighting Past Inputs"
669 icicle-toggle-highlight-historical-candidates :keys "C-pause"
670 :help "Toggle option `icicle-highlight-historical-candidates-flag'"))
671 (define-key icicle-options-menu-map [icicle-toggle-case-sensitivity]
672 '(menu-item "Toggle Case Sensitivity" icicle-toggle-case-sensitivity :keys "C-A"
673 :help "Toggle `case-fold-search', `completion-ignore-case' (C-u: file & buffer too)"))
674 (define-key icicle-options-menu-map [icicle-toggle-proxy-candidates]
675 '(menu-item "Toggle Including Proxy Candidates" icicle-toggle-proxy-candidates
676 :keys "C-M-_" :help "Toggle option `icicle-add-proxy-candidates-flag'"))
677 (define-key icicle-options-menu-map [icicle-toggle-transforming]
678 '(menu-item "Toggle Duplicate Removal" icicle-toggle-transforming :keys "C-$"
679 :help "Toggle use of `icicle-transform-function' (default: remove dups)"))
680 (define-key icicle-options-menu-map [icicle-toggle-alternative-sorting]
681 '(menu-item "Swap Alternative Sort" icicle-toggle-alternative-sorting :keys "C-M-,"
682 :help "Swap current sort order for current alternative sort order"))
683 (define-key icicle-options-menu-map [icicle-change-alternative-sort-order]
684 '(menu-item "Change Alternative Sort Order" icicle-change-alternative-sort-order
685 :keys "M-," :help "Choose alt sort order (C-9: reverse, C-u: cyle/complete)"))
686 (define-key icicle-options-menu-map [icicle-change-sort-order]
687 '(menu-item "Change Sort Order" icicle-change-sort-order
688 :enable (not icicle-inhibit-sort-p) :keys "C-,"
689 :help "Choose sort order (C-9: reverse, C-u: cyle/complete)"))
690 (when (fboundp 'doremi)
691 (when (fboundp 'text-scale-increase) ; Emacs 23+.
692 (define-key icicle-options-menu-map [icicle-doremi-zoom-Completions+]
693 '(menu-item "*Completions* Zoom Factor - Do Re Mi"
694 icicle-doremi-zoom-Completions+
695 :visible (get-buffer-window "*Completions*" 'visible) :keys "C-x -"
696 :help "Zoom text in `*Completions*' incrementally")))
697 (define-key icicle-options-menu-map [icicle-doremi-inter-candidates-min-spaces+]
698 '(menu-item "*Completions* Candidate Spacing - Do Re Mi"
699 icicle-doremi-inter-candidates-min-spaces+
700 :visible (get-buffer-window "*Completions*" 'visible) :keys "C-x |"
701 :help "Change `icicle-inter-candidates-min-spaces' incrementally"))
702 (define-key icicle-options-menu-map [icicle-doremi-candidate-width-factor+]
703 '(menu-item "*Completions* Column Width - Do Re Mi"
704 icicle-doremi-candidate-width-factor+
705 :visible (get-buffer-window "*Completions*" 'visible) :keys "C-x w"
706 :help "Change `icicle-candidate-width-factor' incrementally"))
707 (define-key icicle-options-menu-map [icicle-doremi-increment-swank-prefix-length+]
708 '(menu-item "Swank Min Match Chars - Do Re Mi"
709 icicle-doremi-increment-swank-prefix-length+
710 :visible (eq (icicle-current-TAB-method) 'swank) :keys "C-x 2"
711 :help "Change `icicle-swank-prefix-length' incrementally"))
712 (define-key icicle-options-menu-map [icicle-doremi-increment-swank-timeout+]
713 '(menu-item "Swank Timeout - Do Re Mi"
714 icicle-doremi-increment-swank-timeout+
715 :visible (eq (icicle-current-TAB-method) 'swank) :keys "C-x 1"
716 :help "Change `icicle-swank-timeout' incrementally"))
717 (define-key icicle-options-menu-map [icicle-doremi-increment-max-candidates+]
718 '(menu-item "Max # of Completions - Do Re Mi"
719 icicle-doremi-increment-max-candidates+
720 :visible (active-minibuffer-window) :keys "C-x #"
721 :help "Change `icicle-max-candidates' incrementally")))
722
723
724 ;; Beginning of non-submenu `Icicles' menu -----------------------
725 (define-key icicle-menu-map [icicle-help]
726 '(menu-item "Icicles Help" icicle-minibuffer-help
727 :help "Display help for minibuffer input and completion" :keys "M-? in minibuf"))
728 (define-key icicle-menu-map [icicle-abort]
729 '(menu-item "Cancel Minibuffer" icicle-abort-recursive-edit
730 :enable (active-minibuffer-window)
731 :help "Cancel minibuffer input and return to higher level"))
732 (define-key icicle-menu-map [icicle-separator-last] '("--"))
733
734 (define-key icicle-menu-map [icicle-apply]
735 '(menu-item "+ Apply Function to Alist Items..." icicle-apply
736 :help "Selectively apply a function to elements in an alist"))
737 (define-key icicle-menu-map [icicle-save-string-to-variable]
738 '(menu-item "Save String to Variable..." icicle-save-string-to-variable
739 :help "Save a string (text) you are prompted for to a variable"))
740 (define-key icicle-menu-map [icicle-color-theme]
741 '(menu-item "+ Choose Color Theme..." icicle-color-theme
742 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
743 :help "Change color theme (cycling etc.)"))
744 (define-key icicle-menu-map [icicle-remove-saved-completion-set]
745 '(menu-item "+ Remove Saved Candidate Set..." icicle-remove-saved-completion-set
746 :enable icicle-saved-completion-sets
747 :help "Remove an entry from `icicle-saved-completion-sets'"))
748 (define-key icicle-menu-map [icicle-add/update-saved-completion-set]
749 '(menu-item "Add/Update Saved Candidate Set..." icicle-add/update-saved-completion-set
750 :help "Add or update an entry in `icicle-saved-completion-sets'"))
751 (when (fboundp 'icicle-kmacro)
752 (define-key icicle-menu-map [icicle-kmacro]
753 '(menu-item "+ Execute Nth Keyboard Macro..." icicle-kmacro
754 :enable (or (kmacro-ring-head) kmacro-ring)
755 :help "Execute a keyboard macro according to its position in `kmacro-ring'")))
756 (define-key icicle-menu-map [icicle-execute-named-keyboard-macro]
757 '(menu-item "+ Execute Named Keyboard Macro..." icicle-execute-named-keyboard-macro
758 :help "Read the name of a keyboard macro, then execute it"))
759
760
761 ;; `Customize' ---------------------------------------------------
762 (cond ((not icicle-touche-pas-aux-menus-flag)
763 (defvar icicle-custom-menu-map (make-sparse-keymap)
764 "`Customize Emacs' > `Icicles' submenu.")
765 (define-key menu-bar-custom-menu [icicles]
766 (list 'menu-item "Icicles" icicle-custom-menu-map :visible 'icicle-mode)))
767 (t
768 (defvar icicle-custom-menu-map (make-sparse-keymap)
769 "`Icicles' > `Customize' submenu.")
770 (define-key icicle-menu-map [customize]
771 (list 'menu-item "Customize" icicle-custom-menu-map))))
772
773 (define-key icicle-custom-menu-map [icicle-customize-apropos]
774 '(menu-item "Groups, Faces & Options Matching..." icicle-customize-apropos
775 :help "Customize groups, faces, and options that match a regexp"))
776 (define-key icicle-custom-menu-map [icicle-customize-face-other-window]
777 '(menu-item "+ Face..." icicle-customize-face-other-window
778 :help "Customize any number of faces (`C-RET')"))
779 (define-key icicle-custom-menu-map [icicle-customize-apropos-faces]
780 '(menu-item "Faces Matching..." icicle-customize-apropos-faces
781 :help "Customize faces that match a regexp"))
782 (define-key icicle-custom-menu-map [icicle-customize-apropos-opts-w-val-satisfying]
783 '(menu-item "Options Matching with a Value Satisfying..."
784 icicle-customize-apropos-opts-w-val-satisfying
785 :help "Customize options whose values satisfy a predicate that match a regexp"))
786 (define-key icicle-custom-menu-map [icicle-customize-apropos-options-of-type]
787 '(menu-item "Options of Type Matching..."
788 icicle-customize-apropos-options-of-type
789 :help "Customize user options of a given type that match a regexp"))
790 (define-key icicle-custom-menu-map [icicle-customize-apropos-options]
791 '(menu-item "Options Matching..." icicle-customize-apropos-options
792 :help "Customize user options that match a regexp"))
793 (define-key icicle-custom-menu-map [icicle-customize-apropos-groups]
794 '(menu-item "Groups Matching..." icicle-customize-apropos-groups
795 :help "Customize customization groups that match a regexp"))
796
797
798 ;; `Apropos' -----------------------------------------------------
799 (cond ((and (not icicle-touche-pas-aux-menus-flag) (boundp 'menu-bar-apropos-menu))
800 (defvar icicle-apropos-menu-map (make-sparse-keymap)
801 "`Help' > `Apropos' > `Icicles' submenu.")
802 (define-key menu-bar-apropos-menu [icicles]
803 (list 'menu-item "Icicles" icicle-apropos-menu-map :visible 'icicle-mode)))
804 (t
805 (defvar icicle-apropos-menu-map (make-sparse-keymap)
806 "`Icicles' > `Apropos' submenu.")
807 (define-key icicle-menu-map [apropos]
808 (list 'menu-item "Apropos" icicle-apropos-menu-map))))
809
810 (define-key icicle-apropos-menu-map [icicle-apropos-zippy]
811 '(menu-item "Zippy..." icicle-apropos-zippy
812 :help "Show all Zippy quotes matching a regular-expression"))
813 (cond ((fboundp 'apropos-option)
814 (define-key icicle-apropos-menu-map [icicle-apropos]
815 '(menu-item "Symbols..." icicle-apropos
816 :help "Like `apropos', but lets you see the list of matches (with `S-TAB')"))
817 (define-key icicle-apropos-menu-map [icicle-apropos-vars-w-val-satisfying]
818 '(menu-item "Variables with a Value Satisfying..." icicle-apropos-vars-w-val-satisfying
819 :help "Show variables whose values satisfy a given predicate"))
820 (define-key icicle-apropos-menu-map [icicle-apropos-value]
821 '(menu-item "Variables with Values..." icicle-apropos-value
822 :help "Show variables that match by name and/or value"))
823 (define-key icicle-apropos-menu-map [icicle-apropos-variable]
824 '(menu-item "Variables..." icicle-apropos-variable
825 :help "Show variables that match PATTERN"))
826 (define-key icicle-apropos-menu-map [icicle-apropos-options-of-type]
827 '(menu-item "Options of Type..." icicle-apropos-options-of-type
828 :help "Show user options (variables) of a given `defcustom' type"))
829 (define-key icicle-apropos-menu-map [icicle-apropos-option]
830 '(menu-item "Options..." icicle-apropos-option
831 :help "Show user options (variables) that match PATTERN"))
832 (define-key icicle-apropos-menu-map [icicle-apropos-function]
833 '(menu-item "Functions..." icicle-apropos-function
834 :help "Show functions that match PATTERN"))
835 (define-key icicle-apropos-menu-map [icicle-apropos-command]
836 '(menu-item "Commands..." icicle-apropos-command
837 :help "Show commands that match PATTERN")))
838 (t
839 (define-key icicle-apropos-menu-map [icicle-apropos-vars-w-val-satisfying]
840 '(menu-item "Variables with a Value Satisfying..." icicle-apropos-vars-w-val-satisfying
841 :help "Show variables whose values satisfy a given predicate"))
842 (define-key icicle-apropos-menu-map [icicle-apropos-value]
843 '(menu-item "Variables with Values..." icicle-apropos-value
844 :help "Show variables that match by name and/or value"))
845 (define-key icicle-apropos-menu-map [icicle-apropos-variable]
846 '(menu-item "Variables..." icicle-apropos-variable
847 :help "Show variables that match PATTERN"))
848 (define-key icicle-apropos-menu-map [icicle-apropos-command]
849 '(menu-item "Commands..." icicle-apropos-command
850 :help "Show commands that match PATTERN"))))
851
852
853 ;; `Describe' ----------------------------------------------------
854 (cond ((not icicle-touche-pas-aux-menus-flag)
855 (defvar icicle-describe-menu-map (make-sparse-keymap)
856 "`Describe' > `Icicles' submenu.")
857 (define-key menu-bar-describe-menu [icicles]
858 (list 'menu-item "Icicles" icicle-describe-menu-map :visible 'icicle-mode)))
859 (t
860 (defvar icicle-describe-menu-map (make-sparse-keymap)
861 "`Icicles' > `Describe' submenu.")
862 (define-key icicle-menu-map [describe]
863 (list 'menu-item "Describe" icicle-describe-menu-map :visible 'icicle-mode))))
864
865 (define-key icicle-describe-menu-map [icicle-plist]
866 '(menu-item "+ Symbol with Property List..." icicle-plist
867 :help "Choose a symbol and its property list"))
868 (define-key icicle-describe-menu-map [icicle-doc]
869 '(menu-item "+ Doc of Fun, Var, or Face..." icicle-doc
870 :help "Choose documentation for a symbol"))
871 (define-key icicle-describe-menu-map [icicle-fundoc]
872 '(menu-item "+ Function with Name, Doc..." icicle-fundoc
873 :help "Choose a function description"))
874 (define-key icicle-describe-menu-map [icicle-vardoc]
875 '(menu-item "+ Variable with Name, Doc..." icicle-vardoc
876 :help "Choose a variable description"))
877 (define-key icicle-describe-menu-map [icicle-describe-var-w-val-satisfying]
878 '(menu-item "+ Variable with Value Satifying..." icicle-describe-var-w-val-satisfying
879 :help "Describe a variable that satisfies a given predicate"))
880 (define-key icicle-describe-menu-map [icicle-describe-option-of-type]
881 '(menu-item "+ Option of Type..." icicle-describe-option-of-type
882 :help "Describe a user option that was defined with a given `defcustom' type"))
883 (define-key icicle-describe-menu-map [icicle-where-is]
884 '(menu-item "+ Where Is..." icicle-where-is
885 :help "Show keyboard/menu/mouse sequences that invoke specified command"))
886 (when icicle-touche-pas-aux-menus-flag
887 (define-key icicle-menu-map [icicle-separator-about] '("--")))
888
889
890 ;; `Search' and `Emacs Tags' (or `Tags') -------------------------
891 (cond ((not icicle-touche-pas-aux-menus-flag)
892 (cond ((boundp 'menu-bar-search-tags-menu) ; `Tags' menu defined in `menu-bar+.el'.
893 (defvar icicle-search-menu-map (make-sparse-keymap)
894 "`Search' > `Icicles' menu.")
895 (define-key menu-bar-search-menu [icicles]
896 (list 'menu-item "Icicles" icicle-search-menu-map :visible 'icicle-mode))
897 (defvar icicle-search-tags-menu-map (make-sparse-keymap)
898 "`Search' > `Tags' > `Icicles' menu.")
899 (define-key menu-bar-search-tags-menu [icicles]
900 (list 'menu-item "Icicles" icicle-search-tags-menu-map :visible 'icicle-mode)))
901 (t
902 (defvar icicle-search-menu-map (make-sparse-keymap)
903 "`Search' > `Icicles' menu.")
904 (define-key menu-bar-search-menu [icicles]
905 (list 'menu-item "Icicles" icicle-search-menu-map :visible 'icicle-mode))
906 (defvar icicle-search-tags-menu-map (make-sparse-keymap)
907 "`Search' > `Icicles' > `Emacs Tags' menu.")
908 (define-key icicle-search-menu-map [emacs-tags]
909 (list 'menu-item "Emacs Tags" icicle-search-tags-menu-map
910 :visible 'icicle-mode)))))
911 (t
912 (defvar icicle-search-menu-map (make-sparse-keymap)
913 "`Icicles' > `Search' menu.")
914 (define-key icicle-menu-map [search]
915 (list 'menu-item "Search" icicle-search-menu-map))
916 (defvar icicle-search-tags-menu-map (make-sparse-keymap)
917 "`Icicles' > `Search' > `Emacs Tags' menu.")
918 (define-key icicle-search-menu-map [emacs-tags]
919 (list 'menu-item "Emacs Tags" icicle-search-tags-menu-map :visible 'icicle-mode))))
920
921 ;; `Go To' -------------------------------------------------------
922 (cond ((not icicle-touche-pas-aux-menus-flag)
923 (cond ((boundp 'menu-bar-goto-menu)
924 (defvar icicle-search-goto-menu-map (make-sparse-keymap)
925 "`Go To' > `Icicles' menu.")
926 (define-key menu-bar-goto-menu [icicles]
927 (list 'menu-item "Icicles" icicle-search-goto-menu-map)))
928 (t
929 (defvar icicle-search-goto-menu-map (make-sparse-keymap)
930 "Icicles `Go To' submenu of `Search' menu.")
931 (define-key icicle-search-menu-map [goto]
932 (list 'menu-item "Go To" icicle-search-goto-menu-map)))))
933 (t
934 (defvar icicle-search-goto-menu-map (make-sparse-keymap)
935 "`Icicles' > `Go To' menu.")
936 (define-key icicle-menu-map [search]
937 (list 'menu-item "Go To" icicle-search-menu-map))))
938
939 (define-key icicle-search-goto-menu-map [icicle-goto-global-marker]
940 '(menu-item "+ Global Marker..." icicle-goto-global-marker
941 :enable (consp (icicle-markers global-mark-ring)) :keys "C-- C-x C-SPC"
942 :help "Go to a global marker, choosing it by the line that includes it"))
943 (define-key icicle-search-goto-menu-map [icicle-goto-marker]
944 '(menu-item "+ Marker..." icicle-goto-marker
945 :enable (mark t) :keys "C-- C-SPC"
946 :help "Go to a marker in this buffer, choosing it by the line that includes it"))
947 (define-key icicle-search-goto-menu-map [icicle-select-bookmarked-region]
948 '(menu-item "+ Select Bookmarked Region..." icicle-select-bookmarked-region
949 :enable (featurep 'bookmark+) :keys "C-u C-x C-x"
950 :help "Jump to a bookmarked region in other window, and select (activate) it"))
951
952 ;; `Go To' > `Definition' menu.
953 (defvar icicle-search-goto-imenu-menu-map (make-sparse-keymap)
954 "Icicles `Definition' submenu of `Go To' menu.")
955 (define-key icicle-search-goto-menu-map [imenu]
956 (list 'menu-item "Definition" icicle-search-goto-imenu-menu-map
957 :visible 'imenu-generic-expression))
958
959 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-key-explicit-map]
960 '(menu-item "+ Key in Map..." icicle-imenu-key-explicit-map
961 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
962 :help "Go to a key definition in some map, using `icicle-search'"))
963 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-key-implicit-map]
964 '(menu-item "+ Key..." icicle-imenu-key-implicit-map
965 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
966 :help "Go to a (global) key definition using `icicle-search'"))
967 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-variable]
968 '(menu-item "+ Variable..." icicle-imenu-variable
969 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
970 :help "Go to a variable definition using `icicle-search'"))
971 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-user-option]
972 '(menu-item "+ User Option..." icicle-imenu-user-option
973 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
974 :help "Go to an option definition using `icicle-search'"))
975 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-face]
976 '(menu-item "+ Face..." icicle-imenu-face
977 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
978 :help "Go to a face definition using `icicle-search'"))
979 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-macro]
980 '(menu-item "+ Macro..." icicle-imenu-macro
981 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
982 :help "Go to a Lisp macro definition using `icicle-search'"))
983 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-non-interactive-function]
984 '(menu-item "+ Non-Interactive Function..." icicle-imenu-non-interactive-function
985 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
986 :help "Go to a non-command function definition using `icicle-search'"))
987 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu-command]
988 '(menu-item "+ Command..." icicle-imenu-command
989 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
990 :help "Go to a command definition using `icicle-search'"))
991 (define-key icicle-search-goto-imenu-menu-map [icicle-imenu]
992 '(menu-item "+ Any..." icicle-imenu
993 :enable imenu-generic-expression :help "Go to a definition using `icicle-search'"))
994
995 ;; `Search' > `Emacs Tags' (or `Tags') menu
996 (define-key icicle-search-tags-menu-map [icicle-tags-search]
997 '(menu-item "+ Search Tagged Files ..." icicle-tags-search
998 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
999 :help "Search all source files listed in tags tables for matches for a regexp"))
1000 (define-key icicle-search-tags-menu-map [icicle-pop-tag-mark]
1001 '(menu-item "+ Back (Pop Tag Mark)" icicle-pop-tag-mark
1002 :enable (and (boundp 'find-tag-marker-ring)
1003 (not (ring-empty-p find-tag-marker-ring))
1004 (not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
1005 :help "Pop back to where `M-.' was last invoked"))
1006 (define-key icicle-search-tags-menu-map [icicle-find-first-tag-other-window]
1007 '(menu-item "+ Find First Tag ..." icicle-find-first-tag-other-window
1008 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1009 :help "Find first tag in current tags table whose name matches your input"))
1010 (define-key icicle-search-tags-menu-map [icicle-find-tag]
1011 '(menu-item "+ Find Tag ..." icicle-find-tag
1012 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1013 :help "Navigate among all tags that match a regexp"))
1014
1015 ;; `Search' menu
1016 (define-key icicle-search-menu-map [icicle-search-highlight-cleanup]
1017 '(menu-item "Remove Icicle-Search Highlighting..." icicle-search-highlight-cleanup
1018 :enable (or icicle-search-overlays
1019 (overlayp icicle-search-current-overlay)
1020 (overlayp icicle-search-refined-overlays) icicle-search-refined-overlays)
1021 :help "Remove all highlighting from the last use of `icicle-search'"))
1022 (define-key icicle-search-menu-map [icicle-search-define-replacement]
1023 '(menu-item "Define Replacement String..." icicle-search-define-replacement
1024 :help "Set the replacement string for use in `icicle-search'"))
1025 (define-key icicle-search-menu-map [separator-search-1] '("--"))
1026
1027 (define-key icicle-search-menu-map [icicle-compilation-search]
1028 '(menu-item "+ Search Compilation/Grep Hits (Regexp)..."
1029 icicle-compilation-search
1030 :visible (and (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1031 (condition-case nil (eq (current-buffer) (compilation-find-buffer))
1032 (error nil)))
1033 :keys "C-`" :help "Icicles search, showing the matching compilation-buffer hit"))
1034 (define-key icicle-search-menu-map [icicle-grep-saved-file-candidates]
1035 '(menu-item "Grep Saved File-Name Candidates..."
1036 icicle-grep-saved-file-candidates
1037 :enable icicle-saved-completion-candidates
1038 :help "Run `grep' on the set of completion candidates saved using `C-M->'"))
1039 (define-key icicle-search-menu-map [icicle-tags-search]
1040 '(menu-item "+ Search Tagged Files ..." icicle-tags-search
1041 :help "Search all source files listed in tags tables for matches for a regexp"))
1042 (define-key icicle-search-menu-map [icicle-search-file]
1043 '(menu-item "+ Search Files (Regexp)..." icicle-search-file
1044 :help "Search multiple files completely"))
1045 (define-key icicle-search-menu-map [icicle-search-buffer]
1046 '(menu-item "+ Search Buffers (Regexp)..." icicle-search-buffer
1047 :help "Search multiple buffers completely"))
1048 (define-key icicle-search-menu-map [separator-search-2] '("--"))
1049
1050 (define-key icicle-search-menu-map [icicle-search-overlay-property]
1051 '(menu-item "+ Search Overlay Property..." icicle-search-overlay-property
1052 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1053 :help "Search for an overlay that has a property with a certain value"))
1054 (define-key icicle-search-menu-map [icicle-search-char-property]
1055 '(menu-item "+ Search Character Property..." icicle-search-char-property
1056 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1057 :help "Search for text that has a property with a certain value"))
1058 (define-key icicle-search-menu-map [icicle-search-text-property]
1059 '(menu-item "+ Search Text Property..." icicle-search-text-property
1060 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1061 :help "Search for text or overlay that has a property with a certain value"))
1062 (define-key icicle-search-menu-map [separator-search-3] '("--"))
1063
1064 (define-key icicle-search-menu-map [icicle-search-xml-element-text-node]
1065 '(menu-item "+ Search XML text() Nodes..." icicle-search-xml-element-text-node
1066 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1067 :help "Icicles search with text() nodes of ELEMENTs as search contexts"))
1068 (define-key icicle-search-menu-map [icicle-search-xml-element]
1069 '(menu-item "+ Search XML Elements..." icicle-search-xml-element
1070 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1071 :help "Icicles search with XML ELEMENTs as search contexts - you are prompted for ELEMENT"))
1072 (define-key icicle-search-menu-map [icicle-search-pages]
1073 '(menu-item "+ Search Pages..." icicle-search-pages
1074 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1075 :help "Icicles search with pages as search contexts"))
1076 (define-key icicle-search-menu-map [icicle-search-paragraphs]
1077 '(menu-item "+ Search Paragraphs..." icicle-search-paragraphs
1078 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1079 :help "Icicles search with paragraphs as search contexts"))
1080 (define-key icicle-search-menu-map [icicle-search-sentences]
1081 '(menu-item "+ Search Sentences..." icicle-search-sentences
1082 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1083 :help "Icicles search with sentences as search contexts"))
1084 (define-key icicle-search-menu-map [icicle-occur]
1085 '(menu-item "+ Search Lines (`icicle-occur')..." icicle-occur
1086 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1087 :help "Icicles search with lines as search contexts"))
1088 (define-key icicle-search-menu-map [icicle-search-thing]
1089 '(menu-item "+ Search Things..." icicle-search-thing
1090 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1091 :help "Icicles search with THINGs as search contexts - you are prompted for THING"))
1092 (define-key icicle-search-menu-map [separator-search-4] '("--"))
1093
1094 (define-key icicle-search-menu-map [icicle-search-word]
1095 '(menu-item "+ Search for Word..." icicle-search-word
1096 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1097 :help "Whole-word Icicles search"))
1098 (define-key icicle-search-menu-map [icicle-search-w-isearch-string]
1099 '(menu-item "+ Search with Isearch Contexts..." icicle-search-w-isearch-string
1100 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1101 :help "Icicles search with search contexts that match a previous Isearch string"))
1102 (define-key icicle-search-menu-map [icicle-search-keywords]
1103 '(menu-item "+ Search with Keywords (Regexps)..." icicle-search-keywords
1104 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1105 :help "Icicles search with one or more keywords, which can each be a regexp"))
1106 (define-key icicle-search-menu-map [icicle-search]
1107 '(menu-item "+ Search (Regexp)..." icicle-search
1108 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1109 :keys "C-`"
1110 :help "Icicles search for regexp matches, with completion, cycling, & hit replacement"))
1111
1112 ;; `M-s M-s m' - mode-specific search
1113 (define-key icicle-search-menu-map [icicle-search-dired-marked-recursive]
1114 '(menu-item "+ Search Marked, Here and Below..." icicle-search-dired-marked-recursive
1115 :help "Search the marked files, including those in marked subdirs"
1116 :visible (eq major-mode 'dired-mode)))
1117 (define-key icicle-search-menu-map [icicle-search-bookmark-list-marked]
1118 '(menu-item "+ Search Marked..." icicle-search-bookmark-list-marked
1119 :help "Search the target files of the marked bookmarks"
1120 :visible (eq major-mode 'bookmark-bmenu-mode)))
1121 (define-key icicle-search-menu-map [icicle-search-ibuffer-marked]
1122 '(menu-item "+ Search Marked..." icicle-search-ibuffer-marked
1123 :help "Search the marked files" :visible (eq major-mode 'ibuffer-mode)))
1124 (define-key icicle-search-menu-map [icicle-search-buff-menu-marked]
1125 '(menu-item "+ Search Marked..." icicle-search-buff-menu-marked
1126 :help "Search the marked files" :visible (eq major-mode 'Buffer-menu-mode)))
1127
1128 ;; `Search' > `Bookmarks' menu.
1129 (defvar icicle-search-bookmarks-menu-map (make-sparse-keymap)
1130 "Icicles `Bookmarks' submenu of `Search' menu.")
1131 (define-key icicle-search-menu-map [bookmarks]
1132 (list 'menu-item "Bookmarks" icicle-search-bookmarks-menu-map :visible 'icicle-mode))
1133
1134 (define-key icicle-search-bookmarks-menu-map [icicle-search-w3m-bookmark]
1135 '(menu-item "+ W3M Bookmarks..." icicle-search-w3m-bookmark
1136 :visible (featurep 'bookmark+)
1137 :help "Search text of W3M bookmarks"))
1138 (define-key icicle-search-bookmarks-menu-map [icicle-search-url-bookmark]
1139 '(menu-item "+ URL Bookmarks..." icicle-search-url-bookmark
1140 :visible (featurep 'bookmark+)
1141 :help "Search text of bookmarks whose targets are defined by URLs"))
1142 (define-key icicle-search-bookmarks-menu-map [icicle-search-gnus-bookmark]
1143 '(menu-item "+ Gnus Bookmarks..." icicle-search-gnus-bookmark
1144 :visible (featurep 'bookmark+)
1145 :help "Search text of Gnus bookmarks"))
1146 (define-key icicle-search-bookmarks-menu-map [icicle-search-man-bookmark]
1147 '(menu-item "+ Man Bookmarks..." icicle-search-man-bookmark
1148 :visible (featurep 'bookmark+)
1149 :help "Search text of `man' bookmarks"))
1150 (define-key icicle-search-bookmarks-menu-map [icicle-search-info-bookmark]
1151 '(menu-item "+ Info Bookmarks..." icicle-search-info-bookmark
1152 :visible (featurep 'bookmark+)
1153 :help "Search text of Info (manual) bookmarks"))
1154 (define-key icicle-search-bookmarks-menu-map [icicle-search-bookmark-list-bookmark]
1155 '(menu-item "+ Bookmark-List Bookmarks..." icicle-search-bookmark-list-bookmark
1156 :visible (featurep 'bookmark+)
1157 :help "Search text of bookmark-list bookmarks"))
1158 (define-key icicle-search-bookmarks-menu-map [icicle-search-dired-bookmark]
1159 '(menu-item "+ Dired Bookmarks..." icicle-search-dired-bookmark
1160 :visible (featurep 'bookmark+)
1161 :help "Search buffers of Dired bookmarks"))
1162 (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-6]
1163 '(menu-item "--" nil :visible (featurep 'bookmark+)))
1164
1165 (define-key icicle-search-bookmarks-menu-map [icicle-search-some-tags-regexp-bookmark]
1166 '(menu-item "+ Bookmarks Tagged Some Regexp..." icicle-search-some-tags-regexp-bookmark
1167 :visible (featurep 'bookmark+)
1168 :help "Search text of bookmarks some of whose tags matches a regexp"))
1169 (define-key icicle-search-bookmarks-menu-map [icicle-search-all-tags-regexp-bookmark]
1170 '(menu-item "+ Bookmarks Tagged All Regexp..." icicle-search-all-tags-regexp-bookmark
1171 :visible (featurep 'bookmark+)
1172 :help "Search text of bookmarks all of whose tags match a regexp"))
1173 (define-key icicle-search-bookmarks-menu-map [icicle-search-some-tags-bookmark]
1174 '(menu-item "+ Bookmarks Tagged Some..." icicle-search-some-tags-bookmark
1175 :visible (featurep 'bookmark+)
1176 :help "Search text of bookmarks some of whose tags are among those tags you choose"))
1177 (define-key icicle-search-bookmarks-menu-map [icicle-search-all-tags-bookmark]
1178 '(menu-item "+ Bookmarks Tagged All..." icicle-search-all-tags-bookmark
1179 :visible (featurep 'bookmark+)
1180 :help "Search text of bookmarks all of whose tags are among those tags you choose"))
1181 (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-5]
1182 '(menu-item "--" nil :visible (featurep 'bookmark+)))
1183
1184 (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-5]
1185 '(menu-item "--" nil :visible (featurep 'bookmark+)))
1186
1187 (define-key icicle-search-bookmarks-menu-map [icicle-search-non-file-bookmark]
1188 '(menu-item "+ Non-File Bookmarks..." icicle-search-non-file-bookmark
1189 :visible (featurep 'bookmark+)
1190 :help "Search text of bookmarks whose targets are not files - e.g., buffers"))
1191 (define-key icicle-search-bookmarks-menu-map [icicle-search-remote-file-bookmark]
1192 '(menu-item "+ Remote File Bookmarks..." icicle-search-remote-file-bookmark
1193 :visible (featurep 'bookmark+)
1194 :help "Search text of bookmarks whose targets are remote files"))
1195 (define-key icicle-search-bookmarks-menu-map [icicle-search-local-file-bookmark]
1196 '(menu-item "+ Local File Bookmarks..." icicle-search-local-file-bookmark
1197 :visible (featurep 'bookmark+)
1198 :help "Search text of bookmarks whose targets are local files"))
1199 (define-key icicle-search-bookmarks-menu-map [icicle-search-file-bookmark]
1200 '(menu-item "+ File Bookmarks..." icicle-search-file-bookmark
1201 :visible (featurep 'bookmark+)
1202 :help "Search text of bookmarks whose targets are files"))
1203 (define-key icicle-search-bookmarks-menu-map [icicle-search-autofile-bookmark]
1204 '(menu-item "+ Autofile Bookmarks..." icicle-search-autofile-bookmark
1205 :visible (featurep 'bookmark+)
1206 :help "Search text of autofile bookmarks: files bookmarked under their own names"))
1207 (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-3]
1208 '(menu-item "--" nil :visible (featurep 'bookmark+)))
1209
1210 (define-key icicle-search-bookmarks-menu-map [icicle-search-specific-files-bookmark]
1211 '(menu-item "+ Bookmarks for Specific Files..." icicle-search-specific-files-bookmark
1212 :visible (featurep 'bookmark+)
1213 :help "Search text of bookmarks defined for specific files that you choose"))
1214 (define-key icicle-search-bookmarks-menu-map [icicle-search-specific-buffers-bookmark]
1215 '(menu-item "+ Bookmarks for Specific Buffers..." icicle-search-specific-buffers-bookmark
1216 :visible (featurep 'bookmark+)
1217 :help "Search text of bookmarks defined for specific buffers that you choose"))
1218 (define-key icicle-search-bookmarks-menu-map [icicle-search-this-buffer-bookmark]
1219 '(menu-item "+ Bookmarks for This Buffer..." icicle-search-this-buffer-bookmark
1220 :visible (featurep 'bookmark+)
1221 :help "Search text of bookmarks defined for this buffer"))
1222 (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-2]
1223 '(menu-item "--" nil :visible (featurep 'bookmark+)))
1224
1225 (define-key icicle-search-bookmarks-menu-map [icicle-search-temporary-bookmark]
1226 '(menu-item "+ Temporary Bookmarks..." icicle-search-temporary-bookmark
1227 :visible (featurep 'bookmark+)
1228 :help "Search text of temporary bookmarks"))
1229 (define-key icicle-search-bookmarks-menu-map [icicle-search-autonamed-bookmark]
1230 '(menu-item "+ Autonamed Bookmarks..." icicle-search-autonamed-bookmark
1231 :visible (featurep 'bookmark+)
1232 :help "Search text of autonamed bookmarks"))
1233 (define-key icicle-search-bookmarks-menu-map [separator-search-bookmarks-1]
1234 '(menu-item "--" nil :visible (featurep 'bookmark+)))
1235
1236 (define-key icicle-search-bookmarks-menu-map [icicle-search-region-bookmark]
1237 '(menu-item "+ Bookmarked Regions..." icicle-search-region-bookmark
1238 :visible (featurep 'bookmark+)
1239 :help "Search bookmarked regions"))
1240 (define-key icicle-search-bookmarks-menu-map [icicle-search-bookmark]
1241 '(menu-item "+ Bookmarks..." icicle-search-bookmark
1242 :help "Search bookmarked text"))
1243 (define-key icicle-search-bookmarks-menu-map [icicle-search-bookmarks-together]
1244 '(menu-item "+ Bookmarks Together..." icicle-search-bookmarks-together
1245 :help "Search text of bookmarks, taken together" :keys "C-u C-`"))
1246
1247 ;; `Search' > `Definitions' menu.
1248 (defvar icicle-search-imenu-menu-map (make-sparse-keymap)
1249 "Icicles `Definitions' submenu of `Search' menu.")
1250 (define-key icicle-search-menu-map [imenu]
1251 (list 'menu-item "Definitions" icicle-search-imenu-menu-map
1252 :visible 'imenu-generic-expression))
1253
1254 (define-key icicle-search-imenu-menu-map [icicle-imenu-key-explicit-map-full]
1255 '(menu-item "+ Key in Map..." icicle-imenu-key-explicit-map-full
1256 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1257 :help "Search a key definition in some map, using `icicle-search'"))
1258 (define-key icicle-search-imenu-menu-map [icicle-imenu-key-implicit-map-full]
1259 '(menu-item "+ Key..." icicle-imenu-key-implicit-map-full
1260 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1261 :help "Search a global key definition using `icicle-search'"))
1262 (define-key icicle-search-imenu-menu-map [icicle-imenu-variable-full]
1263 '(menu-item "+ Variable..." icicle-imenu-variable-full
1264 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1265 :help "Search a variable definition using `icicle-search'"))
1266 (define-key icicle-search-imenu-menu-map [icicle-imenu-user-option-full]
1267 '(menu-item "+ User Option..." icicle-imenu-user-option-full
1268 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1269 :help "Search an option definition using `icicle-search'"))
1270 (define-key icicle-search-imenu-menu-map [icicle-imenu-face-full]
1271 '(menu-item "+ Face..." icicle-imenu-face-full
1272 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1273 :help "Search a face definition using `icicle-search'"))
1274 (define-key icicle-search-imenu-menu-map [icicle-imenu-macro-full]
1275 '(menu-item "+ Macro..." icicle-imenu-macro-full
1276 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1277 :help "Search a Lisp macro definition using `icicle-search'"))
1278 (define-key icicle-search-imenu-menu-map [icicle-imenu-non-interactive-function-full]
1279 '(menu-item "+ Non-Interactive Function..." icicle-imenu-non-interactive-function-full
1280 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1281 :help "Search a non-command function definition using `icicle-search'"))
1282 (define-key icicle-search-imenu-menu-map [icicle-imenu-command-full]
1283 '(menu-item "+ Command..." icicle-imenu-command-full
1284 :enable (and imenu-generic-expression (eq major-mode 'emacs-lisp-mode))
1285 :help "Search a command definition using `icicle-search'"))
1286 (define-key icicle-search-imenu-menu-map [icicle-imenu-full]
1287 '(menu-item "+ Any..." icicle-imenu-full
1288 :enable imenu-generic-expression :help "Search a definition using `icicle-search'"))
1289
1290
1291 ;; `Frames' ----------------------------------------------------
1292 (cond ((and (not icicle-touche-pas-aux-menus-flag)
1293 (boundp 'menu-bar-frames-menu)) ; Use `Frames' menu, defined in `menu-bar+.el'.
1294 (defvar icicle-frames-menu-map (make-sparse-keymap)
1295 "`Frames' > `Icicles' submenu.")
1296 (define-key menu-bar-frames-menu [icicles]
1297 (list 'menu-item "Icicles" icicle-frames-menu-map :visible 'icicle-mode)))
1298 (t
1299 (defvar icicle-frames-menu-map (make-sparse-keymap)
1300 "`Icicles' > `Frames' submenu.")
1301 (define-key icicle-menu-map [frames]
1302 (list 'menu-item "Frames" icicle-frames-menu-map))))
1303
1304 (define-key icicle-frames-menu-map [icicle-font]
1305 '(menu-item "+ Change Font of Frame..." icicle-font
1306 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1307 :help "Change font of current frame."))
1308 (define-key icicle-frames-menu-map [icicle-frame-fg]
1309 '(menu-item "+ Change Foreground of Frame..." icicle-frame-fg
1310 :visible (fboundp 'icicle-frame-fg) ; Requires `hexrgb.el'
1311 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1312 :help "Change foreground of current frame."))
1313 (define-key icicle-frames-menu-map [icicle-frame-bg]
1314 '(menu-item "+ Change Background of Frame..." icicle-frame-bg
1315 :visible (fboundp 'icicle-frame-bg) ; Requires `hexrgb.el'
1316 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1317 :help "Change background of current frame."))
1318
1319
1320 ;; `Bookmarks' ---------------------------------------------------
1321 (require 'bookmark) ; `bookmark-buffer-name' is not autoloaded.
1322 (cond ((not icicle-touche-pas-aux-menus-flag)
1323 (cond ((boundp 'bmkp-jump-menu)
1324
1325 ;; Bookmark+: `Bookmarks' > `Jump To'.
1326 ;; Use `copy-keymap' so that turning off Icicle mode restores the ordinary commands.
1327 (defvar icicle-bookmark-menu-map (copy-keymap bmkp-jump-menu)
1328 "`Bookmarks' > `Jump To' > `Icicles' submenu.")
1329
1330 ;; Bookmark+: `Bookmarks' > `Jump To' > `With Tags'.
1331 ;; Use `copy-keymap' so that turning off Icicle mode restores the ordinary commands.
1332 (defvar icicle-bookmark-with-tags-menu-map (copy-keymap bmkp-jump-tags-menu)
1333 "`Bookmarks' > `Jump To' > `With Tags' > `Icicles' submenu."))
1334 (t ; Vanilla `bookmark.el' only, not Bookmark+.
1335 (defvar icicle-bookmark-menu-map (make-sparse-keymap)
1336 "`Bookmarks' > `Icicles' submenu.")
1337 (define-key menu-bar-bookmark-map [icicles]
1338 (list 'menu-item "Icicles" icicle-bookmark-menu-map :visible 'icicle-mode))
1339 (defvar icicle-bookmark-with-tags-menu-map (make-sparse-keymap)
1340 "For tags commands on `icicle-bookmark-menu-map'.")
1341 (setq icicle-bookmark-with-tags-menu-map icicle-bookmark-menu-map))))
1342 (t
1343 (defvar icicle-bookmark-menu-map (make-sparse-keymap)
1344 "`Icicles' > `Bookmarks' submenu.")
1345 (define-key icicle-menu-map [bookmarks]
1346 (list 'menu-item "Bookmarks" icicle-bookmark-menu-map))
1347 (defvar icicle-bookmark-with-tags-menu-map (make-sparse-keymap)
1348 "For tags commands on `icicle-bookmark-menu-map'.")
1349 (setq icicle-bookmark-with-tags-menu-map icicle-bookmark-menu-map)))
1350
1351 (when (featurep 'bookmark+)
1352 (define-key icicle-bookmark-with-tags-menu-map
1353 [bmkp-file-this-dir-all-tags-regexp-jump-other-window]
1354 '(menu-item "File This Dir, All Tags Matching Regexp..."
1355 icicle-bookmark-file-this-dir-all-tags-regexp-other-window
1356 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1357 :help "Jump to a file bookmark for this dir, where each tag matches a regexp"))
1358 (define-key icicle-bookmark-with-tags-menu-map
1359 [bmkp-file-this-dir-some-tags-regexp-jump-other-window]
1360 '(menu-item "File This Dir, Any Tag Matching Regexp..."
1361 icicle-bookmark-file-this-dir-some-tags-regexp-other-window
1362 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1363 :help "Jump to a file bookmark for this dir, where some tag matches a regexp"))
1364 (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-this-dir-all-tags-jump-other-window]
1365 '(menu-item "File This Dir, All Tags in Set..."
1366 icicle-bookmark-file-this-dir-all-tags-other-window
1367 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1368 :help "Jump to a file bookmark for this dir, which has all of a set of tags"))
1369 (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-this-dir-some-tags-jump-other-window]
1370 '(menu-item "File This Dir, Any Tag in Set..."
1371 icicle-bookmark-file-this-dir-some-tags-other-window
1372 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1373 :help "Jump to a file bookmark for this dir, which has some of a set of tags"))
1374 (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-all-tags-regexp-jump-other-window]
1375 '(menu-item "File, All Tags Matching Regexp..."
1376 icicle-bookmark-file-all-tags-regexp-other-window
1377 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1378 :help "Jump to a file or dir bookmark where each tag matches a regexp"))
1379 (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-some-tags-regexp-jump-other-window]
1380 '(menu-item "File, Any Tag Matching Regexp..."
1381 icicle-bookmark-file-some-tags-regexp-other-window
1382 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1383 :help "Jump to a file or dir bookmark where at least one tag matches a regexp"))
1384 (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-all-tags-jump-other-window]
1385 '(menu-item "File, All Tags in Set..." icicle-bookmark-file-all-tags-other-window
1386 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1387 :help "Jump to a file or dir bookmark that has all of a set of tags"))
1388 (define-key icicle-bookmark-with-tags-menu-map [bmkp-file-some-tags-jump-other-window]
1389 '(menu-item "File, Any Tag in Set..." icicle-bookmark-file-some-tags-other-window
1390 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1391 :help "Jump to a file or dir bookmark that has some of a set of tags"))
1392 (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-all-tags-regexp-jump-other-window]
1393 '(menu-item "Autofile, All Tags Matching Regexp..."
1394 icicle-bookmark-autofile-all-tags-regexp-other-window
1395 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1396 :help "Jump to an autofile bookmark where each tag matches a regexp"))
1397 (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-some-tags-regexp-jump-other-window]
1398 '(menu-item "Autofile, Any Tag Matching Regexp..."
1399 icicle-bookmark-autofile-some-tags-regexp-other-window
1400 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1401 :help "Jump to an autofile bookmark where at least one tag matches a regexp"))
1402 (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-all-tags-jump-other-window]
1403 '(menu-item "Autofile, All Tags in Set..."
1404 icicle-bookmark-autofile-all-tags-other-window
1405 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1406 :help "Jump to an autofile bookmark that has all of a set of tags"))
1407 (define-key icicle-bookmark-with-tags-menu-map [bmkp-autofile-some-tags-jump-other-window]
1408 '(menu-item "Autofile, Any Tag in Set..."
1409 icicle-bookmark-autofile-some-tags-other-window
1410 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1411 :help "Jump to an autofile bookmark that has some of a set of tags"))
1412 (define-key icicle-bookmark-with-tags-menu-map [bmkp-all-tags-regexp-jump-other-window]
1413 '(menu-item "All Tags Matching Regexp..." icicle-bookmark-all-tags-regexp-other-window
1414 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1415 :help "Jump to a bookmark that has each tag matching a regexp that you enter"))
1416 (define-key icicle-bookmark-with-tags-menu-map [bmkp-some-tags-regexp-jump-other-window]
1417 '(menu-item "Any Tag Matching Regexp..." icicle-bookmark-some-tags-regexp-other-window
1418 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1419 :help "Jump to a bookmark with at least one tag matching a regexp"))
1420 (define-key icicle-bookmark-with-tags-menu-map [bmkp-all-tags-jump-other-window]
1421 '(menu-item "All Tags in Set..." icicle-bookmark-all-tags-other-window
1422 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1423 :help "Jump to a bookmark that has all of a set of tags that you enter"))
1424 (define-key icicle-bookmark-with-tags-menu-map [bmkp-some-tags-jump-other-window]
1425 '(menu-item "Any Tag in Set..." icicle-bookmark-some-tags-other-window
1426 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1427 :help "Jump to a bookmark that has some of a set of tags that you enter"))
1428 (define-key icicle-bookmark-menu-map [bmkp-temporary-jump-other-window]
1429 '(menu-item "+ Jump to Temporary Bookmark..." icicle-bookmark-temporary-other-window
1430 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1431 :help "Jump to a temporary bookmark"))
1432 (define-key icicle-bookmark-menu-map [bmkp-autofile-jump-other-window]
1433 '(menu-item "+ Jump to Autofile Bookmark..." icicle-bookmark-autofile-other-window
1434 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1435 :help "Jump to an autofile bookmark"))
1436 (define-key icicle-bookmark-menu-map [bmkp-autonamed-this-buffer-jump]
1437 '(menu-item "+ Jump to Autonamed Bookmark for This Buffer..."
1438 icicle-bookmark-autonamed-this-buffer-other-window
1439 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1440 :help "Jump to an autonamed bookmark for this buffer"))
1441 (define-key icicle-bookmark-menu-map [bmkp-autonamed-jump-other-window]
1442 '(menu-item "+ Jump to Autonamed Bookmark..."
1443 icicle-bookmark-autonamed-other-window
1444 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1445 :help "Jump to an autonamed bookmark"))
1446 (define-key icicle-bookmark-menu-map [bmkp-specific-files-jump-other-window]
1447 '(menu-item "+ Jump to Bookmark for Specific Files..."
1448 icicle-bookmark-specific-files-other-window
1449 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1450 :help "Jump to bookmarks for specific files that you choose"))
1451 (define-key icicle-bookmark-menu-map [bmkp-specific-buffers-jump-other-window]
1452 '(menu-item "+ Jump to Bookmark for Specific Buffers..."
1453 icicle-bookmark-specific-buffers-other-window
1454 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1455 :help "Jump to bookmarks for specific buffers that you choose"))
1456 (define-key icicle-bookmark-menu-map [bmkp-this-buffer-jump]
1457 '(menu-item "+ Jump to Bookmark for This Buffer..."
1458 icicle-bookmark-this-buffer-other-window
1459 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1460 :help "Jump to a bookmark for this buffer"))
1461 (define-key icicle-bookmark-menu-map [bmkp-url-jump-other-window]
1462 '(menu-item "+ Jump to URL Bookmark..." icicle-bookmark-url-other-window
1463 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1464 :help "Jump to a URL bookmark"))
1465 (define-key icicle-bookmark-menu-map [bmkp-gnus-jump-other-window]
1466 '(menu-item "+ Jump to Gnus Bookmark..." icicle-bookmark-gnus-other-window
1467 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1468 :help "Jump to a Gnus bookmark"))
1469 (define-key icicle-bookmark-menu-map [bmkp-man-jump-other-window]
1470 '(menu-item "+ Jump to `man' Bookmark..." icicle-bookmark-man-other-window
1471 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1472 :help "Jump to a `man'-page bookmark"))
1473 (define-key icicle-bookmark-menu-map [bmkp-info-jump-other-window]
1474 '(menu-item "+ Jump to Info Bookmark..." icicle-bookmark-info-other-window
1475 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1476 :help "Jump to an Info bookmark"))
1477 (define-key icicle-bookmark-menu-map [bmkp-image-jump-other-window]
1478 '(menu-item "+ Jump to Image Bookmark..."
1479 icicle-bookmark-image-other-window
1480 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1481 :help "Jump to an image bookmark"))
1482 (define-key icicle-bookmark-menu-map [bmkp-non-file-jump-other-window]
1483 '(menu-item "+ Jump to Buffer (Non-File) Bookmark..."
1484 icicle-bookmark-non-file-other-window
1485 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1486 :help "Jump to a buffer (i.e., a non-file) bookmark"))
1487 (define-key icicle-bookmark-menu-map [bmkp-region-jump-other-window]
1488 '(menu-item "+ Jump to Region Bookmark..." icicle-bookmark-region-other-window
1489 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1490 :help "Jump to a bookmark and activate its recorded region"))
1491 (define-key icicle-bookmark-menu-map [bmkp-remote-file-jump-other-window]
1492 '(menu-item "+ Jump to Remote-File Bookmark..."
1493 icicle-bookmark-remote-file-other-window
1494 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1495 :help "Jump to a remote-file bookmark"))
1496 (define-key icicle-bookmark-menu-map [bmkp-local-file-jump-other-window]
1497 '(menu-item "+ Jump to Local-File Bookmark..."
1498 icicle-bookmark-local-file-other-window
1499 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1500 :help "Jump to a local-file bookmark"))
1501 (define-key icicle-bookmark-menu-map [bmkp-file-jump-other-window]
1502 '(menu-item "+ Jump to File Bookmark..." icicle-bookmark-file-other-window
1503 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1504 :help "Jump to a file bookmark"))
1505 (define-key icicle-bookmark-menu-map [bmkp-dired-jump-other-window]
1506 '(menu-item "+ Jump to Dired Bookmark..." icicle-bookmark-dired-other-window
1507 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1508 :help "Jump to a Dired bookmark"))
1509 (define-key icicle-bookmark-menu-map [bmkp-bookmark-file-jump]
1510 '(menu-item "+ Jump to Bookmark-File Bookmark..."
1511 icicle-bookmark-bookmark-file
1512 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1513 :help "Jump to a bookmark-file bookmark"))
1514 (define-key icicle-bookmark-menu-map [bmkp-bookmark-list-jump]
1515 '(menu-item "+ Jump to Bookmark-List Bookmark..."
1516 icicle-bookmark-bookmark-list
1517 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1518 :help "Jump to a bookmark-list bookmark"))
1519 (define-key icicle-bookmark-menu-map [bmkp-desktop-jump]
1520 '(menu-item "+ Jump to Desktop Bookmark..." icicle-bookmark-desktop
1521 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1522 :help "Jump to an Emacs desktop bookmark")))
1523
1524 (define-key icicle-bookmark-menu-map [bookmark-jump-other-window]
1525 '(menu-item "+ Jump to Bookmark..." icicle-bookmark-other-window
1526 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1527 :help "Jump to a bookmark (C-u: reverse `icicle-bookmark-refresh-cache-flag')"))
1528 (define-key icicle-bookmark-menu-map [bookmark-jump]
1529 '(menu-item "+ Jump to Bookmark (Same Window)..." icicle-bookmark
1530 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1531 :help "Jump to a bookmark (C-u: reverse `icicle-bookmark-refresh-cache-flag')"))
1532
1533
1534 ;; `Edit' --------------------------------------------------------
1535 (cond ((not icicle-touche-pas-aux-menus-flag)
1536 (defvar icicle-edit-menu-map (make-sparse-keymap)
1537 "`Edit' > `Icicles' submenu.")
1538 (define-key menu-bar-edit-menu [icicles]
1539 (list 'menu-item "Icicles" icicle-edit-menu-map :visible 'icicle-mode)))
1540 (t
1541 (defvar icicle-edit-menu-map (make-sparse-keymap)
1542 "`Icicles' > `Edit' submenu.")
1543 (define-key icicle-menu-map [Edit]
1544 (list 'menu-item "Edit" icicle-edit-menu-map))))
1545
1546 (define-key icicle-edit-menu-map [icicle-complete-thesaurus-entry]
1547 '(menu-item "Complete with Thesaurus..." icicle-complete-thesaurus-entry
1548 :enable (and (not buffer-read-only) (boundp 'synonyms-obarray))
1549 :help "Complete a word to an entry from a thesaurus"))
1550 (define-key icicle-edit-menu-map [icicle-insert-thesaurus-entry]
1551 '(menu-item "+ Insert Thesaurus Entry..." icicle-insert-thesaurus-entry
1552 :enable (and (not buffer-read-only) (boundp 'synonyms-obarray))
1553 :help "Insert an entry from a thesaurus"))
1554 (define-key icicle-edit-menu-map [icicle-completing-yank]
1555 '(menu-item "+ Paste Copied Text..." icicle-completing-yank
1556 :enable (not buffer-read-only) :keys "C-- C-y"
1557 :help "Yank an entry from the `kill-ring', choosing it using completion"))
1558
1559
1560 ;; `File' --------------------------------------------------------
1561 (cond ((not icicle-touche-pas-aux-menus-flag)
1562 (defvar icicle-file-menu-map (make-sparse-keymap)
1563 "`File' > `Icicles' submenu.")
1564 (define-key menu-bar-file-menu [icicles]
1565 (list 'menu-item "Icicles" icicle-file-menu-map :visible 'icicle-mode)))
1566 (t
1567 (defvar icicle-file-menu-map (make-sparse-keymap)
1568 "`Icicles' > `File' submenu.")
1569 (define-key icicle-menu-map [file]
1570 (list 'menu-item "File" icicle-file-menu-map :visible 'icicle-mode))))
1571
1572 (define-key icicle-file-menu-map [icicle-delete-file]
1573 '(menu-item "+ Delete File..." icicle-delete-file :visible icicle-mode
1574 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1575 :help "Delete a file or directory"))
1576 (when (featurep 'recentf)
1577 (define-key icicle-file-menu-map [icicle-remove-file-from-recentf-list]
1578 '(menu-item "+ Remove from Recent Files List..."
1579 icicle-remove-file-from-recentf-list :visible icicle-mode
1580 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1581 :help "Remove file from `recentf-list' - the list of recently used files"))
1582 (define-key icicle-file-menu-map [icicle-recent-file-other-window]
1583 '(menu-item "+ Open Recent File (Other Window)..."
1584 icicle-recent-file-other-window :visible icicle-mode
1585 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1586 :help "Open a recently used file in another window"))
1587 (define-key icicle-file-menu-map [icicle-recent-file]
1588 '(menu-item "+ Open Recent File..." icicle-recent-file :visible icicle-mode
1589 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1590 :help "Open a recently used file")))
1591 (define-key icicle-file-menu-map [icicle-dired-saved-file-candidates-other-window]
1592 '(menu-item "Open Dired for Chosen Files..."
1593 icicle-dired-saved-file-candidates-other-window :visible icicle-mode
1594 :enable (and icicle-saved-completion-candidates
1595 (not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
1596 :help "Open Dired on a set of files & directories of your choice"))
1597 (define-key icicle-file-menu-map [icicle-dired-project-other-window]
1598 '(menu-item "Open Dired for Project..." icicle-dired-project-other-window
1599 :visible icicle-mode
1600 :enable (and icicle-saved-completion-sets
1601 (not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
1602 :help "Open Dired on a saved project (in another window)"))
1603 (define-key icicle-file-menu-map [icicle-locate-file-other-window]
1604 '(menu-item "+ Open File Under Directory (Other Window)..."
1605 icicle-locate-file-other-window :visible icicle-mode
1606 :help "Visit a file within a directory or its subdirectories, in another window"))
1607 (define-key icicle-file-menu-map [icicle-locate-file]
1608 '(menu-item "+ Open File Under Directory..." icicle-locate-file :visible icicle-mode
1609 :help "Visit a file within a directory or its subdirectories"))
1610 (define-key icicle-file-menu-map [icicle-file-other-window]
1611 '(menu-item "+ Open File or Directory (Other Window)..." icicle-file-other-window
1612 :visible icicle-mode
1613 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1614 :help "Visit a file or directory in another window"))
1615 (define-key icicle-file-menu-map [icicle-file]
1616 '(menu-item "+ Open File or Directory..." icicle-file :visible icicle-mode
1617 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1618 :help "Visit a file or directory (C-u absolute, C-- absolute by date)"))
1619
1620
1621 ;; `Buffers' -----------------------------------------------------
1622 (cond ((not icicle-touche-pas-aux-menus-flag)
1623 (defvar icicle-buffers-menu-map (make-sparse-keymap)
1624 "`File' > `Icicles' > `Buffers' submenu.")
1625 (define-key icicle-file-menu-map [buffers]
1626 (list 'menu-item "Buffers" icicle-buffers-menu-map)))
1627 (t
1628 (defvar icicle-buffers-menu-map (make-sparse-keymap)
1629 "`Icicles' > `Buffers' submenu.")
1630 (define-key icicle-menu-map [buffers]
1631 (list 'menu-item "Buffers" icicle-buffers-menu-map))))
1632
1633 (define-key icicle-buffers-menu-map [icicle-buffer-list]
1634 '(menu-item "+ Buffer List..." icicle-buffer-list
1635 :help "Choose a list of buffer names"))
1636 (define-key icicle-buffers-menu-map [icicle-remove-buffer-config]
1637 '(menu-item "+ Remove Buffer Configuration..." icicle-remove-buffer-config
1638 :enable icicle-buffer-configs
1639 :help "Remove buffer configuration from `icicle-buffer-configs'"))
1640 (define-key icicle-buffers-menu-map [icicle-add-buffer-config]
1641 '(menu-item "New Buffer Configuration..." icicle-add-buffer-config
1642 :help "Add buffer configuration to `icicle-buffer-configs'"))
1643 (define-key icicle-buffers-menu-map [icicle-buffer-config]
1644 '(menu-item "+ Choose Buffer Configuration..." icicle-buffer-config
1645 :enable icicle-buffer-configs
1646 :help "Choose a configuration of user options for `icicle-buffer'"))
1647 (define-key icicle-buffers-menu-map [icicle-remove-buffer-candidate]
1648 '(menu-item "+ Don't Always Include Buffer..." icicle-remove-buffer-candidate
1649 :enable icicle-buffer-extras
1650 :help "Remove buffer as an always-show completion candidate"))
1651 (define-key icicle-buffers-menu-map [icicle-add-buffer-candidate]
1652 '(menu-item "+ Always Include Buffer..." icicle-add-buffer-candidate
1653 :help "Add buffer as an always-show completion candidate"))
1654 (define-key icicle-buffers-menu-map [icicle-kill-buffer]
1655 '(menu-item "+ Kill Buffer..." icicle-kill-buffer
1656 :help "Kill a buffer (C-0: same-mode, C-9: file, C-- this-frame"))
1657 (define-key icicle-buffers-menu-map [icicle-insert-buffer]
1658 '(menu-item "+ Insert Buffer..." icicle-insert-buffer
1659 :help "Multi-command version of `insert-buffer'"))
1660 (define-key icicle-buffers-menu-map [icicle-delete-windows]
1661 '(menu-item "+ Delete Windows on Buffer..." icicle-delete-windows :keys "C-u C-x 0"
1662 :help "Delete windows showing a buffer, anywhere"))
1663 (define-key icicle-buffers-menu-map [icicle-buffer-other-window]
1664 '(menu-item "+ Switch to Buffer (Other Window)..." icicle-buffer-other-window
1665 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))))
1666 (define-key icicle-buffers-menu-map [icicle-buffer]
1667 '(menu-item "+ Switch to Buffer..." icicle-buffer
1668 :enable (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
1669 :help "Switch to a buffer (C-0: same mode, C-9: file buffer, C--: same frame"))
1670
1671
1672 ;; `Dired Marked' ------------------------------------------------
1673 (cond ((not icicle-touche-pas-aux-menus-flag)
1674 (defvar icicle-dired-multiple-menu-map (make-sparse-keymap)
1675 "`Icicles' submenu for Dired's `Multiple' (or `Operate') menu.")
1676 (if (boundp 'diredp-menu-bar-operate-menu) ; In `dired+.el'.
1677 (define-key diredp-menu-bar-operate-menu [icicles]
1678 (list 'menu-item "Icicles" icicle-dired-multiple-menu-map :visible 'icicle-mode))
1679 (define-key dired-mode-map [menu-bar operate icicles]
1680 (list 'menu-item "Icicles" icicle-dired-multiple-menu-map :visible 'icicle-mode)))
1681
1682 (when (boundp 'diredp-menu-bar-recursive-marked-menu) ; Defined in `dired+.el'
1683 (defvar icicle-dired-recursive-marked-menu-map (make-sparse-keymap)
1684 "`Icicles' submenu for Dired+'s `Multiple' > `Marked Here and Below' menu.")
1685 (define-key diredp-menu-bar-recursive-marked-menu [icicles]
1686 (list 'menu-item "Icicles" icicle-dired-recursive-marked-menu-map
1687 :visible 'icicle-mode))))
1688
1689 (t
1690 (defvar icicle-dired-multiple-menu-map (make-sparse-keymap)
1691 "`Icicles' > `Dired Marked' submenu, in Dired mode.")
1692 (define-key icicle-menu-map [dired-marked]
1693 (list 'menu-item "Dired Marked" icicle-dired-multiple-menu-map
1694 :visible '(eq major-mode 'dired-mode)))
1695
1696 (when (boundp 'diredp-menu-bar-recursive-marked-menu) ; Defined in `dired+.el'
1697 (defvar icicle-dired-recursive-marked-menu-map (make-sparse-keymap)
1698 "`Icicles' > `Dired Marked Here and Below' menu.")
1699 (define-key icicle-dired-multiple-menu-map [here-and-below]
1700 (list 'menu-item "Here and Below" icicle-dired-recursive-marked-menu-map
1701 :visible '(eq major-mode 'dired-mode))))))
1702
1703 (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked-as-project]
1704 '(menu-item "Save Names Persistently (Project)" icicle-dired-save-marked-as-project
1705 :help "Save the marked names as a persistent set"))
1706 (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked-to-variable]
1707 '(menu-item "Save Names to Variable" icicle-dired-save-marked-to-variable
1708 :help "Save the marked names to a variable"))
1709 (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked-more]
1710 '(menu-item "Add to Saved Candidates" icicle-dired-save-marked-more
1711 :help "Add the marked names to the saved completion-candidates set"))
1712 (define-key icicle-dired-multiple-menu-map [icicle-dired-save-marked]
1713 '(menu-item "Save Names as Completion Candidates" icicle-dired-save-marked
1714 :help "Save the marked names as a set of completion candidates"))
1715 (define-key icicle-dired-multiple-menu-map [separator-dired-multiple-1] '(menu-item "--" nil))
1716 (define-key icicle-dired-multiple-menu-map [icicle-visit-marked-file-of-content-other-window]
1717 '(menu-item "Open File of Content (Other Window)"
1718 icicle-visit-marked-file-of-content-other-window
1719 :help "Visit a marked file whose content matches a regexp, in another window"
1720 :enable (condition-case nil ; Avoid an Emacs 22 error with cursor on ./ or ../
1721 (dired-get-marked-files nil nil (lambda (file) (not (file-directory-p file))))
1722 (error nil))))
1723 (define-key icicle-dired-multiple-menu-map [icicle-visit-marked-file-of-content]
1724 '(menu-item "Open File of Content" icicle-visit-marked-file-of-content
1725 :help "Visit a marked file whose content matches a regexp"
1726 :enable (condition-case nil ; Avoid an Emacs 22 error with cursor on ./ or ../
1727 (dired-get-marked-files nil nil (lambda (file) (not (file-directory-p file))))
1728 (error nil))))
1729
1730 (when (boundp 'diredp-menu-bar-recursive-marked-menu) ; Defined in `dired+.el'
1731 (define-key icicle-dired-recursive-marked-menu-map [icicle-search-dired-marked-recursive]
1732 '(menu-item "Icicles Search (and Replace)..." icicle-search-dired-marked-recursive
1733 :help "Search the marked files, including those in marked subdirs"))
1734 (define-key icicle-dired-recursive-marked-menu-map
1735 [icicle-dired-save-marked-to-fileset-recursive]
1736 '(menu-item "Save Names to Fileset" icicle-dired-save-marked-to-fileset-recursive
1737 :help "Save marked names, including those in marked subdirs, to an Emacs fileset"))
1738 (define-key icicle-dired-recursive-marked-menu-map
1739 [icicle-dired-save-marked-to-cache-file-recursive]
1740 '(menu-item "Save Names to Cache File" icicle-dired-save-marked-to-cache-file-recursive
1741 :help "Save marked names, including those in marked subdirs, to an Icicles cache file"))
1742 (define-key icicle-dired-recursive-marked-menu-map
1743 [icicle-dired-save-marked-to-variable-recursive]
1744 '(menu-item "Save Names to Variable" icicle-dired-save-marked-to-variable-recursive
1745 :help "Save marked names, including those in marked subdirs, to a variable"))
1746 (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-more-recursive]
1747 '(menu-item "Add to Saved Candidates" icicle-dired-save-marked-more-recursive
1748 :help "Add marked files, including those in marked subdirs, to saved candidates"))
1749 (define-key icicle-dired-recursive-marked-menu-map [icicle-dired-save-marked-recursive]
1750 '(menu-item "Save Names as Completion Candidates" icicle-dired-save-marked-recursive
1751 :help "Save the marked file names in Dired, including those in marked subdirs")))
1752
1753 ;; `Dired Dirs' ------------------------------------------------
1754 (cond ((not icicle-touche-pas-aux-menus-flag)
1755 (defvar icicle-dired-dir-menu-map (make-sparse-keymap)
1756 "`Icicles' submenu for Dired's `Dir' (or `Subdir') menu.")
1757 (if (boundp 'diredp-menu-bar-subdir-menu) ; In `dired+.el'.
1758 (define-key diredp-menu-bar-subdir-menu [icicles]
1759 (list 'menu-item "Icicles" icicle-dired-dir-menu-map :visible 'icicle-mode))
1760 (define-key dired-mode-map [menu-bar subdir icicles]
1761 (list 'menu-item "Icicles" icicle-dired-dir-menu-map :visible 'icicle-mode))))
1762 (t
1763 (defvar icicle-dired-dir-menu-map (make-sparse-keymap)
1764 "`Icicles' > `Dired Dirs' submenu, in Dired mode.")
1765 (define-key icicle-menu-map [dired-dirs]
1766 (list 'menu-item "Dired Dirs" icicle-dired-dir-menu-map
1767 :visible '(eq major-mode 'dired-mode)))))
1768
1769 (when (fboundp 'icicle-dired-insert-as-subdir) ; Emacs 21+
1770 (define-key icicle-dired-dir-menu-map [icicle-dired-insert-as-subdir]
1771 '(menu-item "Insert Dir into Ancestor Dired..." icicle-dired-insert-as-subdir
1772 :help "Insert a directory into a Dired ancestor directory listing")))
1773 (define-key icicle-dired-dir-menu-map [icicle-dired-saved-file-candidates-other-window]
1774 '(menu-item "Open Dired for Chosen Files..."
1775 icicle-dired-saved-file-candidates-other-window
1776 :enable icicle-saved-completion-candidates
1777 :help "Open Dired on a set of files & directories of your choice"))
1778 (define-key icicle-dired-dir-menu-map [icicle-dired-project-other-window]
1779 '(menu-item "Open Dired for Project..." icicle-dired-project-other-window
1780 :enable icicle-saved-completion-sets
1781 :help "Open Dired on a saved project"))
1782
1783
1784 ;; `Info' --------------------------------------------------------
1785 (require 'info) ; `Info-mode-menu' is not preloaded.
1786 (cond ((not icicle-touche-pas-aux-menus-flag)
1787 (defvar icicle-info-menu-map (make-sparse-keymap)
1788 "`Info' > `Icicles' submenu.")
1789 (define-key Info-mode-menu [icicles]
1790 (list 'menu-item "Icicles" icicle-info-menu-map :visible 'icicle-mode)))
1791 (t
1792 (defvar icicle-info-menu-map (make-sparse-keymap)
1793 "`Icicles' > `Info' submenu, in Info mode.")
1794 (define-key icicle-menu-map [info]
1795 (list 'menu-item "Info Mode" icicle-info-menu-map :visible '(eq major-mode 'Info-mode)))))
1796
1797 (when (fboundp 'icicle-Info-virtual-book)
1798 (define-key icicle-info-menu-map [icicle-Info-virtual-book]
1799 '(menu-item "Virtual Book" icicle-Info-virtual-book
1800 :help "Open Info on a virtual book of saved Info nodes")))
1801 (define-key icicle-info-menu-map [icicle-Info-goto-node]
1802 '(menu-item "+ Go to Node..." icicle-Info-goto-node
1803 :help "Go to an Info node by name"))
1804 (define-key icicle-info-menu-map [icicle-Info-menu]
1805 '(menu-item "+ Go to Menu Node..." icicle-Info-menu
1806 :help "Choose a menu node by name"))
1807 (define-key icicle-info-menu-map [icicle-Info-index]
1808 '(menu-item "+ Look Up in Index..." icicle-Info-index
1809 :help "Go to an indexed topic - multi-command version of `Info-index'"))
1810
1811
1812 ;; `Bookmark+', in buffer `*Bookmark List*' ----------------------
1813 ;;
1814 ;; Do this regardless of `icicle-touche-pas-aux-menus-flag', since `Bookmark+' is my menu.
1815 (when (boundp 'bmkp-bmenu-menubar-menu) ; In `bookmark+-bmu.el'.
1816 (defvar icicle-bookmark+-menu-map (make-sparse-keymap)
1817 "`Bookmark+' > `Icicles' submenu.")
1818 (define-key bmkp-bmenu-menubar-menu [icicles]
1819 (list 'menu-item "Icicles" icicle-bookmark+-menu-map :visible 'icicle-mode))
1820 (define-key icicle-bookmark+-menu-map [icicle-search-bookmark-list-marked]
1821 '(menu-item "Search & Replace in Marked Files..." icicle-search-bookmark-list-marked
1822 :help "Search the files of the marked bookmarks"))
1823 (define-key icicle-bookmark+-menu-map [icicle-bookmark-save-marked-files-more]
1824 '(menu-item "Save File Names of Marked as More Candidates..."
1825 icicle-bookmark-save-marked-files-more
1826 :help "Add file names of marked bookmarks to saved file-completion candidates"))
1827 (define-key icicle-bookmark+-menu-map [icicle-bookmark-save-marked-files]
1828 '(menu-item "Save File Names of Marked as Candidates..." icicle-bookmark-save-marked-files
1829 :help "Save file names of marked bookmarks as a set of file-completion candidates"))
1830 (define-key icicle-bookmark+-menu-map [icicle-bookmark-save-marked-files-as-project]
1831 '(menu-item "Save Marked as Project" icicle-bookmark-save-marked-files-as-project
1832 :help "Save the file names of the marked bookmarks as a persistent set")))
1833
1834 )
1835
1836
1837 ;; Install `Icicles' menu-bar menu.
1838 (define-key icicle-mode-map [menu-bar icicles] (cons "Icicles" icicle-menu-map))
1839
1840 ;; Optional `icicle-mode-map' bindings - governed by `icicle-top-level-key-bindings'.
1841 (icicle-bind-top-level-commands)
1842
1843 ;; Put all Icicles search commands on a common prefix key, `icicle-search-key-prefix'.
1844 (define-key icicle-mode-map icicle-search-key-prefix icicle-search-map)
1845
1846 ;; Install or update `icicle-mode-map'.
1847 (if icicle-minor-mode-map-entry
1848 (setcdr icicle-minor-mode-map-entry icicle-mode-map)
1849 (setq icicle-minor-mode-map-entry (cons 'icicle-mode icicle-mode-map))
1850 (add-to-list 'minor-mode-map-alist icicle-minor-mode-map-entry)))
1851
1852 (defun icicle-S-iso-lefttab-to-S-TAB (strg)
1853 "Return string STRG, but with \"S-iso-lefttab\" replaced by \"S-TAB\"."
1854 (replace-regexp-in-string "S-iso-lefttab" "S-TAB" strg))
1855
1856 (defun icicle-bind-other-keymap-keys ()
1857 "Bind some keys in maps other than minibuffer maps and `icicle-mode-map'"
1858
1859 ;; Bind Isearch keys.
1860 (icicle-bind-isearch-keys)
1861
1862 ;; Bind keys in Comint mode.
1863 (when (boundp 'comint-mode-map)
1864 (define-key comint-mode-map (icicle-kbd "C-c C-i") 'icicle-comint-command) ; `C-c TAB'
1865 (define-key comint-mode-map (icicle-kbd "C-c tab") 'icicle-comint-command)) ; `C-c TAB'
1866
1867 ;; Bind keys in Shell mode.
1868 (when (and (boundp 'shell-mode-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine))
1869 (define-key shell-mode-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete))
1870
1871 ;; Bind keys in Shell Script mode.
1872 (when (and (boundp 'sh-mode-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine))
1873 (icicle-remap 'comint-dynamic-complete 'icicle-comint-dynamic-complete sh-mode-map))
1874
1875 ;; Bind keys in Ielm mode.
1876 (when (and (boundp 'ielm-map) (memq 'comint-dynamic-complete icicle-functions-to-redefine))
1877 (define-key ielm-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete))
1878
1879 ;; Bind keys in Tcl mode.
1880 (when (and (boundp 'inferior-tcl-mode-map) (memq 'comint-dynamic-complete
1881 icicle-functions-to-redefine))
1882 (define-key inferior-tcl-mode-map (icicle-kbd "C-i") 'icicle-comint-dynamic-complete))
1883
1884 ;; Bind keys in GUD (Debugger) mode.
1885 (when (and (boundp 'gud-minibuffer-local-map) (memq 'comint-dynamic-complete-filename
1886 icicle-functions-to-redefine))
1887 (define-key gud-minibuffer-local-map (icicle-kbd "C-i")
1888 'icicle-comint-dynamic-complete-filename))
1889
1890 ;; Bind some keys in `bookmark-bmenu-mode' mode (*Bookmark List*) - requires Bookmark+.
1891 (when (and (featurep 'bookmark+) (boundp 'bookmark-bmenu-mode-map))
1892 (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C-M->")) ; *Bookmark List* `C-M->'
1893 (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M->") 'icicle-bookmark-save-marked-files))
1894 (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C->")) ; *Bookmark List* `C->'
1895 (define-key bookmark-bmenu-mode-map (icicle-kbd "C->")
1896 'icicle-bookmark-save-marked-files-more))
1897 (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C-M-}")) ; *Bookmark List* `C-M-}'
1898 (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M-}")
1899 'icicle-bookmark-save-marked-files-to-variable))
1900 (unless (lookup-key bookmark-bmenu-mode-map (icicle-kbd "C-}")) ; *Bookmark List* `C-}'
1901 (define-key bookmark-bmenu-mode-map (icicle-kbd "C-}")
1902 'icicle-bookmark-save-marked-files-as-project))
1903 (let* ((key (apply 'vector (append (listify-key-sequence icicle-search-key-prefix)
1904 (listify-key-sequence (icicle-kbd "m"))))) ; `M-s M-s m'
1905 (def (lookup-key bookmark-bmenu-mode-map key)))
1906 (unless (and def (not (integerp def)))
1907 (define-key bookmark-bmenu-mode-map key 'icicle-search-bookmark-list-marked))))
1908
1909 ;; Bind some keys in Dired mode.
1910 (when (boundp 'dired-mode-map)
1911 (unless (lookup-key dired-mode-map (icicle-kbd "C-M-<")) ; Dired `C-M-<'
1912 (define-key dired-mode-map (icicle-kbd "C-M-<")
1913 'icicle-dired-saved-file-candidates-other-window))
1914 (unless (lookup-key dired-mode-map (icicle-kbd "C-{")) ; Dired `C-{'
1915 (define-key dired-mode-map (icicle-kbd "C-{") 'icicle-dired-project-other-window))
1916 (unless (lookup-key dired-mode-map (icicle-kbd "C-M->")) ; Dired `C-M->'
1917 (define-key dired-mode-map (icicle-kbd "C-M->") 'icicle-dired-save-marked))
1918 (unless (lookup-key dired-mode-map (icicle-kbd "C->")) ; Dired `C->'
1919 (define-key dired-mode-map (icicle-kbd "C->") 'icicle-dired-save-marked-more))
1920 (unless (lookup-key dired-mode-map (icicle-kbd "C-M-}")) ; Dired `C-M-}'
1921 (define-key dired-mode-map (icicle-kbd "C-M-}") 'icicle-dired-save-marked-to-variable))
1922 (unless (lookup-key dired-mode-map (icicle-kbd "C-}")) ; Dired `C-}'
1923 (define-key dired-mode-map (icicle-kbd "C-}") 'icicle-dired-save-marked-as-project))
1924 (unless (lookup-key dired-mode-map (icicle-kbd "C-S-f")) ; Dired `C-S-f', aka `C-F'
1925 (define-key dired-mode-map (icicle-kbd "C-S-f") 'icicle-visit-marked-file-of-content))
1926 (unless (lookup-key dired-mode-map (icicle-kbd "C-S-o")) ; Dired `C-S-o', aka `C-O'
1927 (define-key dired-mode-map (icicle-kbd "C-S-o")
1928 'icicle-visit-marked-file-of-content-other-window)))
1929
1930 ;; More Dired keys, but these require `dired+.el'.
1931 (when (boundp 'diredp-recursive-map)
1932 (let* ((key (apply 'vector ; `M-s M-s m'
1933 (append (listify-key-sequence icicle-search-key-prefix)
1934 (listify-key-sequence (icicle-kbd "m")))))
1935 (def (lookup-key dired-mode-map key)))
1936 (unless (and def (not (integerp def)))
1937 (define-key dired-mode-map key 'icicle-search-dired-marked-recursive)))
1938 (define-key diredp-recursive-map (icicle-kbd "M-s M-s") ; `M-+ M-s M-s'
1939 'icicle-search-dired-marked-recursive)
1940 (define-key diredp-recursive-map (icicle-kbd "C-{") ; `M-+ C-{'
1941 'icicle-dired-project-other-window)
1942 (define-key diredp-recursive-map (icicle-kbd "C-M->") ; `M-+ C-M->'
1943 'icicle-dired-save-marked-recursive)
1944 (define-key diredp-recursive-map (icicle-kbd "C->") ; `M-+ C->'
1945 'icicle-dired-save-marked-more-recursive)
1946 (define-key diredp-recursive-map (icicle-kbd "C-M-}") ; `M-+ C-M-}'
1947 'icicle-dired-save-marked-to-variable-recursive)
1948 (define-key diredp-recursive-map (icicle-kbd "C-}") ; `M-+ C-}'
1949 'icicle-dired-save-marked-to-cache-file-recursive))
1950
1951 ;; Bind keys in Ibuffer mode.
1952 (when (boundp 'ibuffer-mode-map)
1953 (let* ((key (apply 'vector ; Ibuffer `M-s M-s m'
1954 (append (listify-key-sequence icicle-search-key-prefix)
1955 (listify-key-sequence (icicle-kbd "m")))))
1956 (def (lookup-key ibuffer-mode-map icicle-search-key-prefix)))
1957 (unless (and def (not (integerp def)))
1958 (define-key ibuffer-mode-map key 'icicle-search-ibuffer-marked))
1959 (unless icicle-touche-pas-aux-menus-flag ; Use Ibuffer's `Operate' menu.
1960 (define-key ibuffer-mode-operate-map [icicle-search-ibuffer-marked]
1961 '(menu-item "Icicles Search (and Replace)..." icicle-search-ibuffer-marked
1962 :visible icicle-mode :enable (eq major-mode 'ibuffer-mode))))))
1963
1964 ;; Bind keys in Buffer Menu mode.
1965 (when (boundp 'Buffer-menu-mode-map)
1966 (let* ((key (apply 'vector ; Buffer-Menu `M-s M-s m'
1967 (append (listify-key-sequence icicle-search-key-prefix)
1968 (listify-key-sequence (icicle-kbd "m")))))
1969 (def (lookup-key Buffer-menu-mode-map icicle-search-key-prefix)))
1970 (unless (and def (not (integerp def)))
1971 (define-key Buffer-menu-mode-map key 'icicle-search-buff-menu-marked))))
1972
1973 ;; Bind `S-TAB' in major maps, for key completion.
1974 (when (fboundp 'map-keymap) ; Emacs 22+.
1975 (icicle-bind-key-completion-keys-in-keymaps-from (current-global-map))
1976 (mapcar #'icicle-bind-key-completion-keys-for-map-var icicle-keymaps-for-key-completion))
1977
1978 ;; Bind `M-S-TAB' in `minibuffer-local-map', for key completion.
1979 (when (fboundp 'map-keymap) ; Emacs 22+.
1980 (icicle-bind-key-completion-keys-for-map-var 'minibuffer-local-map
1981 icicle-key-complete-keys-for-minibuffer))
1982
1983 ;; Prevent `this-command' from being set to `handle-switch-frame'.
1984 (define-key global-map [handle-switch-frame] 'icicle-skip-this-command)
1985 (define-key global-map [switch-frame] 'icicle-handle-switch-frame))
1986
1987 (defun icicle-bind-isearch-keys ()
1988 "Bind Icicles Isearch commands."
1989 (dolist (key icicle-search-from-isearch-keys)
1990 (define-key isearch-mode-map key 'icicle-search-w-isearch-string)) ; In `icicles-cmd2.el'.
1991 (dolist (key icicle-isearch-complete-keys)
1992 (define-key isearch-mode-map key 'icicle-isearch-complete))
1993 (dolist (key icicle-isearch-history-insert-keys)
1994 (define-key isearch-mode-map key 'icicle-isearch-history-insert))
1995 (cond ((fboundp 'isearch-moccur) ; In `moccur.el'.
1996 (define-key isearch-mode-map (icicle-kbd "C-o") 'isearch-moccur)) ; `C-s C-o'
1997 ((fboundp 'isearch-occur) ; In `occur-schroeder.el'.
1998 (define-key isearch-mode-map (icicle-kbd "C-o") 'isearch-occur)))) ; `C-s C-o'
1999
2000 (defun icicle-bind-key-completion-keys-for-map-var (keymap-var &optional keys)
2001 "Bind `S-TAB' in keymaps accessible from keymap KEYMAP-VAR.
2002 KEYMAP-VAR should be bound to a keymap that has at least one prefix
2003 keymap. If KEYMAP-VAR is not bound to a keymap, it is ignored.
2004
2005 Actually, by default, it is the keys in `icicle-key-complete-keys'
2006 that are bound, not `S-TAB'. And if optional arg KEYS is non-nil then
2007 it, not `icicle-key-complete-keys', is the list of keys that are
2008 bound."
2009 (let ((temp keymap-var))
2010 (when (boundp temp)
2011 (setq temp (symbol-value temp))
2012 (when (keymapp temp) (icicle-bind-key-completion-keys-in-keymaps-from temp keys)))))
2013
2014 (defun icicle-bind-key-completion-keys-in-keymaps-from (map &optional keys)
2015 "Bind keys in `icicle-key-complete-keys' to `icicle-complete-keys'.
2016 Each key in `icicle-complete-keys' (or optional arg KEYS, if non-nil)
2017 is bound in all keymaps accessible from keymap MAP."
2018 (dolist (key+map (accessible-keymaps map))
2019 (let ((map (cdr key+map)))
2020 ;; We could try to exclude menu maps, by testing (not (keymap-prompt map)).
2021 ;; But we want to include at least some menu maps - those, such as `facemenu-keymap',
2022 ;; that are bound to keyboard keys. (when (and (keymapp map) (not (keymap-prompt map)))...)
2023 (when (keymapp map)
2024 (dolist (key (or keys icicle-key-complete-keys))
2025 (when (or icicle-complete-key-anyway-flag (not (lookup-key map key)))
2026 (condition-case nil (define-key map key 'icicle-complete-keys) (error nil))))))))
2027
2028 (defun icicle-restore-other-keymap-keys ()
2029 "Restore some bindings changed by `icicle-bind-other-keymap-keys'."
2030
2031 ;; Unbind Isearch keys.
2032 (icicle-unbind-isearch-keys)
2033
2034 ;; Unbind keys in Comint mode.
2035 (when (boundp 'comint-mode-map)
2036 (define-key comint-mode-map (icicle-kbd "C-c C-i") nil)
2037 (define-key comint-mode-map (icicle-kbd "C-c tab") nil))
2038
2039 ;; Unbind keys in Shell mode.
2040 (when (and (boundp 'shell-mode-map) (memq 'icicle-comint-dynamic-complete
2041 icicle-functions-to-redefine))
2042 (define-key shell-mode-map (icicle-kbd "C-i") (if (> emacs-major-version 23)
2043 'completion-at-point
2044 'comint-dynamic-complete)))
2045
2046 ;; Unbind keys in Shell Script mode.
2047 (when (and (boundp 'sh-mode-map) (memq 'icicle-comint-dynamic-complete
2048 icicle-functions-to-redefine))
2049 (icicle-unmap 'comint-dynamic-complete sh-mode-map 'icicle-comint-dynamic-complete))
2050
2051 ;; Unbind keys in Ielm mode.
2052 (when (and (boundp 'ielm-map) (memq 'icicle-comint-dynamic-complete
2053 icicle-functions-to-redefine))
2054 (define-key ielm-map (icicle-kbd "C-i") 'comint-dynamic-complete))
2055
2056 ;; Unbind keys in Tcl mode.
2057 (when (and (boundp 'inferior-tcl-mode-map) (memq 'icicle-comint-dynamic-complete
2058 icicle-functions-to-redefine))
2059 (define-key inferior-tcl-mode-map (icicle-kbd "C-i") 'comint-dynamic-complete))
2060
2061 ;; Bind keys in GUD (Debugger) mode.
2062 (when (and (boundp 'gud-minibuffer-local-map) (memq 'icicle-comint-dynamic-complete-filename
2063 icicle-functions-to-redefine))
2064 (define-key gud-minibuffer-local-map (icicle-kbd "C-i") 'comint-dynamic-complete-filename))
2065
2066 ;; Unbind keys in `bookmark-bmenu-mode' mode (*Bookmark List*) - requires Bookmark+.
2067 (when (and (featurep 'bookmark+) (boundp 'bookmark-bmenu-mode-map))
2068 (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M->") nil)
2069 (define-key bookmark-bmenu-mode-map (icicle-kbd "C->") nil)
2070 (define-key bookmark-bmenu-mode-map (icicle-kbd "C-M-}") nil)
2071 (define-key bookmark-bmenu-mode-map (icicle-kbd "C-}") nil)
2072 (define-key bookmark-bmenu-mode-map icicle-search-key-prefix nil))
2073
2074 ;; Unbind keys in Dired mode.
2075 (when (boundp 'dired-mode-map)
2076 (define-key dired-mode-map (icicle-kbd "C-M-<") nil)
2077 (define-key dired-mode-map (icicle-kbd "C-{") nil)
2078 (define-key dired-mode-map (icicle-kbd "C-M->") nil)
2079 (define-key dired-mode-map (icicle-kbd "C->") nil)
2080 (define-key dired-mode-map (icicle-kbd "C-M-}") nil)
2081 (define-key dired-mode-map (icicle-kbd "C-}") nil)
2082 (define-key dired-mode-map (icicle-kbd "C-S-f") nil)
2083 (define-key dired-mode-map (icicle-kbd "C-S-o") nil)
2084 (define-key dired-mode-map icicle-search-key-prefix nil))
2085
2086 ;; Unbind keys in Ibuffer mode.
2087 (when (boundp 'ibuffer-mode-map)
2088 (define-key ibuffer-mode-map icicle-search-key-prefix nil))
2089
2090 ;; Unbind keys in Buffer Menu mode.
2091 (when (boundp 'Buffer-menu-mode-map)
2092 (define-key Buffer-menu-mode-map icicle-search-key-prefix nil))
2093
2094 ;; Unbind `S-TAB' in major maps.
2095 (when (fboundp 'map-keymap) ; Emacs 22+.
2096 (icicle-unbind-key-completion-keys-in-keymaps-from (current-global-map))
2097 (mapcar #'icicle-unbind-key-completion-keys-for-map-var icicle-keymaps-for-key-completion))
2098
2099 ;; Unbind `M-S-TAB' in `minibuffer-local-map'.
2100 (when (fboundp 'map-keymap) ; Emacs 22+.
2101 (icicle-unbind-key-completion-keys-for-map-var 'minibuffer-local-map
2102 icicle-key-complete-keys-for-minibuffer))
2103 ;; Restore prevention of `this-command' being `handle-switch-frame'.
2104 (define-key global-map [handle-switch-frame] nil)
2105 (define-key global-map [switch-frame] 'handle-switch-frame))
2106
2107 (defun icicle-unbind-isearch-keys ()
2108 "Unbind Icicles Isearch commands."
2109 (dolist (key icicle-search-from-isearch-keys) (define-key isearch-mode-map key nil))
2110 (dolist (key icicle-isearch-complete-keys) (define-key isearch-mode-map key nil))
2111 (define-key isearch-mode-map (icicle-kbd "C-M-i") 'isearch-complete)
2112 (dolist (key icicle-isearch-history-insert-keys) (define-key isearch-mode-map key nil))
2113 (when (fboundp 'isearch-moccur) ; Restore `moccur.el' binding.
2114 (define-key isearch-mode-map (icicle-kbd "M-o") 'isearch-moccur))
2115 (define-key isearch-mode-map (icicle-kbd "C-o") nil))
2116
2117 (defun icicle-unbind-key-completion-keys-for-map-var (keymap-var &optional keys)
2118 "Unbind `S-TAB' in keymaps accessible from keymap KEYMAP-VAR.
2119 KEYMAP-VAR should be bound to a keymap that has at least one prefix
2120 keymap. If KEYMAP-VAR is not bound to a keymap, it is ignored.
2121
2122 Actually, by default, it is the keys in `icicle-key-complete-keys'
2123 that are unbound, not `S-TAB'. And if optional arg KEYS is non-nil
2124 then it, not `icicle-key-complete-keys', is the list of keys that are
2125 unbound."
2126 (let ((temp keymap-var))
2127 (when (boundp temp)
2128 (setq temp (symbol-value temp))
2129 (when (keymapp temp) (icicle-unbind-key-completion-keys-in-keymaps-from temp keys)))))
2130
2131 (defun icicle-unbind-key-completion-keys-in-keymaps-from (map &optional keys)
2132 "Unbind `icicle-key-complete-keys' in keymaps accessible from MAP.
2133 Each key in `icicle-complete-keys' (or optional arg KEYS, if non-nil)
2134 is unbound in all keymaps accessible from keymap MAP."
2135 (dolist (key+map (accessible-keymaps map))
2136 (let ((map (cdr key+map)))
2137 (while (and (symbolp map) (fboundp map)) (setq map (symbol-function map))) ; Get a list.
2138 (when (and (keymapp map)
2139 (not (eq 'autoload (car-safe map))) ; Skip autoload keymaps.
2140 (not (stringp (car-safe (last map))))) ; Try to exclude menu maps.
2141 (dolist (key (or keys icicle-key-complete-keys))
2142 (when (eq (lookup-key map key) 'icicle-complete-keys)
2143 (condition-case nil (define-key map key nil) (error nil))))))))
2144
2145 ;;(@* "Other Icicles functions that define Icicle mode")
2146
2147 ;;; Other Icicles functions that define Icicle mode ------------------
2148
2149 (defun icicle-skip-this-command ()
2150 "Prevent `handle-switch-frame' from being added to `this-command'."
2151 (interactive)
2152 (setq this-command last-command))
2153
2154 (defun icicle-handle-switch-frame (event)
2155 "Call `handle-switch-frame', but don't add it to `this-command'."
2156 (interactive "e")
2157 (handle-switch-frame event)
2158 (setq this-command last-command))
2159
2160 (defun icicle-define-minibuffer-maps (turn-on-p)
2161 "Define keymaps for the minibuffer and buffer `*Completions*'."
2162 (cond
2163 (turn-on-p ; TURN IT ON ********************************
2164
2165 ;; `minibuffer-local-map': default minibuffer map.
2166 (let ((map minibuffer-local-map))
2167
2168 ;; Menu-bar `Minibuf' menu.
2169 (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit'
2170 '(menu-item "Quit" icicle-abort-recursive-edit
2171 :help "Cancel minibuffer input or recursive edit"))
2172 (define-key map [menu-bar minibuf return]
2173 '(menu-item "Enter" exit-minibuffer
2174 :help "Terminate input and exit minibuffer" :keys "RET"))
2175 (define-key map [menu-bar minibuf separator-help] '("--"))
2176
2177 (define-key map [menu-bar minibuf completion-help]
2178 '(menu-item "Icicles Help" icicle-minibuffer-help
2179 :help "Display help for minibuffer input and completion" :keys "M-?"))
2180 (define-key map [menu-bar minibuf separator-last] '("--"))
2181
2182 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain]
2183 '(menu-item "Toggle Searching Complement"
2184 icicle-toggle-search-complementing-domain
2185 :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~"))
2186 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current]
2187 '(menu-item "Toggle All-Current Icicle-Search Highlighting"
2188 icicle-toggle-highlight-all-current :enable icicle-searching-p
2189 :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^"))
2190 (define-key map [menu-bar minibuf icicle-multi-inputs-save]
2191 '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save
2192 :help "Add inputs in minibuffer to saved candidates set for completion"))
2193 (define-key map [menu-bar minibuf icicle-multi-inputs-act]
2194 '(menu-item "Act on multiple inputs in the minibuffer" icicle-multi-inputs-act
2195 :help "Parse minibuffer input into a list of candidates, then act on each"))
2196 (define-key map [menu-bar minibuf icicle-regexp-quote-input]
2197 '(menu-item "Regexp-Quote Input" icicle-regexp-quote-input
2198 :enable (with-current-buffer (window-buffer (minibuffer-window))
2199 (not (zerop (buffer-size))))
2200 :help "Regexp-quote current input or its active region, then apropos-complete"
2201 :keys "M-%"))
2202 (define-key map [menu-bar minibuf separator-set2] '("--"))
2203
2204 (define-key map [menu-bar minibuf icicle-clear-current-history]
2205 '(menu-item "Clear History Entries" icicle-clear-current-history
2206 :help "Clear current minibuffer history of selected entries"))
2207 (define-key map [menu-bar minibuf icicle-erase-minibuffer]
2208 '(menu-item "Delete from History" icicle-erase-minibuffer-or-history-element
2209 :visible (memq last-command
2210 '(previous-history-element next-history-element
2211 icicle-erase-minibuffer-or-history-element
2212 previous-matching-history-element next-matching-history-element))
2213 :help "Delete current history element (in minibuffer now)" :keys "M-k"))
2214 (define-key map [menu-bar minibuf icicle-delete-history-element]
2215 '(menu-item "Clear (Erase) Minibuffer" icicle-erase-minibuffer-or-history-element
2216 :visible (not (memq last-command
2217 '(previous-history-element next-history-element
2218 icicle-erase-minibuffer-or-history-element
2219 previous-matching-history-element next-matching-history-element)))
2220 :help "Erase the Minibuffer" :keys "M-k"))
2221 (define-key map [menu-bar minibuf icicle-insert-list-join-string]
2222 '(menu-item "Insert Join-String" icicle-insert-list-join-string
2223 :help "Insert `icicle-list-join-string' into the minibuffer"))
2224 (define-key map [menu-bar minibuf icicle-insert-key-description]
2225 '(menu-item "Insert Key Description" icicle-insert-key-description
2226 :visible (not icicle-searching-p) :keys "M-q"
2227 :help "Read key and insert its description - e.g., reading ^F inserts `C-f'"))
2228 (define-key map [menu-bar minibuf icicle-roundup]
2229 '(menu-item "Insert Completion Candidate(s)" icicle-roundup
2230 :enable (and (icicle-completing-p) icicle-completion-candidates)
2231 :help "Insert one or more completion candidates in the minibuffer"))
2232 (define-key map [menu-bar minibuf icicle-insert-history-element]
2233 '(menu-item "Insert Past Input(s) using Completion" icicle-insert-history-element
2234 :enable (consp (symbol-value minibuffer-history-variable))
2235 :help "Use completion to insert a previous input into the minibuffer"))
2236 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var]
2237 '(menu-item "Insert String from a Variable..." icicle-insert-string-from-variable
2238 :visible current-prefix-arg :keys "C-="
2239 :help "Read a variable name and insert its string value into the minibuffer"))
2240 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var]
2241 '(menu-item "Insert `icicle-input-string'" icicle-insert-string-from-variable
2242 :visible (not current-prefix-arg) :keys "C-="
2243 :help "Insert text from variable `icicle-input-string' into the minibuffer"))
2244 (define-key map [menu-bar minibuf icicle-insert-string-at-point]
2245 '(menu-item "Insert Text from Point" icicle-insert-string-at-point
2246 :help "Insert text at or near the cursor into the minibuffer"))
2247 (define-key map [menu-bar minibuf icicle-completing-read+insert]
2248 '(menu-item "Insert On-Demand Completion" icicle-completing-read+insert
2249 :visible (consp icicle-completing-read+insert-candidates)
2250 :help "Read and insert something using (lax) completion"))
2251 (define-key map [menu-bar minibuf icicle-read+insert-file-name]
2252 '(menu-item "Insert File Name" icicle-read+insert-file-name
2253 :help "Read and insert a file name using (lax) completion"))
2254
2255 ;; Keyboard keys
2256 (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2257 (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g'
2258 (dolist (key icicle-completing-read+insert-keys)
2259 (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c'
2260 (dolist (key icicle-read+insert-file-name-keys)
2261 (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f'
2262 ) ; End `minibuffer-local-map'.
2263
2264 ;; `minibuffer-local-ns-map': default minibuffer map when spaces are not allowed.
2265 ;; In Emacs 22+, local is parent of local-ns.
2266 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-ns-map))
2267 (let ((map minibuffer-local-ns-map))
2268 (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit'
2269 '(menu-item "Quit" icicle-abort-recursive-edit
2270 :help "Cancel minibuffer input or recursive edit"))
2271 (define-key map [menu-bar minibuf return]
2272 '(menu-item "Enter" exit-minibuffer
2273 :help "Terminate input and exit minibuffer" :keys "RET"))
2274 (define-key map [menu-bar minibuf separator-help] '("--"))
2275
2276 (define-key map [menu-bar minibuf completion-help]
2277 '(menu-item "Icicles Help" icicle-minibuffer-help
2278 :help "Display help for minibuffer input and completion" :keys "M-?"))
2279 (define-key map [menu-bar minibuf separator-last] '("--"))
2280
2281 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain]
2282 '(menu-item "Toggle Searching Complement"
2283 icicle-toggle-search-complementing-domain
2284 :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~"))
2285 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current]
2286 '(menu-item "Toggle All-Current Icicle-Search Highlighting"
2287 icicle-toggle-highlight-all-current :enable icicle-searching-p
2288 :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^"))
2289 (define-key map [menu-bar minibuf icicle-multi-inputs-save]
2290 '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save
2291 :help "Add inputs in minibuffer to saved candidates set for completion"))
2292 (define-key map [menu-bar minibuf icicle-multi-inputs-act]
2293 '(menu-item "Act on multiple inputs in the minibuffer" icicle-multi-inputs-act
2294 :help "Parse minibuffer input into a list of candidates, then act on each"))
2295 (define-key map [menu-bar minibuf icicle-regexp-quote-input]
2296 '(menu-item "Regexp-Quote Input" icicle-regexp-quote-input
2297 :enable (with-current-buffer (window-buffer (minibuffer-window))
2298 (not (zerop (buffer-size))))
2299 :help "Regexp-quote current input or its active region, then apropos-complete"
2300 :keys "M-%"))
2301 (define-key map [menu-bar minibuf separator-set2] '("--"))
2302
2303 (define-key map [menu-bar minibuf icicle-clear-current-history]
2304 '(menu-item "Clear History Entries" icicle-clear-current-history
2305 :help "Clear current minibuffer history of selected entries"))
2306 (define-key map [menu-bar minibuf icicle-erase-minibuffer]
2307 '(menu-item "Delete from History" icicle-erase-minibuffer-or-history-element
2308 :visible (memq last-command
2309 '(previous-history-element next-history-element
2310 icicle-erase-minibuffer-or-history-element
2311 previous-matching-history-element next-matching-history-element))
2312 :help "Delete current history element (in minibuffer now)" :keys "M-k"))
2313 (define-key map [menu-bar minibuf icicle-delete-history-element]
2314 '(menu-item "Clear (Erase) Minibuffer" icicle-erase-minibuffer-or-history-element
2315 :visible (not (memq last-command
2316 '(previous-history-element next-history-element
2317 icicle-erase-minibuffer-or-history-element
2318 previous-matching-history-element next-matching-history-element)))
2319 :help "Erase the Minibuffer" :keys "M-k"))
2320 (define-key map [menu-bar minibuf icicle-insert-list-join-string]
2321 '(menu-item "Insert Join-String" icicle-insert-list-join-string
2322 :help "Insert `icicle-list-join-string' into the minibuffer"))
2323 (define-key map [menu-bar minibuf icicle-insert-key-description]
2324 '(menu-item "Insert Key Description" icicle-insert-key-description
2325 :visible (not icicle-searching-p) :keys "M-q"
2326 :help "Read key and insert its description - e.g., reading ^F inserts `C-f'"))
2327 (define-key map [menu-bar minibuf icicle-roundup]
2328 '(menu-item "Insert Completion Candidate(s)" icicle-roundup
2329 :enable (and (icicle-completing-p) icicle-completion-candidates)
2330 :help "Insert one or more completion candidates in the minibuffer"))
2331 (define-key map [menu-bar minibuf icicle-insert-history-element]
2332 '(menu-item "Insert Past Input(s) using Completion" icicle-insert-history-element
2333 :enable (consp (symbol-value minibuffer-history-variable))
2334 :help "Use completion to insert a previous input into the minibuffer"))
2335 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var]
2336 '(menu-item "Insert String from a Variable..." icicle-insert-string-from-variable
2337 :visible current-prefix-arg :keys "C-="
2338 :help "Read a variable name and insert its string value into the minibuffer"))
2339 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var]
2340 '(menu-item "Insert `icicle-input-string'" icicle-insert-string-from-variable
2341 :visible (not current-prefix-arg) :keys "C-="
2342 :help "Insert text from variable `icicle-input-string' into the minibuffer"))
2343 (define-key map [menu-bar minibuf icicle-insert-string-at-point]
2344 '(menu-item "Insert Text from Point" icicle-insert-string-at-point
2345 :help "Insert text at or near the cursor into the minibuffer"))
2346 (define-key map [menu-bar minibuf icicle-completing-read+insert]
2347 '(menu-item "Insert On-Demand Completion" icicle-completing-read+insert
2348 :visible (consp icicle-completing-read+insert-candidates)
2349 :help "Read and insert something using (lax) completion"))
2350 (define-key map [menu-bar minibuf icicle-read+insert-file-name]
2351 '(menu-item "Insert File Name" icicle-read+insert-file-name
2352 :help "Read and insert a file name using (lax) completion"))
2353
2354 ;; Keyboard keys
2355 (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2356 (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g'
2357 (dolist (key icicle-completing-read+insert-keys)
2358 (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c'
2359 (dolist (key icicle-read+insert-file-name-keys)
2360 (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f'
2361 )) ; End `minibuffer-local-ns-map'.
2362
2363 ;; `minibuffer-local-isearch-map': minibuffer map for editing isearch strings.
2364 ;; In Emacs 21+, local is parent of local-isearch.
2365 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-isearch-map))
2366 (let ((map minibuffer-local-isearch-map))
2367 (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit'
2368 '(menu-item "Quit" icicle-abort-recursive-edit
2369 :help "Cancel minibuffer input or recursive edit"))
2370 (define-key map [menu-bar minibuf return]
2371 '(menu-item "Enter" exit-minibuffer
2372 :help "Terminate input and exit minibuffer" :keys "RET"))
2373 (define-key map [menu-bar minibuf separator-help] '("--"))
2374
2375 (define-key map [menu-bar minibuf completion-help]
2376 '(menu-item "Icicles Help" icicle-minibuffer-help
2377 :help "Display help for minibuffer input and completion" :keys "M-?"))
2378 (define-key map [menu-bar minibuf separator-last] '("--"))
2379
2380 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain]
2381 '(menu-item "Toggle Searching Complement"
2382 icicle-toggle-search-complementing-domain
2383 :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~"))
2384 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current]
2385 '(menu-item "Toggle All-Current Icicle-Search Highlighting"
2386 icicle-toggle-highlight-all-current :enable icicle-searching-p
2387 :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^"))
2388 (define-key map [menu-bar minibuf icicle-multi-inputs-save]
2389 '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save
2390 :help "Add inputs in minibuffer to saved candidates set for completion"))
2391 (define-key map [menu-bar minibuf icicle-multi-inputs-act]
2392 '(menu-item "Act on multiple inputs in the minibuffer" icicle-multi-inputs-act
2393 :help "Parse minibuffer input into a list of candidates, then act on each"))
2394 (define-key map [menu-bar minibuf icicle-regexp-quote-input]
2395 '(menu-item "Regexp-Quote Input" icicle-regexp-quote-input
2396 :enable (with-current-buffer (window-buffer (minibuffer-window))
2397 (not (zerop (buffer-size))))
2398 :help "Regexp-quote current input or its active region, then apropos-complete"
2399 :keys "M-%"))
2400 (define-key map [menu-bar minibuf separator-set2] '("--"))
2401
2402 (define-key map [menu-bar minibuf icicle-clear-current-history]
2403 '(menu-item "Clear History Entries" icicle-clear-current-history
2404 :help "Clear current minibuffer history of selected entries"))
2405 (define-key map [menu-bar minibuf icicle-erase-minibuffer]
2406 '(menu-item "Delete from History" icicle-erase-minibuffer-or-history-element
2407 :visible (memq last-command
2408 '(previous-history-element next-history-element
2409 icicle-erase-minibuffer-or-history-element
2410 previous-matching-history-element next-matching-history-element))
2411 :help "Delete current history element (in minibuffer now)" :keys "M-k"))
2412 (define-key map [menu-bar minibuf icicle-delete-history-element]
2413 '(menu-item "Clear (Erase) Minibuffer" icicle-erase-minibuffer-or-history-element
2414 :visible (not (memq last-command
2415 '(previous-history-element next-history-element
2416 icicle-erase-minibuffer-or-history-element
2417 previous-matching-history-element next-matching-history-element)))
2418 :help "Erase the Minibuffer" :keys "M-k"))
2419 (define-key map [menu-bar minibuf icicle-insert-list-join-string]
2420 '(menu-item "Insert Join-String" icicle-insert-list-join-string
2421 :help "Insert `icicle-list-join-string' into the minibuffer"))
2422 (define-key map [menu-bar minibuf icicle-insert-key-description]
2423 '(menu-item "Insert Key Description" icicle-insert-key-description
2424 :visible (not icicle-searching-p) :keys "M-q"
2425 :help "Read key and insert its description - e.g., reading ^F inserts `C-f'"))
2426 (define-key map [menu-bar minibuf icicle-roundup]
2427 '(menu-item "Insert Completion Candidate(s)" icicle-roundup
2428 :enable (and (icicle-completing-p) icicle-completion-candidates)
2429 :help "Insert one or more completion candidates in the minibuffer"))
2430 (define-key map [menu-bar minibuf icicle-insert-history-element]
2431 '(menu-item "Insert Past Input(s) using Completion" icicle-insert-history-element
2432 :enable (consp (symbol-value minibuffer-history-variable))
2433 :help "Use completion to insert a previous input into the minibuffer"))
2434 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var]
2435 '(menu-item "Insert String from a Variable..." icicle-insert-string-from-variable
2436 :visible current-prefix-arg :keys "C-="
2437 :help "Read a variable name and insert its string value into the minibuffer"))
2438 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var]
2439 '(menu-item "Insert `icicle-input-string'" icicle-insert-string-from-variable
2440 :visible (not current-prefix-arg) :keys "C-="
2441 :help "Insert text from variable `icicle-input-string' into the minibuffer"))
2442 (define-key map [menu-bar minibuf icicle-insert-string-at-point]
2443 '(menu-item "Insert Text from Point" icicle-insert-string-at-point
2444 :help "Insert text at or near the cursor into the minibuffer"))
2445 (define-key map [menu-bar minibuf icicle-completing-read+insert]
2446 '(menu-item "Insert On-Demand Completion" icicle-completing-read+insert
2447 :visible (consp icicle-completing-read+insert-candidates)
2448 :help "Read and insert something using (lax) completion"))
2449 (define-key map [menu-bar minibuf icicle-read+insert-file-name]
2450 '(menu-item "Insert File Name" icicle-read+insert-file-name
2451 :help "Read and insert a file name using (lax) completion"))
2452
2453 ;; Keyboard keys
2454 (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2455 (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g'
2456 (dolist (key icicle-completing-read+insert-keys)
2457 (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c'
2458 (dolist (key icicle-read+insert-file-name-keys)
2459 (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f'
2460 )) ; End `minibuffer-local-isearch-map'.
2461
2462 ;; `minibuffer-local-completion-map': completion map.
2463 (icicle-bind-completion-keys minibuffer-local-completion-map)
2464
2465 ;; `minibuffer-local-must-match-map': must-match map.
2466 ;; In Emacs 22+, local-completion is parent of local-must-match.
2467 (let ((map minibuffer-local-must-match-map))
2468 (if (not (eq minibuffer-local-completion-map (keymap-parent map)))
2469 (icicle-bind-completion-keys map)
2470 ;; Keyboard keys
2471 (icicle-bind-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2472 ;; Need `C-g' anyway, even if `minibuffer-local-must-match-map' inherits completion map.
2473 (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g'
2474 (dolist (key icicle-completing-read+insert-keys)
2475 (define-key map key 'icicle-completing-read+insert)) ; `C-M-S-c'
2476 (dolist (key icicle-read+insert-file-name-keys)
2477 (define-key map key 'icicle-read+insert-file-name)) ; `C-M-S-f'
2478 )) ; End `minibuffer-local-must-match-map'.
2479
2480 ;; `completion-list-mode-map': map for `*Completions*' buffer.
2481 ;; Abort on `C-g' or `q'. Switch to minibuffer on `C-insert'. Do not allow normal input.
2482 (let ((map completion-list-mode-map))
2483 ;; Keyboard keys
2484 (icicle-bind-custom-minibuffer-keys map icicle-completion-list-key-bindings)
2485 (dolist (key icicle-candidate-help-keys) ; `C-M-return', `C-help', `C-M-help', `C-f1',
2486 (define-key map key 'icicle-help-on-candidate)) ; `C-M-f1'
2487 (define-key map (icicle-kbd "C-g") 'icicle-abort-recursive-edit) ; `C-g'
2488 )) ; End `completion-list-mode-map'.
2489
2490 (t ; TURN IT OFF *******************************
2491
2492 ;; `minibuffer-local-map': default minibuffer map.
2493 (let ((map minibuffer-local-map))
2494
2495 ;; Menu-bar `Minibuf' menu.
2496 (define-key map [menu-bar minibuf quit]
2497 '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer"))
2498 (define-key map [menu-bar minibuf return]
2499 '(menu-item "Enter" exit-minibuffer
2500 :help "Terminate input and exit minibuffer" :keys "RET"))
2501 (define-key map [menu-bar minibuf separator-help] nil)
2502 (define-key map [menu-bar minibuf completion-help] nil)
2503 (define-key map [menu-bar minibuf separator-last] nil)
2504 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil)
2505 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil)
2506 (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil)
2507 (define-key map [menu-bar minibuf separator-set2] nil)
2508 (define-key map [menu-bar minibuf icicle-clear-current-history] nil)
2509 (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil)
2510 (define-key map [menu-bar minibuf icicle-delete-history-element] nil)
2511 (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil)
2512 (define-key map [menu-bar minibuf icicle-insert-key-description] nil)
2513 (define-key map [menu-bar minibuf icicle-insert-history-element] nil)
2514 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil)
2515 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil)
2516 (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil)
2517 (define-key map [menu-bar minibuf icicle-completing-read+insert] nil)
2518 (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil)
2519
2520 ;; Keyboard keys
2521 (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2522 (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) ; `C-M-S-c'
2523 (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ; `C-M-S-f'
2524 ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'.
2525 (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit)
2526 delete-selection-mode)
2527 'minibuffer-keyboard-quit
2528 'abort-recursive-edit)) ; `C-g'
2529 (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r'
2530 (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s'
2531 (define-key map (icicle-kbd "C-j") 'exit-minibuffer) ; `C-j'
2532 ) ; End `minibuffer-local-map'.
2533
2534 ;; `minibuffer-local-ns-map': default minibuffer map when spaces are not allowed.
2535 ;; In Emacs 22+, local is parent of local-ns.
2536 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-ns-map))
2537 (let ((map minibuffer-local-ns-map))
2538 (define-key map [menu-bar minibuf quit]
2539 '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer"))
2540 (define-key map [menu-bar minibuf return]
2541 '(menu-item "Enter" exit-minibuffer
2542 :help "Terminate input and exit minibuffer" :keys "RET"))
2543 (define-key map [menu-bar minibuf separator-help] nil)
2544 (define-key map [menu-bar minibuf completion-help] nil)
2545 (define-key map [menu-bar minibuf separator-last] nil)
2546 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil)
2547 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil)
2548 (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil)
2549 (define-key map [menu-bar minibuf separator-set2] nil)
2550 (define-key map [menu-bar minibuf icicle-clear-current-history] nil)
2551 (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil)
2552 (define-key map [menu-bar minibuf icicle-delete-history-element] nil)
2553 (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil)
2554 (define-key map [menu-bar minibuf icicle-insert-key-description] nil)
2555 (define-key map [menu-bar minibuf icicle-insert-history-element] nil)
2556 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil)
2557 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil)
2558 (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil)
2559 (define-key map [menu-bar minibuf icicle-completing-read+insert] nil)
2560 (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil)
2561
2562 ;; Keyboard keys
2563 (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2564 (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) ; `C-M-S-c'
2565 (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ; `C-M-S-f'
2566 ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'.
2567 (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit)
2568 delete-selection-mode)
2569 'minibuffer-keyboard-quit
2570 'abort-recursive-edit)) ; `C-g'
2571 (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r'
2572 (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s'
2573 (define-key map (icicle-kbd "C-j") 'exit-minibuffer) ; `C-j'
2574 )) ; End `minibuffer-local-ns-map'.
2575
2576 ;; `minibuffer-local-isearch-map': minibuffer map for editing isearch strings.
2577 ;; In Emacs 21+, local is parent of local-isearch
2578 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-isearch-map))
2579 (let ((map minibuffer-local-isearch-map))
2580 (define-key map [menu-bar minibuf quit]
2581 '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer"))
2582 (define-key map [menu-bar minibuf return]
2583 '(menu-item "Enter" exit-minibuffer
2584 :help "Terminate input and exit minibuffer" :keys "RET"))
2585 (define-key map [menu-bar minibuf separator-help] nil)
2586 (define-key map [menu-bar minibuf completion-help] nil)
2587 (define-key map [menu-bar minibuf separator-last] nil)
2588 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil)
2589 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil)
2590 (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil)
2591 (define-key map [menu-bar minibuf separator-set2] nil)
2592 (define-key map [menu-bar minibuf icicle-clear-current-history] nil)
2593 (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil)
2594 (define-key map [menu-bar minibuf icicle-delete-history-element] nil)
2595 (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil)
2596 (define-key map [menu-bar minibuf icicle-insert-key-description] nil)
2597 (define-key map [menu-bar minibuf icicle-insert-history-element] nil)
2598 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil)
2599 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil)
2600 (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil)
2601 (define-key map [menu-bar minibuf icicle-completing-read+insert] nil)
2602 (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil)
2603
2604 ;; Keyboard keys
2605 (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2606 (dolist (key icicle-completing-read+insert-keys) (define-key map key nil)) ; `C-M-S-c'
2607 (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil)) ; `C-M-S-f'
2608 ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'.
2609 (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit)
2610 delete-selection-mode)
2611 'minibuffer-keyboard-quit
2612 'abort-recursive-edit)) ; `C-g'
2613 (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r'
2614 (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s'
2615 (define-key map (icicle-kbd "C-j") 'exit-minibuffer) ; `C-j'
2616 )) ; End `minibuffer-local-isearch-map'.
2617
2618 ;; `minibuffer-local-completion-map': completion map.
2619 (icicle-restore-completion-keys minibuffer-local-completion-map)
2620
2621 ;; `minibuffer-local-must-match-map': must-match map.
2622 ;; In Emacs 22+, local-completion is parent of local-must-match
2623 (let ((map minibuffer-local-must-match-map))
2624 (if (not (eq minibuffer-local-completion-map (keymap-parent map)))
2625 (icicle-restore-completion-keys map)
2626 ;; Keyboard keys
2627 (icicle-restore-custom-minibuffer-keys map icicle-minibuffer-key-bindings)
2628 (dolist (key icicle-completing-read+insert-keys) (define-key map key nil))
2629 (dolist (key icicle-read+insert-file-name-keys) (define-key map key nil))
2630 ;; Do the non-nil bindings no matter what might be in `icicle-minibuffer-key-bindings'.
2631 ;; Need do `C-g' anyway, even if inherit completion map.
2632 (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit)
2633 delete-selection-mode)
2634 'minibuffer-keyboard-quit
2635 'abort-recursive-edit)) ; `C-g'
2636 (define-key map (icicle-kbd "M-r") 'previous-matching-history-element) ; `M-r'
2637 (define-key map (icicle-kbd "M-s") 'next-matching-history-element) ; `M-s'
2638 (define-key map (icicle-kbd "C-j") 'minibuffer-complete-and-exit) ; `C-j' (newline)
2639 )) ; End `minibuffer-local-must-match-map'.
2640
2641 ;; `completion-list-mode-map': map for `*Completions*' buffer.
2642 (let ((map completion-list-mode-map))
2643 ;; Keyboard keys
2644 (icicle-restore-custom-minibuffer-keys map icicle-completion-list-key-bindings)
2645 (dolist (key icicle-candidate-help-keys) (define-key map key nil))
2646 (define-key map (icicle-kbd "C-g") nil)
2647 ;; Do these last:
2648 (define-key map (icicle-kbd "right") 'next-completion)
2649 (define-key map (icicle-kbd "left") 'previous-completion))))
2650 (when (and (interactive-p) turn-on-p)
2651 (message (substitute-command-keys
2652 "Use `\\<minibuffer-local-completion-map>\
2653 \\[icicle-minibuffer-help]' in minibuffer for help."))))
2654
2655 (defun icicle-unmap (command map current)
2656 "In MAP, unbind any keys that are bound to COMMAND.
2657 If command remapping is available, remap COMMAND to nil in MAP,
2658 unbinding it.
2659 Otherwise, bind COMMAND to whatever CURRENT is bound to in MAP."
2660 (if (fboundp 'command-remapping)
2661 (define-key map (vector 'remap command) nil)
2662 (substitute-key-definition current command map)))
2663
2664 (defun icicle-rebind-global (old new map)
2665 "Bind command NEW in MAP to all keys currently bound globally to OLD."
2666 (substitute-key-definition old new map (current-global-map)))
2667
2668 (defun icicle-bind-completion-keys (map)
2669 "Bind keys for minibuffer completion map MAP.
2670 MAP is `minibuffer-local-completion-map' or
2671 `minibuffer-local-must-match-map'."
2672
2673 ;; Menu-bar `Minibuf' menu.
2674
2675 ;; In Emacs 22+, local is parent of local-completion
2676 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map))
2677 (define-key map [menu-bar minibuf quit] ; Replace `keyboard-escape-quit'
2678 '(menu-item "Quit" icicle-abort-recursive-edit
2679 :help "Cancel minibuffer input or recursive edit"))
2680 (define-key map [menu-bar minibuf return]
2681 '(menu-item "Enter" exit-minibuffer
2682 :help "Terminate input and exit minibuffer" :keys "RET"))
2683 (define-key map [menu-bar minibuf separator-help] '("--"))
2684
2685 (define-key map [menu-bar minibuf completion-help]
2686 '(menu-item "Icicles Help" icicle-minibuffer-help
2687 :help "Display help for minibuffer input and completion" :keys "M-?"))
2688 (define-key map [menu-bar minibuf separator-last] '("--"))
2689
2690 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain]
2691 '(menu-item "Toggle Searching Complement"
2692 icicle-toggle-search-complementing-domain
2693 :help "Toggle `icicle-search-complement-domain-p'" :keys "C-M-~"))
2694 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current]
2695 '(menu-item "Toggle All-Current Icicle-Search Highlighting"
2696 icicle-toggle-highlight-all-current :enable icicle-searching-p
2697 :help "Toggle `icicle-search-highlight-all-current-flag'" :keys "C-^"))
2698 (define-key map [menu-bar minibuf icicle-multi-inputs-save]
2699 '(menu-item "Save Multiple Inputs for Completion" icicle-multi-inputs-save
2700 :help "Add inputs in minibuffer to saved candidates set for completion"))
2701 (define-key map [menu-bar minibuf icicle-multi-inputs-act]
2702 '(menu-item "Act on multiple inputs in the minibuffer" icicle-multi-inputs-act
2703 :help "Parse minibuffer input into a list of candidates, then act on each"))
2704 (define-key map [menu-bar minibuf icicle-regexp-quote-input]
2705 '(menu-item "Regexp-Quote Input" icicle-regexp-quote-input
2706 :enable (with-current-buffer (window-buffer (minibuffer-window)) (not (zerop (buffer-size))))
2707 :help "Regexp-quote current input or its active region, then apropos-complete"
2708 :keys "M-%"))
2709 (define-key map [menu-bar minibuf separator-set2] '("--"))
2710
2711 (define-key map [menu-bar minibuf icicle-clear-current-history]
2712 '(menu-item "Clear History Entries" icicle-clear-current-history
2713 :help "Clear current minibuffer history of selected entries"))
2714 (define-key map [menu-bar minibuf icicle-erase-minibuffer]
2715 '(menu-item "Delete from History" icicle-erase-minibuffer-or-history-element
2716 :visible (memq last-command
2717 '(previous-history-element next-history-element
2718 icicle-erase-minibuffer-or-history-element
2719 previous-matching-history-element next-matching-history-element))
2720 :help "Delete current history element (in minibuffer now)" :keys "M-k"))
2721 (define-key map [menu-bar minibuf icicle-delete-history-element]
2722 '(menu-item "Clear (Erase) Minibuffer" icicle-erase-minibuffer-or-history-element
2723 :visible (not (memq last-command
2724 '(previous-history-element next-history-element
2725 icicle-erase-minibuffer-or-history-element
2726 previous-matching-history-element next-matching-history-element)))
2727 :help "Erase the Minibuffer" :keys "M-k"))
2728 (define-key map [menu-bar minibuf icicle-insert-list-join-string]
2729 '(menu-item "Insert Join-String" icicle-insert-list-join-string
2730 :help "Insert `icicle-list-join-string' into the minibuffer"))
2731 (define-key map [menu-bar minibuf icicle-insert-key-description]
2732 '(menu-item "Insert Key Description" icicle-insert-key-description
2733 :visible (not icicle-searching-p) :keys "M-q"
2734 :help "Read key and insert its description - e.g., reading ^F inserts `C-f'"))
2735 (define-key map [menu-bar minibuf icicle-roundup]
2736 '(menu-item "Insert Completion Candidate(s)" icicle-roundup
2737 :enable (and (icicle-completing-p) icicle-completion-candidates)
2738 :help "Insert one or more completion candidates in the minibuffer"))
2739 (define-key map [menu-bar minibuf icicle-insert-history-element]
2740 '(menu-item "Insert Past Input(s) using Completion" icicle-insert-history-element
2741 :help "Use completion to insert a previous input into the minibuffer"))
2742 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var]
2743 '(menu-item "Insert String from a Variable..." icicle-insert-string-from-variable
2744 :visible current-prefix-arg :keys "C-="
2745 :help "Read a variable name and insert its string value into the minibuffer"))
2746 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var]
2747 '(menu-item "Insert `icicle-input-string'" icicle-insert-string-from-variable
2748 :visible (not current-prefix-arg) :keys "C-="
2749 :help "Insert text from variable `icicle-input-string' into the minibuffer"))
2750 (define-key map [menu-bar minibuf icicle-insert-string-at-point]
2751 '(menu-item "Insert Text from Point" icicle-insert-string-at-point
2752 :help "Insert text at or near the cursor into the minibuffer"))
2753 (define-key map [menu-bar minibuf icicle-completing-read+insert]
2754 '(menu-item "Insert On-Demand Completion" icicle-completing-read+insert
2755 :visible (consp icicle-completing-read+insert-candidates)
2756 :help "Read and insert something using (lax) completion"))
2757 (define-key map [menu-bar minibuf icicle-read+insert-file-name]
2758 '(menu-item "Insert File Name" icicle-read+insert-file-name
2759 :help "Read and insert a file name using (lax) completion"))
2760 )
2761 (define-key map [menu-bar minibuf icicle-goto/kill-failed-input]
2762 '(menu-item "Cursor to Mismatch (Repeat: Kill)" icicle-goto/kill-failed-input
2763 :enable (and (overlayp icicle-input-completion-fail-overlay)
2764 (overlay-start icicle-input-completion-fail-overlay))
2765 :help "Put cursor where input fails to complete - repeat to kill mismatch"))
2766 (define-key map [menu-bar minibuf icicle-retrieve-next-input]
2767 '(menu-item "Restore Next Completion Input" icicle-retrieve-next-input
2768 :enable (consp (symbol-value (if (icicle-file-name-input-p)
2769 'icicle-previous-raw-file-name-inputs
2770 'icicle-previous-raw-non-file-name-inputs)))
2771 :help "Cycle forward to insert a previous completion input in the minibuffer (`C-u': \
2772 complete)"))
2773 (define-key map [menu-bar minibuf icicle-retrieve-previous-input]
2774 '(menu-item "Restore Previous Completion Input" icicle-retrieve-previous-input
2775 :enable (consp (symbol-value (if (icicle-file-name-input-p)
2776 'icicle-previous-raw-file-name-inputs
2777 'icicle-previous-raw-non-file-name-inputs)))
2778 :help "Cycle backward to insert a previous completion input in the minibuffer (`C-u': \
2779 complete)"))
2780 (define-key map [menu-bar minibuf separator-C-l] '("--"))
2781
2782 (define-key map [menu-bar minibuf ?\?] nil)
2783 (define-key map [menu-bar minibuf space] nil)
2784 (define-key map [menu-bar minibuf tab] nil)
2785 (define-key map [menu-bar minibuf alt-action-list-all]
2786 '(menu-item "Alt Act on List of Candidates" icicle-all-candidates-list-alt-action
2787 :help "Apply the alternative action to the list of matching completion candidates"
2788 :enable icicle-all-candidates-list-alt-action-fn))
2789 (define-key map [menu-bar minibuf alt-action-all]
2790 '(menu-item "Alt Act on Each Candidate" icicle-all-candidates-alt-action
2791 :help "Apply the alternative action to each matching completion candidates"
2792 :enable icicle-candidate-alt-action-fn))
2793 (define-key map [menu-bar minibuf action-list-all]
2794 '(menu-item "Act on List of Candidates" icicle-all-candidates-list-action
2795 :help "Apply the command action to the list of matching completion candidates"
2796 :enable icicle-all-candidates-list-action-fn))
2797 (define-key map [menu-bar minibuf action-all]
2798 '(menu-item "Act on Each Candidate" icicle-all-candidates-action
2799 :help "Apply the command action to each matching completion candidates"
2800 :enable icicle-candidate-action-fn))
2801 (define-key map [menu-bar minibuf separator-actions] '("--"))
2802
2803 (define-key map [menu-bar minibuf set-define]
2804 '(menu-item "Define Candidates by Lisp Sexp" icicle-candidate-set-define
2805 :help "Define the set of current completion candidates by evaluating a sexp"))
2806 (define-key map [menu-bar minibuf icicle-keep-only-past-inputs]
2807 '(menu-item "Keep Only Previously Entered" icicle-keep-only-past-inputs
2808 :enable (and icicle-completion-candidates (consp (symbol-value minibuffer-history-variable)))
2809 :help "Removed candidates that you have not previously chosen and entered"))
2810 (define-key map [menu-bar minibuf set-union]
2811 '(menu-item "Add (Union) Saved Candidate Set" icicle-candidate-set-union
2812 :enable icicle-saved-completion-candidates
2813 :help "Set union between the current and saved completion candidates"))
2814 (define-key map [menu-bar minibuf set-difference]
2815 '(menu-item "Subtract Saved Candidate Set" icicle-candidate-set-difference
2816 :enable icicle-saved-completion-candidates
2817 :help "Set difference between the current and saved completion candidates"))
2818 (define-key map [menu-bar minibuf set-intersection]
2819 '(menu-item "Intersect Saved Candidate Set" icicle-candidate-set-intersection
2820 :enable icicle-saved-completion-candidates
2821 :help "Set intersection between the current and saved candidates"))
2822 (define-key map [menu-bar minibuf icicle-save-predicate-to-variable]
2823 '(menu-item "Save Predicate to Variable" icicle-save-predicate-to-variable
2824 :help "Save the current completion predicate to a variable"))
2825 (define-key map [menu-bar minibuf icicle-narrow-candidates-with-predicate]
2826 '(menu-item "Satisfy Also Predicate..." icicle-narrow-candidates-with-predicate
2827 :help "Match another input pattern (narrow completions set)"
2828 :enable icicle-completion-candidates))
2829 (define-key map [menu-bar minibuf icicle-narrow-candidates]
2830 '(menu-item "Match Also Regexp..." icicle-narrow-candidates
2831 :enable icicle-completion-candidates
2832 :help "Match another input pattern (narrow completions set)"))
2833 (define-key map [menu-bar minibuf icicle-widen-candidates]
2834 '(menu-item "Match Alternative..." icicle-widen-candidates
2835 :enable icicle-completion-candidates
2836 :help "Match alternative input pattern (widen completions set)"))
2837 (define-key map [menu-bar minibuf set-complement]
2838 '(menu-item "Complement Candidates" icicle-candidate-set-complement
2839 :help "Complement the set of current completion candidates"))
2840 (define-key map [menu-bar minibuf separator-set1] '("--"))
2841
2842 (define-key map [menu-bar minibuf set-swap]
2843 '(menu-item "Swap Saved and Current Sets" icicle-candidate-set-swap
2844 :enable icicle-saved-completion-candidates
2845 :help "Swap the saved and current sets of completion candidates"))
2846 (define-key map [menu-bar minibuf icicle-candidate-set-save-more-selected]
2847 '(menu-item "Save More Selected (Region) Candidates"
2848 icicle-candidate-set-save-more-selected
2849 :help "Add the candidates in the region to the saved candidates"))
2850 (define-key map [menu-bar minibuf icicle-candidate-set-save-selected]
2851 '(menu-item "Save Selected (Region) Candidates"
2852 icicle-candidate-set-save-selected
2853 :help "Save the candidates in the region, for later recall"))
2854 (define-key map [menu-bar minibuf icicle-candidate-set-save-more]
2855 '(menu-item "Save More Candidates" icicle-candidate-set-save-more
2856 :help "Add current completion candidates to saved candidates set"))
2857 (define-key map [menu-bar minibuf set-save-to-cache-file]
2858 '(menu-item " to Cache File..." icicle-candidate-set-save-persistently
2859 :help "Save current completion candidates to a cache file, for later recall"))
2860 (define-key map [menu-bar minibuf set-save-to-variable]
2861 '(menu-item " to Variable..." icicle-candidate-set-save-to-variable
2862 :help "Save current completion candidates to a variable, for later recall"))
2863 (define-key map [menu-bar minibuf set-save]
2864 '(menu-item "Save Candidates" icicle-candidate-set-save
2865 :help "Save the set of current completion candidates, for later recall"))
2866 (define-key map [menu-bar minibuf icicle-candidate-set-retrieve-more]
2867 '(menu-item "Retrieve More Saved Candidates"
2868 icicle-candidate-set-retrieve-more
2869 :help "Add saved candidates to current completion candidates"))
2870 (define-key map [menu-bar minibuf set-retrieve-from-cache-file]
2871 '(menu-item " from Cache File..."
2872 icicle-candidate-set-retrieve-persistent
2873 :help "Retrieve saved completion candidates from a cache file, making them current"))
2874 (define-key map [menu-bar minibuf set-retrieve-from-variable]
2875 '(menu-item " from Variable..." icicle-candidate-set-retrieve-from-variable
2876 :help "Retrieve saved completion candidates from variable, making them current"))
2877 (define-key map [menu-bar minibuf set-retrieve]
2878 '(menu-item "Retrieve Saved Candidates" icicle-candidate-set-retrieve
2879 :enable icicle-saved-completion-candidates
2880 :help "Retrieve the saved set of completion candidates, making it current"))
2881 (define-key map [menu-bar minibuf separator-complete] '("--"))
2882
2883 (define-key map [menu-bar minibuf word-complete]
2884 '(menu-item "Word-Complete" icicle-prefix-word-complete
2885 :help "Complete at most one word of prefix"))
2886 (define-key map [menu-bar minibuf prefix-complete]
2887 '(menu-item "Prefix-Complete" icicle-prefix-complete
2888 :help "Complete prefix as far as possible"))
2889 (define-key map [menu-bar minibuf apropos-complete]
2890 '(menu-item "Apropos-Complete" icicle-apropos-complete :keys "S-TAB"
2891 :help "Complete regular expression as far as possible and list completions"))
2892
2893 ;; Remap some commands for completion.
2894 (icicle-remap 'self-insert-command 'icicle-self-insert map (current-global-map))
2895 (icicle-remap 'universal-argument 'icicle-universal-argument ; `C-u'
2896 map (current-global-map))
2897 (icicle-remap 'negative-argument 'icicle-negative-argument ; `M--'
2898 map (current-global-map))
2899 (icicle-remap 'digit-argument 'icicle-digit-argument ; `C-9'
2900 map (current-global-map))
2901 (icicle-remap 'backward-delete-char-untabify 'icicle-backward-delete-char-untabify ; `DEL'
2902 map (current-global-map))
2903 (icicle-remap 'delete-backward-char 'icicle-delete-backward-char ; `DEL'
2904 map (current-global-map))
2905 (icicle-remap 'delete-char 'icicle-delete-char ; `C-d', `deletechar'
2906 map (current-global-map))
2907 (icicle-remap 'backward-kill-word 'icicle-backward-kill-word ; `M-DEL'
2908 map (current-global-map))
2909 (icicle-remap 'kill-word 'icicle-kill-word ; `M-d'
2910 map (current-global-map))
2911 (icicle-remap 'backward-kill-sexp 'icicle-backward-kill-sexp ; `C-M-backspace'
2912 map (current-global-map))
2913 (icicle-remap 'kill-sexp 'icicle-kill-sexp ; `C-M-k', `C-M-delete'
2914 map (current-global-map))
2915 (icicle-remap 'backward-kill-sentence 'icicle-backward-kill-sentence ; `C-x DEL'
2916 map (current-global-map))
2917 (icicle-remap 'backward-kill-paragraph 'icicle-backward-kill-paragraph ; `C-backspace'
2918 map (current-global-map))
2919 (icicle-remap 'kill-paragraph 'icicle-kill-paragraph ; `C-delete'
2920 map (current-global-map))
2921 (icicle-remap 'kill-line 'icicle-kill-line ; `C-k', `deleteline'
2922 map (current-global-map))
2923 (icicle-remap 'reposition-window 'icicle-goto/kill-failed-input ; `C-M-l'
2924 map (current-global-map))
2925 (icicle-remap 'transpose-chars 'icicle-transpose-chars ; `C-t'
2926 map (current-global-map))
2927 (icicle-remap 'transpose-words 'icicle-transpose-words ; `M-t'
2928 map (current-global-map))
2929 (icicle-remap 'transpose-sexps 'icicle-transpose-sexps ; `C-M-t'
2930 map (current-global-map))
2931 (icicle-remap 'yank-pop 'icicle-yank-pop ; `M-y', `M-insert'
2932 map (current-global-map))
2933 (icicle-remap 'mouse-yank-secondary 'icicle-mouse-yank-secondary ; `M-mouse-2'
2934 map (current-global-map))
2935
2936 ;; Bind additional keys.
2937 (dolist (key icicle-candidate-action-keys)
2938 (define-key map key 'icicle-candidate-action)) ; `C-return', `C-RET'
2939 (dolist (key icicle-candidate-help-keys) ; `C-M-return', `C-M-RET', `C-help', `C-M-help',
2940 (define-key map key 'icicle-help-on-candidate)) ; `C-f1', `C-M-f1'
2941
2942 (dolist (key icicle-word-completion-keys)
2943 (define-key map key 'icicle-prefix-word-complete)) ; `M-SPC'
2944 (dolist (key icicle-apropos-complete-keys)
2945 (define-key map key 'icicle-apropos-complete)) ; `S-TAB'
2946 (dolist (key icicle-prefix-complete-keys) (define-key map key 'icicle-prefix-complete)) ; `TAB'
2947 (dolist (key icicle-apropos-complete-no-display-keys)
2948 (define-key map key 'icicle-apropos-complete-no-display)) ; `C-M-S-TAB'
2949 (dolist (key icicle-prefix-complete-no-display-keys)
2950 (define-key map key 'icicle-prefix-complete-no-display)) ; `C-M-TAB'
2951 (icicle-define-cycling-keys map) ; `up', `down', `prior', `next',
2952 ; `C-up', `C-down', `C-prior', `C-next',
2953 ; `C-M-up', `C-M-down', `C-M-prior', `C-M-next',
2954 ; `C-S-up', `C-S-down', `C-S-prior', `C-S-next',
2955 (icicle-bind-custom-minibuffer-keys map icicle-completion-key-bindings))
2956
2957 (defun icicle-restore-completion-keys (map)
2958 "Restore standard keys for minibuffer completion map MAP.
2959 MAP is `minibuffer-local-completion-map',
2960 `minibuffer-local-filename-completion-map', or
2961 `minibuffer-local-must-match-map'."
2962
2963 ;; Menu-bar `Minibuf' menu.
2964 ;; In Emacs 22+, local is parent of local-completion
2965 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map))
2966 (define-key map [menu-bar minibuf quit]
2967 '(menu-item "Quit" keyboard-escape-quit :help "Abort input and exit minibuffer"))
2968 (define-key map [menu-bar minibuf return]
2969 '(menu-item "Enter" exit-minibuffer
2970 :help "Terminate input and exit minibuffer" :keys "RET"))
2971 (define-key map [menu-bar minibuf separator-help] nil)
2972 (define-key map [menu-bar minibuf completion-help] nil)
2973 (define-key map [menu-bar minibuf separator-last] nil)
2974 (define-key map [menu-bar minibuf icicle-clear-current-history] nil)
2975 (define-key map [menu-bar minibuf icicle-toggle-search-complementing-domain] nil)
2976 (define-key map [menu-bar minibuf icicle-toggle-highlight-all-current] nil)
2977 (define-key map [menu-bar minibuf icicle-regexp-quote-input] nil)
2978 (define-key map [menu-bar minibuf separator-set2] nil)
2979 (define-key map [menu-bar minibuf icicle-clear-current-history] nil)
2980 (define-key map [menu-bar minibuf icicle-erase-minibuffer] nil)
2981 (define-key map [menu-bar minibuf icicle-delete-history-element] nil)
2982 (define-key map [menu-bar minibuf icicle-insert-list-join-string] nil)
2983 (define-key map [menu-bar minibuf icicle-insert-key-description] nil)
2984 (define-key map [menu-bar minibuf icicle-insert-history-element] nil)
2985 (define-key map [menu-bar minibuf icicle-insert-string-from-a-var] nil)
2986 (define-key map [menu-bar minibuf icicle-insert-string-from-std-var] nil)
2987 (define-key map [menu-bar minibuf icicle-insert-string-at-point] nil)
2988 (define-key map [menu-bar minibuf icicle-completing-read+insert] nil)
2989 (define-key map [menu-bar minibuf icicle-read+insert-file-name] nil)
2990 )
2991 (define-key map [menu-bar minibuf icicle-goto/kill-failed-input] nil)
2992 (define-key map [menu-bar minibuf icicle-retrieve-next-input] nil)
2993 (define-key map [menu-bar minibuf icicle-retrieve-previous-input] nil)
2994 (define-key map [menu-bar minibuf separator-C-l] nil)
2995 (define-key map [menu-bar minibuf alt-action-list-all] nil)
2996 (define-key map [menu-bar minibuf alt-action-all] nil)
2997 (define-key map [menu-bar minibuf action-list-all] nil)
2998 (define-key map [menu-bar minibuf action-all] nil)
2999 (define-key map [menu-bar minibuf separator-actions] nil)
3000 (define-key map [menu-bar minibuf set-define] nil)
3001 (define-key map [menu-bar minibuf icicle-keep-only-past-inputs] nil)
3002 (define-key map [menu-bar minibuf set-union] nil)
3003 (define-key map [menu-bar minibuf set-difference] nil)
3004 (define-key map [menu-bar minibuf set-intersection] nil)
3005 (define-key map [menu-bar minibuf icicle-save-predicate-to-variable] nil)
3006 (define-key map [menu-bar minibuf icicle-narrow-candidates-with-predicate] nil)
3007 (define-key map [menu-bar minibuf icicle-narrow-candidates] nil)
3008 (define-key map [menu-bar minibuf icicle-widen-candidates] nil)
3009 (define-key map [menu-bar minibuf set-complement] nil)
3010 (define-key map [menu-bar minibuf separator-set1] nil)
3011 (define-key map [menu-bar minibuf set-swap] nil)
3012 (define-key map [menu-bar minibuf icicle-candidate-set-save-more-selected] nil)
3013 (define-key map [menu-bar minibuf icicle-candidate-set-save-selected] nil)
3014 (define-key map [menu-bar minibuf icicle-candidate-set-save-more] nil)
3015 (define-key map [menu-bar minibuf set-retrieve-from-cache-file] nil)
3016 (define-key map [menu-bar minibuf set-retrieve-from-variable] nil)
3017 (define-key map [menu-bar minibuf set-retrieve] nil)
3018 (define-key map [menu-bar minibuf set-save-to-cache-file] nil)
3019 (define-key map [menu-bar minibuf set-save-to-variable] nil)
3020 (define-key map [menu-bar minibuf set-save] nil)
3021 (define-key map [menu-bar minibuf separator-set2] nil)
3022 (define-key map [menu-bar minibuf word-complete] nil)
3023 (define-key map [menu-bar minibuf prefix-complete] nil)
3024 (define-key map [menu-bar minibuf apropos-complete] nil)
3025 (define-key map [menu-bar minibuf ?\?]
3026 '(menu-item "List Completions" minibuffer-completion-help
3027 :help "Display all possible completions"))
3028 (define-key map [menu-bar minibuf space]
3029 '(menu-item "Complete Word" minibuffer-complete-word :help "Complete at most one word"))
3030 (define-key map [menu-bar minibuf tab]
3031 '(menu-item "Complete" minibuffer-complete :help "Complete as far as possible"))
3032
3033 ;; Unmap commands that were bound for completion.
3034 (icicle-unmap 'self-insert-command map 'icicle-self-insert)
3035 (icicle-unmap 'universal-argument map 'icicle-universal-argument)
3036 (icicle-unmap 'negative-argument map 'icicle-negative-argument)
3037 (icicle-unmap 'digit-argument map 'icicle-digit-argument)
3038 (icicle-unmap 'backward-delete-char-untabify map 'icicle-backward-delete-char-untabify)
3039 (icicle-unmap 'delete-backward-char map 'icicle-delete-backward-char)
3040 (icicle-unmap 'delete-char map 'icicle-delete-char)
3041 (icicle-unmap 'backward-kill-word map 'icicle-backward-kill-word)
3042 (icicle-unmap 'kill-word map 'icicle-kill-word)
3043 (icicle-unmap 'backward-kill-sexp map 'icicle-backward-kill-sexp)
3044 (icicle-unmap 'kill-sexp map 'icicle-kill-sexp)
3045 (icicle-unmap 'backward-kill-sentence map 'icicle-backward-kill-sentence)
3046 (icicle-unmap 'backward-kill-paragraph map 'icicle-backward-kill-paragraph)
3047 (icicle-unmap 'kill-paragraph map 'icicle-kill-paragraph)
3048 (icicle-unmap 'kill-line map 'icicle-kill-line)
3049 (icicle-unmap 'reposition-window map 'icicle-goto/kill-failed-input)
3050 (icicle-unmap 'transpose-chars map 'icicle-transpose-chars)
3051 (icicle-unmap 'transpose-words map 'icicle-transpose-words)
3052 (icicle-unmap 'transpose-sexps map 'icicle-transpose-sexps)
3053 (icicle-unmap 'yank-pop map 'icicle-yank-pop)
3054 (icicle-unmap 'mouse-yank-secondary map 'icicle-mouse-yank-secondary)
3055
3056 ;; Restore additional bindings.
3057 ;; Do the option keys first, so they can be rebound as needed.
3058 (dolist (key icicle-candidate-action-keys) (define-key map key nil))
3059 (dolist (key icicle-candidate-help-keys) (define-key map key nil))
3060 (dolist (key icicle-word-completion-keys) (define-key map key nil))
3061 (dolist (key icicle-apropos-complete-keys) (define-key map key nil))
3062 (dolist (key icicle-prefix-complete-keys) (define-key map key nil))
3063 (dolist (key icicle-apropos-complete-no-display-keys) (define-key map key nil))
3064 (dolist (key icicle-prefix-complete-no-display-keys) (define-key map key nil))
3065 (dolist (key icicle-prefix-cycle-previous-keys) (define-key map key nil))
3066 (dolist (key icicle-prefix-cycle-next-keys) (define-key map key nil))
3067 (dolist (key icicle-apropos-cycle-previous-keys) (define-key map key nil))
3068 (dolist (key icicle-apropos-cycle-next-keys) (define-key map key nil))
3069 (dolist (key icicle-prefix-cycle-previous-action-keys) (define-key map key nil))
3070 (dolist (key icicle-prefix-cycle-previous-alt-action-keys) (define-key map key nil))
3071 (dolist (key icicle-prefix-cycle-next-action-keys) (define-key map key nil))
3072 (dolist (key icicle-prefix-cycle-next-alt-action-keys) (define-key map key nil))
3073 (dolist (key icicle-apropos-cycle-previous-action-keys) (define-key map key nil))
3074 (dolist (key icicle-apropos-cycle-previous-alt-action-keys) (define-key map key nil))
3075 (dolist (key icicle-apropos-cycle-next-action-keys) (define-key map key nil))
3076 (dolist (key icicle-apropos-cycle-next-alt-action-keys) (define-key map key nil))
3077 (dolist (key icicle-modal-cycle-up-keys) (define-key map key nil))
3078 (dolist (key icicle-modal-cycle-down-keys) (define-key map key nil))
3079 (dolist (key icicle-modal-cycle-up-action-keys) (define-key map key nil))
3080 (dolist (key icicle-modal-cycle-up-alt-action-keys) (define-key map key nil))
3081 (dolist (key icicle-modal-cycle-down-action-keys) (define-key map key nil))
3082 (dolist (key icicle-modal-cycle-down-alt-action-keys) (define-key map key nil))
3083 (dolist (key icicle-modal-cycle-up-help-keys) (define-key map key nil))
3084 (dolist (key icicle-modal-cycle-down-help-keys) (define-key map key nil))
3085 (dolist (key icicle-prefix-cycle-previous-help-keys) (define-key map key nil))
3086 (dolist (key icicle-prefix-cycle-next-help-keys) (define-key map key nil))
3087 (dolist (key icicle-apropos-cycle-previous-help-keys) (define-key map key nil))
3088 (dolist (key icicle-apropos-cycle-next-help-keys) (define-key map key nil))
3089
3090 (icicle-restore-custom-minibuffer-keys map icicle-completion-key-bindings)
3091
3092 ;; Do these last. -----------------
3093 (define-key map (icicle-kbd "C-i") 'minibuffer-complete)
3094 (define-key map (icicle-kbd "tab") 'minibuffer-complete)
3095 (define-key map (icicle-kbd "?") 'minibuffer-completion-help)
3096 (define-key map (icicle-kbd "SPC") 'minibuffer-complete-word)
3097 (define-key map (icicle-kbd "C-g") (if (and (fboundp 'minibuffer-keyboard-quit)
3098 delete-selection-mode)
3099 'minibuffer-keyboard-quit
3100 'abort-recursive-edit))
3101 ;; In Emacs 22+, local is parent of local-completion
3102 (unless (eq minibuffer-local-map (keymap-parent minibuffer-local-completion-map))
3103 (define-key map (icicle-kbd "C-j") 'exit-minibuffer))
3104 (define-key map (icicle-kbd "M-p") 'previous-history-element)
3105 (define-key map (icicle-kbd "M-n") 'next-history-element)
3106 (define-key map (icicle-kbd "up") 'previous-history-element)
3107 (define-key map (icicle-kbd "down") 'next-history-element)
3108 (define-key map (icicle-kbd "M-v") 'switch-to-completions)
3109 (define-key map (icicle-kbd "prior") 'switch-to-completions)
3110 (define-key map (icicle-kbd "next") 'next-history-element))
3111
3112 (defun icicle-bind-custom-minibuffer-keys (map option &optional defs)
3113 "Bind customizable keys for minibuffer completion map MAP.
3114 These are the keys defined by option OPTION."
3115 (let (key command condition)
3116 (unless defs (setq defs option))
3117 (dolist (key-def defs)
3118 (setq key (car key-def)
3119 command (cadr key-def)
3120 condition (car (cddr key-def)))
3121 (when (eval condition)
3122 (if (symbolp key)
3123 (icicle-remap key command map)
3124 (define-key map key command))))))
3125
3126 (defun icicle-restore-custom-minibuffer-keys (map option)
3127 "Restore customizable keys for minibuffer map MAP.
3128 These are the keys defined by option OPTION."
3129 (let (key condition)
3130 (dolist (key-def option)
3131 (setq key (car key-def)
3132 condition (car (cddr key-def)))
3133 (when (eval condition)
3134 (if (symbolp key)
3135 (icicle-remap key nil map)
3136 (define-key map key nil))))))
3137
3138 (defun icicle-minibuffer-setup ()
3139 "Run in minibuffer on activation, to enable completion cycling.
3140 Usually run by inclusion in `minibuffer-setup-hook'."
3141 (when (and icicle-mode (window-minibuffer-p (selected-window)) (not executing-kbd-macro))
3142 ;; The pre- and post-command hooks are local to the
3143 ;; minibuffer, so they are added here, not in `icicle-mode'.
3144 ;; They are removed in `icicle-mode' when mode is exited.
3145 (unless (fboundp 'define-minor-mode) (make-local-hook 'pre-command-hook))
3146 (add-hook 'pre-command-hook 'icicle-top-level-prep) ; This must not be LOCAL (nil LOCAL arg).
3147 (add-hook 'pre-command-hook 'icicle-run-icicle-pre-command-hook nil t)
3148 (unless (fboundp 'define-minor-mode) (make-local-hook 'post-command-hook))
3149 (add-hook 'post-command-hook 'icicle-run-icicle-post-command-hook nil t)
3150 ;; Change the region background here dynamically. It would be better to
3151 ;; just use a buffer-local face, but those don't yet exist.
3152 (when (= 1 (recursion-depth))
3153 (setq icicle-saved-region-background (face-background 'region))
3154 (when icicle-change-region-background-flag
3155 (set-face-background 'region icicle-region-background)))
3156 ;; Reset prompt, because some commands (e.g. `find-file') don't use `read-file-name'
3157 ;; or `completing-read'. Reset other stuff too.
3158 (setq icicle-candidate-nb nil
3159 icicle-completion-candidates nil
3160 ;; This is so that cycling works right initially, without first hitting `TAB' or `S-TAB'.
3161 icicle-current-completion-mode (and (< (minibuffer-depth) 2)
3162 (case icicle-default-cycling-mode
3163 ((nil) nil)
3164 (apropos 'apropos)
3165 (prefix 'prefix)
3166 (otherwise nil)))
3167 icicle-mode-line-help nil
3168 icicle-next-apropos-complete-cycles-p nil
3169 icicle-next-prefix-complete-cycles-p nil
3170 icicle-incremental-completion-p icicle-incremental-completion
3171 icicle-initial-value nil
3172 icicle-cmd-reading-input this-command
3173 icicle-last-completion-command nil
3174 icicle-last-completion-candidate nil
3175 icicle-last-input nil
3176 icicle-input-fail-pos nil
3177 icicle-saved-proxy-candidates nil
3178 ;; `other-buffer' doesn't work, because it looks for a buffer only from the same frame.
3179 icicle-pre-minibuffer-buffer (cadr (buffer-list)) ; $$$$$$ (other-buffer nil t)
3180 )
3181 (when (and (icicle-completing-p) (> emacs-major-version 20))
3182 (let ((prompt-prefix (if icicle-candidate-action-fn "+ " ". ")))
3183 (put-text-property 0 1 'face
3184 (cond ((and icicle-candidate-action-fn (icicle-require-match-p))
3185 '(icicle-multi-command-completion icicle-mustmatch-completion))
3186 (icicle-candidate-action-fn 'icicle-multi-command-completion)
3187 ((icicle-require-match-p)
3188 '(icicle-completion icicle-mustmatch-completion))
3189 (t 'icicle-completion))
3190 prompt-prefix)
3191 (if (overlayp icicle-completion-prompt-overlay)
3192 (move-overlay icicle-completion-prompt-overlay (point-min) (point-min))
3193 (setq icicle-completion-prompt-overlay (make-overlay (point-min) (point-min))))
3194 (overlay-put icicle-completion-prompt-overlay 'before-string prompt-prefix)))
3195 (unless icicle-add-proxy-candidates-flag
3196 (setq icicle-saved-proxy-candidates (prog1 icicle-proxy-candidates
3197 (setq icicle-proxy-candidates
3198 icicle-saved-proxy-candidates))))
3199 (while icicle-saved-candidate-overlays
3200 (delete-overlay (car icicle-saved-candidate-overlays))
3201 (setq icicle-saved-candidate-overlays (cdr icicle-saved-candidate-overlays)))
3202 (icicle-update-ignored-extensions-regexp)
3203 (when (memq icicle-default-value '(preselect-start preselect-end))
3204 (icicle-select-minibuffer-contents))
3205 (when (and icicle-show-Completions-initially-flag
3206 (not icicle-progressive-completing-p) ; If narrowed, then we have already completed.
3207 (icicle-completing-p) ; Function initializes variable `icicle-completing-p'.
3208 (sit-for icicle-incremental-completion-delay)) ; Let user interrupt.
3209 (case icicle-default-cycling-mode
3210 (apropos (icicle-apropos-complete))
3211 (otherwise (icicle-prefix-complete)))) ; Prefix completion, by default.
3212 (run-hooks 'icicle-minibuffer-setup-hook)))
3213
3214 (defun icicle-define-cycling-keys (map)
3215 "Define keys for cycling candidates.
3216 The modal keys are defined first, then the non-modal keys.
3217 That means that in case of conflict mode-specific cyling wins.
3218 For example, if you define both `icicle-modal-cycle-up-keys' and
3219 `icicle-prefix-cycle-previous-keys' as ([up]), the latter gets the
3220 binding."
3221 (cond (icicle-use-C-for-actions-flag ; Use `C-' for actions, no `C-' for plain cycling.
3222 ;; Modal cycling keys.
3223 (dolist (key icicle-modal-cycle-up-keys)
3224 (define-key map key 'icicle-previous-candidate-per-mode)) ; `up'
3225 (dolist (key icicle-modal-cycle-down-keys)
3226 (define-key map key 'icicle-next-candidate-per-mode)) ; `down'
3227 (dolist (key icicle-modal-cycle-up-action-keys)
3228 (define-key map key 'icicle-previous-candidate-per-mode-action)) ; `C-up'
3229 (dolist (key icicle-modal-cycle-down-action-keys)
3230 (define-key map key 'icicle-next-candidate-per-mode-action)) ; `C-down'
3231 ;; Non-modal cycling keys. In case of conflict, these will prevail over modal keys.
3232 (dolist (key icicle-prefix-cycle-previous-keys)
3233 (define-key map key 'icicle-previous-prefix-candidate)) ; `home'
3234 (dolist (key icicle-prefix-cycle-next-keys)
3235 (define-key map key 'icicle-next-prefix-candidate)) ; `end'
3236 (dolist (key icicle-apropos-cycle-previous-keys)
3237 (define-key map key 'icicle-previous-apropos-candidate)) ; `prior'
3238 (dolist (key icicle-apropos-cycle-next-keys)
3239 (define-key map key 'icicle-next-apropos-candidate)) ; `next'
3240 (dolist (key icicle-prefix-cycle-previous-action-keys)
3241 (define-key map key 'icicle-previous-prefix-candidate-action)) ; `C-home'
3242 (dolist (key icicle-prefix-cycle-next-action-keys)
3243 (define-key map key 'icicle-next-prefix-candidate-action)) ; `C-end'
3244 (dolist (key icicle-apropos-cycle-previous-action-keys)
3245 (define-key map key 'icicle-previous-apropos-candidate-action)) ; `C-prior'
3246 (dolist (key icicle-apropos-cycle-next-action-keys)
3247 (define-key map key 'icicle-next-apropos-candidate-action))) ; `C-next'
3248
3249 (t ; Use `C-' for plain cycling, NO `C-' for action.
3250 ;; Modal cycling keys. At least some of these will overwrite non-modal keys.
3251 (dolist (key icicle-modal-cycle-up-keys)
3252 (define-key map key 'icicle-previous-candidate-per-mode-action)) ; `up'
3253 (dolist (key icicle-modal-cycle-down-keys)
3254 (define-key map key 'icicle-next-candidate-per-mode-action)) ; `down'
3255 (dolist (key icicle-modal-cycle-up-action-keys)
3256 (define-key map key 'icicle-previous-candidate-per-mode)) ; `C-up'
3257 (dolist (key icicle-modal-cycle-down-action-keys)
3258 (define-key map key 'icicle-next-candidate-per-mode)) ; `C-down'
3259 ;; Non-modal cycling keys. In case of conflict, these will prevail over modal keys.
3260 (dolist (key icicle-prefix-cycle-previous-keys)
3261 (define-key map key 'icicle-previous-prefix-candidate-action)) ; `home'
3262 (dolist (key icicle-prefix-cycle-next-keys)
3263 (define-key map key 'icicle-next-prefix-candidate-action)) ; `end'
3264 (dolist (key icicle-apropos-cycle-previous-keys)
3265 (define-key map key 'icicle-previous-apropos-candidate-action)) ; `prior'
3266 (dolist (key icicle-apropos-cycle-next-keys)
3267 (define-key map key 'icicle-next-apropos-candidate-action)) ; `next'
3268 (dolist (key icicle-prefix-cycle-previous-action-keys)
3269 (define-key map key 'icicle-previous-prefix-candidate)) ; `C-home'
3270 (dolist (key icicle-prefix-cycle-next-action-keys)
3271 (define-key map key 'icicle-next-prefix-candidate)) ; `C-end'
3272 (dolist (key icicle-apropos-cycle-previous-action-keys)
3273 (define-key map key 'icicle-previous-apropos-candidate)) ; `C-prior'
3274 (dolist (key icicle-apropos-cycle-next-action-keys)
3275 (define-key map key 'icicle-next-apropos-candidate))))
3276
3277 ;; Help and alternative-action keys are NOT controlled by `icicle-use-C-for-actions-flag'.
3278 ;;
3279 ;; Define modal cycling help and alternative action keys.
3280 (dolist (key icicle-modal-cycle-up-help-keys)
3281 (define-key map key 'icicle-previous-candidate-per-mode-help)) ; `C-M-up'
3282 (dolist (key icicle-modal-cycle-down-help-keys)
3283 (define-key map key 'icicle-next-candidate-per-mode-help)) ; `C-M-down'
3284 (dolist (key icicle-modal-cycle-up-alt-action-keys)
3285 (define-key map key 'icicle-previous-candidate-per-mode-alt-action)) ; `C-S-up'
3286 (dolist (key icicle-modal-cycle-down-alt-action-keys)
3287 (define-key map key 'icicle-next-candidate-per-mode-alt-action)) ; `C-S-down'
3288 ;; Define non-modal cycling help and alternative action keys.
3289 (dolist (key icicle-prefix-cycle-previous-help-keys)
3290 (define-key map key 'icicle-help-on-previous-prefix-candidate)) ; `C-M-home'
3291 (dolist (key icicle-prefix-cycle-next-help-keys)
3292 (define-key map key 'icicle-help-on-next-prefix-candidate)) ; `C-M-end'
3293 (dolist (key icicle-apropos-cycle-previous-help-keys)
3294 (define-key map key 'icicle-help-on-previous-apropos-candidate)) ; `C-M-prior'
3295 (dolist (key icicle-apropos-cycle-next-help-keys)
3296 (define-key map key 'icicle-help-on-next-apropos-candidate)) ; `C-M-next'
3297 (dolist (key icicle-prefix-cycle-previous-alt-action-keys)
3298 (define-key map key 'icicle-previous-prefix-candidate-alt-action)) ; `C-S-home'
3299 (dolist (key icicle-prefix-cycle-next-alt-action-keys)
3300 (define-key map key 'icicle-next-prefix-candidate-alt-action)) ; `C-S-end'
3301 (dolist (key icicle-apropos-cycle-previous-alt-action-keys)
3302 (define-key map key 'icicle-previous-apropos-candidate-alt-action)) ; `C-S-prior'
3303 (dolist (key icicle-apropos-cycle-next-alt-action-keys)
3304 (define-key map key 'icicle-next-apropos-candidate-alt-action))) ; `C-S-next'
3305
3306 (defun icicle-select-minibuffer-contents ()
3307 "Select minibuffer contents and leave point at its beginning."
3308 (let ((min (icicle-minibuffer-prompt-end)))
3309 (set-mark (if (eq 'preselect-start icicle-default-value) (point-max) min))
3310 (goto-char (if (eq 'preselect-start icicle-default-value) min (point-max)))))
3311
3312 ;; $$$ (defadvice next-history-element (after icicle-select-minibuffer-contents activate)
3313 ;; "Select minibuffer contents and leave point at its beginning."
3314 ;; (when (and icicle-mode (memq icicle-default-value '(preselect-start preselect-end)))
3315 ;; (icicle-select-minibuffer-contents)
3316 ;; (setq deactivate-mark nil)))
3317
3318 (defun icicle-cancel-Help-redirection ()
3319 "Cancel redirection of focus from *Help* buffer to minibuffer.
3320 Focus was redirected during `icicle-help-on-candidate'."
3321 (let* ((help-window (get-buffer-window "*Help*" 0))
3322 (help-frame (and help-window (window-frame help-window))))
3323 (when help-frame (redirect-frame-focus help-frame))))
3324
3325 (defun icicle-run-icicle-pre-command-hook ()
3326 "Run `icicle-pre-command-hook' functions.
3327 Used in `pre-command-hook'."
3328 (run-hooks 'icicle-pre-command-hook))
3329
3330 (defun icicle-run-icicle-post-command-hook ()
3331 "Run `icicle-post-command-hook' functions.
3332 Used in `post-command-hook'."
3333 (run-hooks 'icicle-post-command-hook))
3334
3335 (defun icicle-set-calling-cmd ()
3336 "Remember last command that called for completion.
3337 Used in `completion-setup-hook'."
3338 (setq icicle-cmd-calling-for-completion this-command))
3339
3340 (defun icicle-update-ignored-extensions-regexp ()
3341 "Update ignored extensions if `completion-ignored-extensions' changed."
3342 (when (and (icicle-file-name-input-p) ; In `icicles-fn.el'.
3343 (not (equal icicle-ignored-extensions completion-ignored-extensions)))
3344 (setq icicle-ignored-extensions-regexp ; Make regexp for ignored file extensions.
3345 (concat "\\(" (mapconcat #'regexp-quote completion-ignored-extensions "\\|") "\\)\\'")
3346
3347 ;; Flag to prevent updating `icicle-ignored-extensions-regexp' unless
3348 ;; `completion-ignored-extensions' changes.
3349 icicle-ignored-extensions completion-ignored-extensions)))
3350
3351 ;; We change the region background here dynamically.
3352 ;; It would be better to just use a buffer-local face, but those don't yet exist.
3353 (defun icicle-restore-region-face ()
3354 "Restore region face. It was changed during minibuffer activity
3355 if `icicle-change-region-background-flag' is non-nil."
3356 (when (and icicle-change-region-background-flag (= 1 (recursion-depth)))
3357 (set-face-background 'region icicle-saved-region-background)))
3358
3359 (defun icicle-activate-mark ()
3360 "Prevent region from being deactivated. Used in `icicle-post-command-hook'."
3361 (when (and (window-minibuffer-p (selected-window))
3362 icicle-completing-p
3363 (not executing-kbd-macro))
3364 (setq deactivate-mark nil)))
3365
3366 (defun icicle-show-current-help-in-mode-line ()
3367 "Show `icicle-mode-line-help'. Used in `icicle-post-command-hook'."
3368 (when icicle-mode-line-help (icicle-show-help-in-mode-line icicle-mode-line-help)))
3369
3370 (defun icicle-redefine-standard-functions ()
3371 "Alias the functions in `icicle-functions-to-redefine' to Icicles versions."
3372 (when (fboundp 'icicle-completing-read)
3373 (dolist (fn icicle-functions-to-redefine)
3374 (when (fboundp (intern (concat "icicle-ORIG-" (symbol-name fn))))
3375 (fset fn (intern (concat "icicle-" (symbol-name fn))))))))
3376
3377 (defun icicle-restore-standard-functions ()
3378 "Restore original versions of functions in `icicle-functions-to-redefine'."
3379 (when (fboundp 'icicle-ORIG-completing-read)
3380 (let (orig-fn)
3381 (dolist (fn icicle-functions-to-redefine)
3382 (when (fboundp (setq orig-fn (intern (concat "icicle-ORIG-" (symbol-name fn)))))
3383 (fset fn orig-fn))))))
3384
3385 (defun icicle-redefine-standard-widgets ()
3386 "Alias the widgets in `icicle-widgets-to-redefine' to Icicles versions."
3387 (when (fboundp 'icicle-completing-read)
3388 (let (ici-wid)
3389 (dolist (wid icicle-widgets-to-redefine)
3390 (when (icicle-widgetp (intern (concat "icicle-ORIG-" (symbol-name wid))))
3391 (setq ici-wid (intern (concat "icicle-" (symbol-name wid))))
3392 (put wid 'widget-type (get ici-wid 'widget-type))
3393 (put wid 'widget-documentation (get ici-wid 'widget-documentation)))))))
3394
3395 (defun icicle-restore-standard-widgets ()
3396 "Restore original versions of widgets in `icicle-widgets-to-redefine'."
3397 (when (fboundp 'icicle-ORIG-completing-read)
3398 (let (orig-wid)
3399 (dolist (wid icicle-widgets-to-redefine)
3400 (when (icicle-widgetp (setq orig-wid (intern (concat "icicle-ORIG-" (symbol-name wid)))))
3401 (put wid 'widget-type (get orig-wid 'widget-type))
3402 (put wid 'widget-documentation (get orig-wid 'widget-documentation)))))))
3403
3404 ;;; In Emacs versions before 22:
3405 ;;; Save original `read-file-name'. We redefine it as `icicle-read-file-name' (which calls it).
3406 ;;; Then we restore it when you quit Icicle mode. (In Emacs 22+, no redefinition is needed.)
3407 (unless (or (boundp 'read-file-name-function) (fboundp 'icicle-ORIG-read-file-name))
3408 (defalias 'icicle-ORIG-read-file-name (symbol-function 'read-file-name)))
3409
3410 (defun icicle-redefine-std-completion-fns ()
3411 "Replace some standard functions with versions for Icicle mode."
3412 (when (fboundp 'icicle-completing-read)
3413 (fset 'choose-completion 'icicle-choose-completion)
3414 (fset 'choose-completion-string 'icicle-choose-completion-string)
3415 (fset 'completing-read 'icicle-completing-read)
3416 (when (fboundp 'icicle-completing-read-multiple)
3417 (fset 'completing-read-multiple 'icicle-completing-read-multiple)
3418 (setq crm-local-completion-map icicle-crm-local-completion-map
3419 crm-local-must-match-map icicle-crm-local-must-match-map))
3420 (fset 'completion-setup-function 'icicle-completion-setup-function)
3421 (unless (> emacs-major-version 22)
3422 (fset 'dired-smart-shell-command 'icicle-dired-smart-shell-command))
3423 (fset 'display-completion-list 'icicle-display-completion-list)
3424 (fset 'exit-minibuffer 'icicle-exit-minibuffer)
3425 (when (fboundp 'face-valid-attribute-values)
3426 (fset 'face-valid-attribute-values 'icicle-face-valid-attribute-values))
3427 (fset 'minibuffer-complete-and-exit 'icicle-minibuffer-complete-and-exit)
3428 (fset 'mouse-choose-completion 'icicle-mouse-choose-completion)
3429 (fset 'next-history-element 'icicle-next-history-element)
3430 (fset 'read-buffer 'icicle-read-buffer)
3431 (fset 'read-face-name 'icicle-read-face-name)
3432 (if (boundp 'read-file-name-function) ; Emacs 22+
3433 (setq icicle-orig-read-file-name-fn (prog1 (and (not (eq read-file-name-function
3434 'icicle-read-file-name))
3435 read-file-name-function)
3436 (setq read-file-name-function
3437 'icicle-read-file-name)))
3438 (fset 'read-file-name 'icicle-read-file-name)) ; Emacs 20, 21
3439 (when (fboundp 'read-file-name-default) ; Emacs 24+
3440 (fset 'read-file-name-default 'icicle-read-file-name-default))
3441 (when (fboundp 'icicle-read-number)
3442 (fset 'read-number 'icicle-read-number))
3443 (unless (> emacs-major-version 22)
3444 (fset 'shell-command 'icicle-shell-command))
3445 (unless (> emacs-major-version 22)
3446 (fset 'shell-command-on-region 'icicle-shell-command-on-region))
3447 (when (> emacs-major-version 22)
3448 (fset 'sit-for 'icicle-sit-for))
3449 (fset 'switch-to-completions 'icicle-switch-to-completions)
3450 ))
3451
3452 (defun icicle-restore-std-completion-fns ()
3453 "Restore some standard functions that were replaced in Icicle mode."
3454 (when (fboundp 'icicle-ORIG-completing-read)
3455 (fset 'choose-completion 'icicle-ORIG-choose-completion)
3456 (fset 'choose-completion-string 'icicle-ORIG-choose-completion-string)
3457 (fset 'completing-read 'icicle-ORIG-completing-read)
3458 (when (fboundp 'icicle-ORIG-completing-read-multiple)
3459 (fset 'completing-read-multiple 'icicle-ORIG-completing-read-multiple)
3460 (setq crm-local-completion-map icicle-ORIG-crm-local-completion-map
3461 crm-local-must-match-map icicle-ORIG-crm-local-must-match-map))
3462 (fset 'completion-setup-function 'icicle-ORIG-completion-setup-function)
3463 (when (fboundp 'icicle-ORIG-dired-smart-shell-command) ; Emacs 23
3464 (fset 'dired-smart-shell-command 'icicle-ORIG-dired-smart-shell-command))
3465 (fset 'display-completion-list 'icicle-ORIG-display-completion-list)
3466 (fset 'exit-minibuffer 'icicle-ORIG-exit-minibuffer)
3467 (when (fboundp 'icicle-ORIG-face-valid-attribute-values)
3468 (fset 'face-valid-attribute-values 'icicle-ORIG-face-valid-attribute-values))
3469 (fset 'minibuffer-complete-and-exit 'icicle-ORIG-minibuffer-complete-and-exit)
3470 (fset 'mouse-choose-completion 'icicle-ORIG-mouse-choose-completion)
3471 (fset 'next-history-element 'icicle-ORIG-next-history-element)
3472 (fset 'read-buffer 'icicle-ORIG-read-buffer)
3473 (fset 'read-face-name 'icicle-ORIG-read-face-name)
3474 (if (boundp 'read-file-name-function) ; Emacs 22+
3475 (setq read-file-name-function (and (not (eq icicle-orig-read-file-name-fn
3476 'icicle-read-file-name))
3477 icicle-orig-read-file-name-fn))
3478 (fset 'read-file-name 'icicle-ORIG-read-file-name)) ; Emacs 20, 21
3479 (when (fboundp 'icicle-ORIG-read-file-name-default) ; Emacs 24+
3480 (fset 'read-file-name-default 'icicle-ORIG-read-file-name-default))
3481 (when (fboundp 'icicle-ORIG-read-number)
3482 (fset 'read-number 'icicle-ORIG-read-number))
3483 (when (fboundp 'icicle-ORIG-shell-command) ; Emacs < 23
3484 (fset 'shell-command 'icicle-ORIG-shell-command))
3485 (when (fboundp 'icicle-ORIG-shell-command-on-region) ; Emacs < 23
3486 (fset 'shell-command-on-region 'icicle-ORIG-shell-command-on-region))
3487 (when (> emacs-major-version 22)
3488 (fset 'sit-for 'icicle-ORIG-sit-for))
3489 (fset 'switch-to-completions 'icicle-ORIG-switch-to-completions)
3490 ))
3491
3492 ;; Free vars here: `icicle-saved-kmacro-ring-max' is bound in `icicles-var.el'.
3493 (defun icicle-redefine-standard-options ()
3494 "Replace certain standard Emacs options with Icicles versions."
3495 (when (boundp 'icicle-search-ring-max)
3496 (setq icicle-saved-search-ring-max search-ring-max ; Save it.
3497 search-ring-max icicle-search-ring-max
3498 icicle-saved-regexp-search-ring-max regexp-search-ring-max ; Save it.
3499 regexp-search-ring-max icicle-regexp-search-ring-max))
3500 (when (boundp 'icicle-kmacro-ring-max)
3501 (setq icicle-saved-kmacro-ring-max kmacro-ring-max ; Save it.
3502 kmacro-ring-max icicle-kmacro-ring-max)))
3503
3504 (defun icicle-restore-standard-options ()
3505 "Restore standard Emacs options replaced in Icicle mode."
3506 (when (boundp 'icicle-saved-search-ring-max)
3507 (setq search-ring-max icicle-saved-search-ring-max
3508 regexp-search-ring-max icicle-saved-regexp-search-ring-max)))
3509
3510 ;; This is used only in Emacs 22+, but we define it always anyway.
3511 (defun icicle-undo-std-completion-faces ()
3512 "Get rid of standard completion-root highlighting in `*Completions*'."
3513 ;; Do this because the standard Emacs 22 highlighting can interfere with
3514 ;; apropos-completion highlighting.
3515 (when (fboundp 'face-spec-reset-face)
3516 (when (facep 'completions-common-part)
3517 (face-spec-reset-face 'completions-common-part)
3518 (set-face-attribute 'completions-common-part nil :inherit nil))
3519 (when (facep 'completions-first-difference)
3520 (face-spec-reset-face 'completions-first-difference)
3521 (set-face-attribute 'completions-first-difference nil :inherit nil))))
3522
3523
3524 ;;; Save original functions, so they can be restored when leave Icicle mode.
3525 ;;; Toggle Icicle mode after loading the library (and `icicles-mode.el'),
3526 ;;; to pick up the original definition.
3527 ;;;
3528 ;;; Note: The `boundp' test for `icicle-mode' is just in case the form gets evaluated while
3529 ;;; loading `icicles-mode.el' (e.g. the library gets loaded while loading `icicles-mode.el').
3530
3531 ;;; `comint.el' - `comint-dynamic-complete', `comint-dynamic-complete-filename',
3532 ;;; `comint-replace-by-expanded-filename', `comint-completion-at-point'.
3533 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3534 (when icyp (icicle-mode -1))
3535 (when (and (fboundp 'comint-dynamic-complete)
3536 (not (fboundp 'icicle-ORIG-comint-dynamic-complete)))
3537 (fset 'icicle-ORIG-comint-dynamic-complete
3538 (symbol-function 'comint-dynamic-complete)))
3539 (when (and (fboundp 'comint-dynamic-complete-filename)
3540 (not (fboundp 'icicle-ORIG-comint-dynamic-complete-filename)))
3541 (fset 'icicle-ORIG-comint-dynamic-complete-filename
3542 (symbol-function 'comint-dynamic-complete-filename)))
3543 (when (and (fboundp 'comint-replace-by-expanded-filename)
3544 (not (fboundp 'icicle-ORIG-comint-replace-by-expanded-filename)))
3545 (fset 'icicle-ORIG-comint-replace-by-expanded-filename
3546 (symbol-function 'comint-replace-by-expanded-filename)))
3547 (when (and (fboundp 'comint-completion-at-point) ; Emacs 24+
3548 (not (fboundp 'icicle-ORIG-comint-completion-at-point)))
3549 (fset 'icicle-ORIG-comint-completion-at-point
3550 (symbol-function 'comint-completion-at-point)))
3551 (when icyp (icicle-mode 1)))))
3552 (if (featurep 'comint) (eval-after-load "icicles-mode" form) (eval-after-load "comint" form)))
3553
3554 ;;; `ess-site.el' - `ess-complete-object-name'.
3555 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3556 (when icyp (icicle-mode -1))
3557 (when (and (fboundp 'ess-complete-object-name)
3558 (not (fboundp 'icicle-ORIG-ess-complete-object-name)))
3559 (fset 'icicle-ORIG-ess-complete-object-name
3560 (symbol-function 'ess-complete-object-name)))
3561 (when icyp (icicle-mode 1)))))
3562 (if (featurep 'ess-site) (eval-after-load "icicles-mode" form) (eval-after-load "ess-site" form)))
3563
3564 ;;; `gud.el' - `gud-gdb-complete-command'.
3565 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3566 (when icyp (icicle-mode -1))
3567 (when (and (fboundp 'gud-gdb-complete-command)
3568 (not (fboundp 'icicle-ORIG-gud-gdb-complete-command)))
3569 (fset 'icicle-ORIG-gud-gdb-complete-command
3570 (symbol-function 'gud-gdb-complete-command)))
3571 (when icyp (icicle-mode 1)))))
3572 (if (featurep 'gud) (eval-after-load "icicles-mode" form) (eval-after-load "gud" form)))
3573
3574 ;;; `info.el' - `Info-goto-node', `Info-index', `Info-menu'.
3575 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3576 (when icyp (icicle-mode -1))
3577 (when (and (featurep 'info) (not (fboundp 'icicle-ORIG-Info-goto-node)))
3578 (fset 'icicle-ORIG-Info-goto-node (symbol-function 'Info-goto-node))
3579 (fset 'icicle-ORIG-Info-index (symbol-function 'Info-index))
3580 (fset 'icicle-ORIG-Info-menu (symbol-function 'Info-menu)))
3581 (when icyp (icicle-mode 1)))))
3582 (if (featurep 'info) (eval-after-load "icicles-mode" form) (eval-after-load "info" form)))
3583
3584 ;;; `bbdb-com.el' version 2.35 - `bbdb-complete-name'.
3585 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3586 (when icyp (icicle-mode -1))
3587 (when (and (fboundp 'bbdb-complete-name)
3588 (not (fboundp 'icicle-ORIG-bbdb-complete-name)))
3589 (fset 'icicle-ORIG-bbdb-complete-name (symbol-function 'bbdb-complete-name)))
3590 (when icyp (icicle-mode 1)))))
3591 (if (and (featurep 'bbdb-com) (fboundp 'bbdb-complete-name))
3592 (eval-after-load "icicles-mode" form)
3593 (eval-after-load "bbdb-com" form)))
3594
3595 ;;; `bbdb-com.el' version 3.02 - `bbdb-complete-mail'.
3596 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3597 (when icyp (icicle-mode -1))
3598 (when (and (fboundp 'bbdb-complete-mail)
3599 (not (fboundp 'icicle-ORIG-bbdb-complete-mail)))
3600 (fset 'icicle-ORIG-bbdb-complete-mail (symbol-function 'bbdb-complete-mail)))
3601 (when icyp (icicle-mode 1)))))
3602 (if (and (featurep 'bbdb-com) (fboundp 'bbdb-complete-mail))
3603 (eval-after-load "icicles-mode" form)
3604 (eval-after-load "bbdb-com" form)))
3605
3606 ;;; `dired-aux.el' - `dired-read-shell-command'.
3607 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3608 (when icyp (icicle-mode -1))
3609 (when (and (fboundp 'dired-read-shell-command)
3610 (not (fboundp 'icicle-ORIG-dired-read-shell-command)))
3611 (fset 'icicle-ORIG-dired-read-shell-command
3612 (symbol-function 'dired-read-shell-command)))
3613 (when icyp (icicle-mode 1)))))
3614 (if (featurep 'dired-aux)
3615 (eval-after-load "icicles-mode" form)
3616 (eval-after-load "dired-aux" form)))
3617
3618 ;;; `dired-x.el' - `dired-read-shell-command', `dired-smart-shell-command'.
3619 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3620 (when icyp (icicle-mode -1))
3621 (when (and (fboundp 'dired-read-shell-command)
3622 (not (fboundp 'icicle-ORIG-dired-read-shell-command)))
3623 (fset 'icicle-ORIG-dired-read-shell-command
3624 (symbol-function 'dired-read-shell-command)))
3625 (unless (fboundp 'read-shell-command) ; `dired-smart-shell-command' in Emacs < 23.
3626 (when (and (fboundp 'dired-smart-shell-command)
3627 (not (fboundp 'icicle-ORIG-dired-smart-shell-command)))
3628 (fset 'icicle-ORIG-dired-smart-shell-command
3629 (symbol-function 'dired-smart-shell-command))))
3630 (when icyp (icicle-mode 1)))))
3631 (if (featurep 'dired-x) (eval-after-load "icicles-mode" form) (eval-after-load "dired-x" form)))
3632
3633 ;;; `simple.el' - `read-shell-command' - Emacs 23+.
3634 (when (> emacs-major-version 22)
3635 ;; `simple.el' is preloaded for Emacs 23+, so just do it now.
3636 (let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3637 (when icyp (icicle-mode -1))
3638 (when (and (fboundp 'read-shell-command) (not (fboundp 'icicle-ORIG-read-shell-command)))
3639 (defalias 'icicle-ORIG-read-shell-command (symbol-function 'read-shell-command)))
3640 (when icyp (icicle-mode 1))))
3641
3642 ;;; `recentf.el' - `recentf-make-menu-items'.
3643 (let ((form '(let ((icyp (and (boundp 'icicle-mode) icicle-mode)))
3644 (when icyp (icicle-mode -1))
3645 (when (and (fboundp 'recentf-make-menu-items)
3646 (not (fboundp 'icicle-ORIG-recentf-make-menu-items)))
3647 (fset 'icicle-ORIG-recentf-make-menu-items
3648 (symbol-function 'recentf-make-menu-items)))
3649 (when icyp (icicle-mode 1)))))
3650 (if (featurep 'recentf) (eval-after-load "icicles-mode" form) (eval-after-load "recentf" form)))
3651
3652
3653 ;; Do this last.
3654 ;;
3655 ;; When these libraries are first loaded, toggle Icicle mode to pick up the definitions
3656 (dolist (library '("bookmark+" "buff-menu" "comint" "dired" "ess-site" "gud" "ibuffer"
3657 "idlw-shell" ; (untested - I don't have an `idl' program)
3658 "ielm" "info" "net-utils" "rlogin" "shell" "sh-script" "tcl"))
3659 (unless (if (fboundp 'load-history-regexp) ; Emacs 22+
3660 (load-history-filename-element (load-history-regexp library))
3661 (assoc library load-history))
3662 (eval-after-load library '(icicle-toggle-icicle-mode-twice))))
3663
3664 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3665
3666 (provide 'icicles-mode)
3667
3668 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3669 ;;; icicles-mode.el ends here